diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-11-04 12:11:34 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-11 17:09:07 -0500 |
commit | cc861f7468724e66567baf087b4e413e91b18150 (patch) | |
tree | 317cfe881552a8b2bc79fa18845e64fba76b459c /drivers/net/wireless/ath/ath9k/recv.c | |
parent | 0a45da765e4bf5e8a7705266fa36e0f44787b0a1 (diff) |
ath: move the rx bufsize to common to share with ath5k/ath9k
This will also be used by ath9k_htc.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/recv.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 4420a5800bd6..48ff77255d2f 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -48,6 +48,7 @@ static struct ieee80211_hw * ath_get_virt_hw(struct ath_softc *sc, | |||
48 | static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf) | 48 | static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf) |
49 | { | 49 | { |
50 | struct ath_hw *ah = sc->sc_ah; | 50 | struct ath_hw *ah = sc->sc_ah; |
51 | struct ath_common *common = ath9k_hw_common(ah); | ||
51 | struct ath_desc *ds; | 52 | struct ath_desc *ds; |
52 | struct sk_buff *skb; | 53 | struct sk_buff *skb; |
53 | 54 | ||
@@ -62,11 +63,13 @@ static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf) | |||
62 | BUG_ON(skb == NULL); | 63 | BUG_ON(skb == NULL); |
63 | ds->ds_vdata = skb->data; | 64 | ds->ds_vdata = skb->data; |
64 | 65 | ||
65 | /* setup rx descriptors. The rx.bufsize here tells the harware | 66 | /* |
67 | * setup rx descriptors. The rx_bufsize here tells the hardware | ||
66 | * how much data it can DMA to us and that we are prepared | 68 | * how much data it can DMA to us and that we are prepared |
67 | * to process */ | 69 | * to process |
70 | */ | ||
68 | ath9k_hw_setuprxdesc(ah, ds, | 71 | ath9k_hw_setuprxdesc(ah, ds, |
69 | sc->rx.bufsize, | 72 | common->rx_bufsize, |
70 | 0); | 73 | 0); |
71 | 74 | ||
72 | if (sc->rx.rxlink == NULL) | 75 | if (sc->rx.rxlink == NULL) |
@@ -344,11 +347,11 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) | |||
344 | sc->sc_flags &= ~SC_OP_RXFLUSH; | 347 | sc->sc_flags &= ~SC_OP_RXFLUSH; |
345 | spin_lock_init(&sc->rx.rxbuflock); | 348 | spin_lock_init(&sc->rx.rxbuflock); |
346 | 349 | ||
347 | sc->rx.bufsize = roundup(IEEE80211_MAX_MPDU_LEN, | 350 | common->rx_bufsize = roundup(IEEE80211_MAX_MPDU_LEN, |
348 | min(common->cachelsz, (u16)64)); | 351 | min(common->cachelsz, (u16)64)); |
349 | 352 | ||
350 | ath_print(common, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n", | 353 | ath_print(common, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n", |
351 | common->cachelsz, sc->rx.bufsize); | 354 | common->cachelsz, common->rx_bufsize); |
352 | 355 | ||
353 | /* Initialize rx descriptors */ | 356 | /* Initialize rx descriptors */ |
354 | 357 | ||
@@ -361,7 +364,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) | |||
361 | } | 364 | } |
362 | 365 | ||
363 | list_for_each_entry(bf, &sc->rx.rxbuf, list) { | 366 | list_for_each_entry(bf, &sc->rx.rxbuf, list) { |
364 | skb = ath_rxbuf_alloc(common, sc->rx.bufsize, GFP_KERNEL); | 367 | skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_KERNEL); |
365 | if (skb == NULL) { | 368 | if (skb == NULL) { |
366 | error = -ENOMEM; | 369 | error = -ENOMEM; |
367 | goto err; | 370 | goto err; |
@@ -369,7 +372,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) | |||
369 | 372 | ||
370 | bf->bf_mpdu = skb; | 373 | bf->bf_mpdu = skb; |
371 | bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, | 374 | bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, |
372 | sc->rx.bufsize, | 375 | common->rx_bufsize, |
373 | DMA_FROM_DEVICE); | 376 | DMA_FROM_DEVICE); |
374 | if (unlikely(dma_mapping_error(sc->dev, | 377 | if (unlikely(dma_mapping_error(sc->dev, |
375 | bf->bf_buf_addr))) { | 378 | bf->bf_buf_addr))) { |
@@ -393,6 +396,8 @@ err: | |||
393 | 396 | ||
394 | void ath_rx_cleanup(struct ath_softc *sc) | 397 | void ath_rx_cleanup(struct ath_softc *sc) |
395 | { | 398 | { |
399 | struct ath_hw *ah = sc->sc_ah; | ||
400 | struct ath_common *common = ath9k_hw_common(ah); | ||
396 | struct sk_buff *skb; | 401 | struct sk_buff *skb; |
397 | struct ath_buf *bf; | 402 | struct ath_buf *bf; |
398 | 403 | ||
@@ -400,7 +405,7 @@ void ath_rx_cleanup(struct ath_softc *sc) | |||
400 | skb = bf->bf_mpdu; | 405 | skb = bf->bf_mpdu; |
401 | if (skb) { | 406 | if (skb) { |
402 | dma_unmap_single(sc->dev, bf->bf_buf_addr, | 407 | dma_unmap_single(sc->dev, bf->bf_buf_addr, |
403 | sc->rx.bufsize, DMA_FROM_DEVICE); | 408 | common->rx_bufsize, DMA_FROM_DEVICE); |
404 | dev_kfree_skb(skb); | 409 | dev_kfree_skb(skb); |
405 | } | 410 | } |
406 | } | 411 | } |
@@ -780,7 +785,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
780 | * 2. requeueing the same buffer to h/w | 785 | * 2. requeueing the same buffer to h/w |
781 | */ | 786 | */ |
782 | dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr, | 787 | dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr, |
783 | sc->rx.bufsize, | 788 | common->rx_bufsize, |
784 | DMA_FROM_DEVICE); | 789 | DMA_FROM_DEVICE); |
785 | 790 | ||
786 | hdr = (struct ieee80211_hdr *) skb->data; | 791 | hdr = (struct ieee80211_hdr *) skb->data; |
@@ -797,7 +802,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
797 | goto requeue; | 802 | goto requeue; |
798 | 803 | ||
799 | /* The status portion of the descriptor could get corrupted. */ | 804 | /* The status portion of the descriptor could get corrupted. */ |
800 | if (sc->rx.bufsize < rx_stats->rs_datalen) | 805 | if (common->rx_bufsize < rx_stats->rs_datalen) |
801 | goto requeue; | 806 | goto requeue; |
802 | 807 | ||
803 | if (!ath_rx_prepare(common, hw, skb, rx_stats, | 808 | if (!ath_rx_prepare(common, hw, skb, rx_stats, |
@@ -806,7 +811,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
806 | 811 | ||
807 | /* Ensure we always have an skb to requeue once we are done | 812 | /* Ensure we always have an skb to requeue once we are done |
808 | * processing the current buffer's skb */ | 813 | * processing the current buffer's skb */ |
809 | requeue_skb = ath_rxbuf_alloc(common, sc->rx.bufsize, GFP_ATOMIC); | 814 | requeue_skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC); |
810 | 815 | ||
811 | /* If there is no memory we ignore the current RX'd frame, | 816 | /* If there is no memory we ignore the current RX'd frame, |
812 | * tell hardware it can give us a new frame using the old | 817 | * tell hardware it can give us a new frame using the old |
@@ -817,7 +822,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
817 | 822 | ||
818 | /* Unmap the frame */ | 823 | /* Unmap the frame */ |
819 | dma_unmap_single(sc->dev, bf->bf_buf_addr, | 824 | dma_unmap_single(sc->dev, bf->bf_buf_addr, |
820 | sc->rx.bufsize, | 825 | common->rx_bufsize, |
821 | DMA_FROM_DEVICE); | 826 | DMA_FROM_DEVICE); |
822 | 827 | ||
823 | skb_put(skb, rx_stats->rs_datalen); | 828 | skb_put(skb, rx_stats->rs_datalen); |
@@ -860,8 +865,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
860 | /* We will now give hardware our shiny new allocated skb */ | 865 | /* We will now give hardware our shiny new allocated skb */ |
861 | bf->bf_mpdu = requeue_skb; | 866 | bf->bf_mpdu = requeue_skb; |
862 | bf->bf_buf_addr = dma_map_single(sc->dev, requeue_skb->data, | 867 | bf->bf_buf_addr = dma_map_single(sc->dev, requeue_skb->data, |
863 | sc->rx.bufsize, | 868 | common->rx_bufsize, |
864 | DMA_FROM_DEVICE); | 869 | DMA_FROM_DEVICE); |
865 | if (unlikely(dma_mapping_error(sc->dev, | 870 | if (unlikely(dma_mapping_error(sc->dev, |
866 | bf->bf_buf_addr))) { | 871 | bf->bf_buf_addr))) { |
867 | dev_kfree_skb_any(requeue_skb); | 872 | dev_kfree_skb_any(requeue_skb); |