ath9k: Remove unused argument "size"
PATCH 1/4 ath9k: Remove unused argument "size"
From: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/recv.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +3 -9
@@ -130,7 +130,7 @@ static bool ath_rx_edma_buf_link(struct ath_softc *sc, }static void ath_rx_addbuffer_edma (struct ath_softc *sc, -enum ath9k_rx_qtype qtype,int size) +enum ath9k_rx_qtype qtype) {struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_buf *bf, *tbf;
@@ -250,15 +250,9 @@ rx_init_fail:static void ath_edma_start_recv (struct ath_softc *sc) {ath9k_hw_rxena (sc->sc_ah); - -ath_rx_addbuffer_edma (sc,ATH9K_RX_QUEUE_HP , - sc->rx.rx_edma[ATH9K_RX_QUEUE_HP ].rx_fifo_hwsize); - -ath_rx_addbuffer_edma (sc,ATH9K_RX_QUEUE_LP , - sc->rx.rx_edma[ATH9K_RX_QUEUE_LP ].rx_fifo_hwsize); - +ath_rx_addbuffer_edma (sc,ATH9K_RX_QUEUE_HP ); +ath_rx_addbuffer_edma (sc,ATH9K_RX_QUEUE_LP );ath_opmode_init (sc); -ath9k_hw_startpcureceive (sc->sc_ah, !!(sc->hw->conf.flags &IEEE80211_CONF_OFFCHANNEL )); }
Signature · 1 line
1.8.2.1
PATCH 2/4 ath9k: Reduce deep indentation
From: Sujith Manoharan <[email protected]>
The EDMA case is handled first, so the else condition can be removed.
--- drivers/net/wireless/ath/ath9k/recv.c | 90 +++++++++++++++++------------------ 1 file changed, 44 insertions(+), 46 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +44 -46
@@ -274,49 +274,47 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) common->rx_bufsize =IEEE80211_MAX_MPDU_LEN /2 + sc->sc_ah->caps.rx_status_len; -if (sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_EDMA ) { +if (sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_EDMA )return ath_rx_edma_init (sc, nbufs); - }else { -ath_dbg (common,CONFIG ,"cachelsz %u rxbufsize %u\n" , - common->cachelsz, common->rx_bufsize); -/* Initialize rx descriptors */ +ath_dbg (common,CONFIG ,"cachelsz %u rxbufsize %u\n" , + common->cachelsz, common->rx_bufsize); - error =ath_descdma_setup (sc, &sc->rx.rxdma, &sc->rx.rxbuf, -"rx" , nbufs,1 ,0 ); -if (error !=0 ) { -ath_err (common, -"failed to allocate rx descriptors: %d\n" , - error); +/* Initialize rx descriptors */ + + error =ath_descdma_setup (sc, &sc->rx.rxdma, &sc->rx.rxbuf, +"rx" , nbufs,1 ,0 ); +if (error !=0 ) { +ath_err (common, +"failed to allocate rx descriptors: %d\n" , + error); + goto err; + } + +list_for_each_entry (bf, &sc->rx.rxbuf, list) { + skb =ath_rxbuf_alloc (common, common->rx_bufsize, +GFP_KERNEL ); +if (skb ==NULL ) { + error = -ENOMEM ; goto err; } -list_for_each_entry (bf, &sc->rx.rxbuf, list) { - skb =ath_rxbuf_alloc (common, common->rx_bufsize, -GFP_KERNEL ); -if (skb ==NULL ) { - error = -ENOMEM ; - goto err; - } - - bf->bf_mpdu = skb; - bf->bf_buf_addr =dma_map_single (sc->dev, skb->data, - common->rx_bufsize, -DMA_FROM_DEVICE ); -if (unlikely (dma_mapping_error (sc->dev, - bf->bf_buf_addr))) { -dev_kfree_skb_any (skb); - bf->bf_mpdu =NULL ; - bf->bf_buf_addr =0 ; -ath_err (common, -"dma_mapping_error() on RX init\n" ); - error = -ENOMEM ; - goto err; - } + bf->bf_mpdu = skb; + bf->bf_buf_addr =dma_map_single (sc->dev, skb->data, + common->rx_bufsize, +DMA_FROM_DEVICE ); +if (unlikely (dma_mapping_error (sc->dev, + bf->bf_buf_addr))) { +dev_kfree_skb_any (skb); + bf->bf_mpdu =NULL ; + bf->bf_buf_addr =0 ; +ath_err (common, +"dma_mapping_error() on RX init\n" ); + error = -ENOMEM ; + goto err; } - sc->rx.rxlink =NULL ; } - + sc->rx.rxlink =NULL ; err:if (error)ath_rx_cleanup (sc);
@@ -334,17 +332,17 @@ void ath_rx_cleanup(struct ath_softc *sc)if (sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_EDMA ) {ath_rx_edma_cleanup (sc);return ; - }else { -list_for_each_entry (bf, &sc->rx.rxbuf, list) { - skb = bf->bf_mpdu; -if (skb) { -dma_unmap_single (sc->dev, bf->bf_buf_addr, - common->rx_bufsize, -DMA_FROM_DEVICE ); -dev_kfree_skb (skb); - bf->bf_buf_addr =0 ; - bf->bf_mpdu =NULL ; - } + } + +list_for_each_entry (bf, &sc->rx.rxbuf, list) { + skb = bf->bf_mpdu; +if (skb) { +dma_unmap_single (sc->dev, bf->bf_buf_addr, + common->rx_bufsize, +DMA_FROM_DEVICE ); +dev_kfree_skb (skb); + bf->bf_buf_addr =0 ; + bf->bf_mpdu =NULL ; } } }
Signature · 1 line
1.8.2.1
PATCH 3/4 ath9k: Use lockless variants for the RX fifo queue
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
The RX fifo can be accessed from the common tasklet or it can be reaped/cleaned when RX is stopped, which is done when doing a reset or channel change - this happens in process context.
Since it is ensured that there are no pending tasklets when stopping RX and cleaning the FIFO, there is no need to use SKB queue functions which take internal locks.
--- drivers/net/wireless/ath/ath9k/recv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +2 -2
@@ -124,7 +124,7 @@ static bool ath_rx_edma_buf_link(struct ath_softc *sc,SKB_CB_ATHBUF (skb) = bf;ath9k_hw_addrxbuf_edma (ah, bf->bf_buf_addr, qtype); -skb_queue_tail (&rx_edma->rx_fifo, skb); +__skb_queue_tail (&rx_edma->rx_fifo, skb);return true; }
@@ -155,7 +155,7 @@ static void ath_rx_remove_buffer(struct ath_softc *sc, rx_edma = &sc->rx.rx_edma[qtype]; -while ((skb =skb_dequeue (&rx_edma->rx_fifo)) !=NULL ) { +while ((skb =__skb_dequeue (&rx_edma->rx_fifo)) !=NULL ) { bf =SKB_CB_ATHBUF (skb);BUG_ON (!bf);list_add_tail (&bf->list, &sc->rx.rxbuf);
Signature · 1 line
1.8.2.1
PATCH 4/4 ath9k: Fix RX DMA mapping
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
After the commit "ath9k: improve dma map failure handling", the wrong buffer was DMA-unmapped, introducing warnings like the one below. This patch fixes the issue.
WARNING: at /home/sujith/dev/wireless-testing/lib/dma-debug.c:986 check_sync+0x4bc/0x580() Hardware name: LIFEBOOK AH531 ath9k 0000:02:00.0: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x00000000d9012800] [size=48 bytes] Pid: 86, comm: kworker/u:5 Tainted: G W O 3.9.0-rc8-wl-debug #106 Call Trace: [<ffffffff810410c0>] warn_slowpath_common+0x70/0xa0 [<ffffffff8104113c>] warn_slowpath_fmt+0x4c/0x50 [<ffffffff8125432c>] check_sync+0x4bc/0x580 [<ffffffff8109e5f7>] ? trace_hardirqs_on_caller+0xa7/0x190 [<ffffffff8109e6ed>] ? trace_hardirqs_on+0xd/0x10 [<ffffffff81254488>] debug_dma_sync_single_for_device+0x48/0x50 [<ffffffffa0a53825>] ? ath9k_iowrite32+0x35/0x90 [ath9k] [<ffffffff812512f0>] ? swiotlb_tbl_sync_single+0x50/0x90 [<ffffffff81251350>] ? swiotlb_sync_single+0x20/0x30 [<ffffffff8125137f>] ? swiotlb_sync_single_for_device+0xf/0x20 [<ffffffffa0a58baf>] ath_rx_edma_buf_link+0xef/0x140 [ath9k] [<ffffffffa0a58c4e>] ath_rx_addbuffer_edma+0x4e/0x90 [ath9k] [<ffffffffa0a59c51>] ath_startrecv+0xf1/0x120 [ath9k] [<ffffffffa0a550e0>] ath_complete_reset+0x20/0x130 [ath9k] [<ffffffffa0a5790d>] ath_reset_internal+0x10d/0x210 [ath9k] [<ffffffffa0a5878c>] ath9k_config+0x47c/0x7b0 [ath9k] [<ffffffffa06d4978>] ieee80211_hw_config+0x88/0x3f0 [mac80211] [<ffffffffa06d4a3f>] ? ieee80211_hw_config+0x14f/0x3f0 [mac80211] [<ffffffffa06dbed1>] __ieee80211_scan_completed+0xc1/0x440 [mac80211] [<ffffffffa06dd002>] ieee80211_scan_work+0x82/0x440 [mac80211] [<ffffffff810606a3>] process_one_work+0x1e3/0x530 [<ffffffff81060641>] ? process_one_work+0x181/0x530 [<ffffffff8106163f>] worker_thread+0x10f/0x3c0 [<ffffffff81061530>] ? manage_workers+0x330/0x330 [<ffffffff810665da>] kthread+0xea/0xf0 [<ffffffff810664f0>] ? kthread_create_on_node+0x140/0x140 [<ffffffff8146085c>] ret_from_fork+0x7c/0xb0 [<ffffffff810664f0>] ? kthread_create_on_node+0x140/0x140
--- drivers/net/wireless/ath/ath9k/recv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +3 -3
@@ -1279,13 +1279,13 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) goto requeue_drop_frag; } - bf->bf_mpdu = requeue_skb; - bf->bf_buf_addr = new_buf_addr; -/* Unmap the frame */ dma_unmap_single (sc->dev, bf->bf_buf_addr, common->rx_bufsize, dma_type); + bf->bf_mpdu = requeue_skb; + bf->bf_buf_addr = new_buf_addr; +skb_put (skb, rs.rs_datalen + ah->caps.rx_status_len);if (ah->caps.rx_status_len)skb_pull (skb, ah->caps.rx_status_len);
Signature · 1 line
1.8.2.1
Quoted 3 lines · Sujith Manoharan
From: Sujith Manoharan <[email protected]>
Signed-off-by Sujith Manoharan <[email protected]>
For the whole series: