diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-11-20 20:15:13 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-11-25 16:13:08 -0500 |
commit | b4b6cda2298b0c9a0af902312184b775b8867c65 (patch) | |
tree | 7357a39a07d5cb7a4360161fb8acaa09a198c77d /drivers | |
parent | ca0c7e5101fd4f37fed8e851709f08580b92fbb3 (diff) |
ath9k: correct expected max RX buffer size
We should only tell the hardware its capable of DMA'ing
to us only what we asked dev_alloc_skb(). Prior to this
it is possible a large RX'd frame could have corrupted
DMA data but for us but we were saved only because we
were previously also pci_map_single()'ing the same large
value. The issue prior to this though was we were unmapping
a smaller amount which the prior DMA patch fixed.
Signed-off-by: Bennyam Malavazi <Bennyam.Malavazi@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath9k/recv.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index ad5f88879dc4..504a0444d89f 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
@@ -49,10 +49,12 @@ static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf) | |||
49 | ASSERT(skb != NULL); | 49 | ASSERT(skb != NULL); |
50 | ds->ds_vdata = skb->data; | 50 | ds->ds_vdata = skb->data; |
51 | 51 | ||
52 | /* setup rx descriptors */ | 52 | /* setup rx descriptors. The sc_rxbufsize here tells the harware |
53 | * how much data it can DMA to us and that we are prepared | ||
54 | * to process */ | ||
53 | ath9k_hw_setuprxdesc(ah, | 55 | ath9k_hw_setuprxdesc(ah, |
54 | ds, | 56 | ds, |
55 | skb_tailroom(skb), /* buffer size */ | 57 | sc->sc_rxbufsize, |
56 | 0); | 58 | 0); |
57 | 59 | ||
58 | if (sc->sc_rxlink == NULL) | 60 | if (sc->sc_rxlink == NULL) |
@@ -398,6 +400,13 @@ static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, | |||
398 | * in rx'd frames. | 400 | * in rx'd frames. |
399 | */ | 401 | */ |
400 | 402 | ||
403 | /* Note: the kernel can allocate a value greater than | ||
404 | * what we ask it to give us. We really only need 4 KB as that | ||
405 | * is this hardware supports and in fact we need at least 3849 | ||
406 | * as that is the MAX AMSDU size this hardware supports. | ||
407 | * Unfortunately this means we may get 8 KB here from the | ||
408 | * kernel... and that is actually what is observed on some | ||
409 | * systems :( */ | ||
401 | skb = dev_alloc_skb(len + sc->sc_cachelsz - 1); | 410 | skb = dev_alloc_skb(len + sc->sc_cachelsz - 1); |
402 | if (skb != NULL) { | 411 | if (skb != NULL) { |
403 | off = ((unsigned long) skb->data) % sc->sc_cachelsz; | 412 | off = ((unsigned long) skb->data) % sc->sc_cachelsz; |