summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorweongyo <weongyo@FreeBSD.org>2010-07-10 21:39:03 +0000
committerweongyo <weongyo@FreeBSD.org>2010-07-10 21:39:03 +0000
commit8de20561d12d5af97aef21a7f381219089f823c0 (patch)
tree1a9564c4be84e22a0f673d1c90c55350cce65eb4 /sys/dev
parent0a0ebaf1773311070ebf962f08ce9d1361b5c785 (diff)
downloadFreeBSD-src-8de20561d12d5af97aef21a7f381219089f823c0.zip
FreeBSD-src-8de20561d12d5af97aef21a7f381219089f823c0.tar.gz
Fixes a bug for LP PHY that some frames have 2 padding bytes at the
start so we should adjust the mbuf if the driver is running in PIO mode. Now it should work well with WPA authentication and association for LP PHY devices. Tested by: Warren Block <wblock at wonkity.com> MFC after: 1 month
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/bwn/if_bwn.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c
index 32202da..b57ce88 100644
--- a/sys/dev/bwn/if_bwn.c
+++ b/sys/dev/bwn/if_bwn.c
@@ -9072,7 +9072,7 @@ bwn_pio_rxeof(struct bwn_pio_rxqueue *prq)
struct mbuf *m;
uint32_t ctl32, macstat, v32;
unsigned int i, padding;
- uint16_t ctl16, len, v16;
+ uint16_t ctl16, len, totlen, v16;
unsigned char *mp;
char *data;
@@ -9131,7 +9131,8 @@ ready:
}
padding = (macstat & BWN_RX_MAC_PADDING) ? 2 : 0;
- KASSERT(len + padding <= MCLBYTES, ("too big..\n"));
+ totlen = len + padding;
+ KASSERT(totlen <= MCLBYTES, ("too big..\n"));
m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
if (m == NULL) {
device_printf(sc->sc_dev, "%s: out of memory", __func__);
@@ -9139,12 +9140,12 @@ ready:
}
mp = mtod(m, unsigned char *);
if (prq->prq_rev >= 8) {
- siba_read_multi_4(sc->sc_dev, mp + padding, (len & ~3),
+ siba_read_multi_4(sc->sc_dev, mp, (totlen & ~3),
prq->prq_base + BWN_PIO8_RXDATA);
- if (len & 3) {
+ if (totlen & 3) {
v32 = bwn_pio_rx_read_4(prq, BWN_PIO8_RXDATA);
- data = &(mp[len + padding - 1]);
- switch (len & 3) {
+ data = &(mp[totlen - 1]);
+ switch (totlen & 3) {
case 3:
*data = (v32 >> 16);
data--;
@@ -9156,16 +9157,16 @@ ready:
}
}
} else {
- siba_read_multi_2(sc->sc_dev, mp + padding, (len & ~1),
+ siba_read_multi_2(sc->sc_dev, mp, (totlen & ~1),
prq->prq_base + BWN_PIO_RXDATA);
- if (len & 1) {
+ if (totlen & 1) {
v16 = bwn_pio_rx_read_2(prq, BWN_PIO_RXDATA);
- mp[len + padding - 1] = v16;
+ mp[totlen - 1] = v16;
}
}
m->m_pkthdr.rcvif = ifp;
- m->m_len = m->m_pkthdr.len = len + padding;
+ m->m_len = m->m_pkthdr.len = totlen;
bwn_rxeof(prq->prq_mac, m, &rxhdr);
OpenPOWER on IntegriCloud