fa6f56dbe7249d7714a83628bb8d43b04b1d9a37
[openwrt/staging/blocktrron.git] /
1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Tue, 10 Jan 2023 10:31:26 +0100
3 Subject: [PATCH] net: ethernet: mtk_wed: get rid of queue lock for rx queue
4
5 Queue spinlock is currently held in mtk_wed_wo_queue_rx_clean and
6 mtk_wed_wo_queue_refill routines for MTK Wireless Ethernet Dispatcher
7 MCU rx queue. mtk_wed_wo_queue_refill() is running during initialization
8 and in rx tasklet while mtk_wed_wo_queue_rx_clean() is running in
9 mtk_wed_wo_hw_deinit() during hw de-init phase after rx tasklet has been
10 disabled. Since mtk_wed_wo_queue_rx_clean and mtk_wed_wo_queue_refill
11 routines can't run concurrently get rid of spinlock for mcu rx queue.
12
13 Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
14 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
15 Link: https://lore.kernel.org/r/36ec3b729542ea60898471d890796f745479ba32.1673342990.git.lorenzo@kernel.org
16 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
17 ---
18
19 --- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c
20 +++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
21 @@ -138,7 +138,6 @@ mtk_wed_wo_queue_refill(struct mtk_wed_w
22 enum dma_data_direction dir = rx ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
23 int n_buf = 0;
24
25 - spin_lock_bh(&q->lock);
26 while (q->queued < q->n_desc) {
27 struct mtk_wed_wo_queue_entry *entry;
28 dma_addr_t addr;
29 @@ -172,7 +171,6 @@ mtk_wed_wo_queue_refill(struct mtk_wed_w
30 q->queued++;
31 n_buf++;
32 }
33 - spin_unlock_bh(&q->lock);
34
35 return n_buf;
36 }
37 @@ -316,7 +314,6 @@ mtk_wed_wo_queue_rx_clean(struct mtk_wed
38 {
39 struct page *page;
40
41 - spin_lock_bh(&q->lock);
42 for (;;) {
43 void *buf = mtk_wed_wo_dequeue(wo, q, NULL, true);
44
45 @@ -325,7 +322,6 @@ mtk_wed_wo_queue_rx_clean(struct mtk_wed
46
47 skb_free_frag(buf);
48 }
49 - spin_unlock_bh(&q->lock);
50
51 if (!q->cache.va)
52 return;