1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Thu, 12 Jan 2023 10:21:29 +0100
3 Subject: [PATCH] net: ethernet: mtk_wed: get rid of queue lock for tx queue
5 Similar to MTK Wireless Ethernet Dispatcher (WED) MCU rx queue,
6 we do not need to protect WED MCU tx queue with a spin lock since
7 the tx queue is accessed in the two following routines:
8 - mtk_wed_wo_queue_tx_skb():
9 it is run at initialization and during mt7915 normal operation.
10 Moreover MCU messages are serialized through MCU mutex.
11 - mtk_wed_wo_queue_tx_clean():
12 it runs just at mt7915 driver module unload when no more messages
15 Remove tx queue spinlock.
17 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
18 Link: https://lore.kernel.org/r/7bd0337b2a13ab1a63673b7c03fd35206b3b284e.1673515140.git.lorenzo@kernel.org
19 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
22 --- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c
23 +++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
24 @@ -258,7 +258,6 @@ mtk_wed_wo_queue_alloc(struct mtk_wed_wo
25 int n_desc, int buf_size, int index,
26 struct mtk_wed_wo_queue_regs *regs)
28 - spin_lock_init(&q->lock);
31 q->buf_size = buf_size;
32 @@ -290,7 +289,6 @@ mtk_wed_wo_queue_tx_clean(struct mtk_wed
36 - spin_lock_bh(&q->lock);
37 for (i = 0; i < q->n_desc; i++) {
38 struct mtk_wed_wo_queue_entry *entry = &q->entry[i];
40 @@ -299,7 +297,6 @@ mtk_wed_wo_queue_tx_clean(struct mtk_wed
41 skb_free_frag(entry->buf);
44 - spin_unlock_bh(&q->lock);
48 @@ -347,8 +344,6 @@ int mtk_wed_wo_queue_tx_skb(struct mtk_w
52 - spin_lock_bh(&q->lock);
54 q->tail = mtk_wed_mmio_r32(wo, q->regs.dma_idx);
55 index = (q->head + 1) % q->n_desc;
56 if (q->tail == index) {
57 @@ -379,8 +374,6 @@ int mtk_wed_wo_queue_tx_skb(struct mtk_w
58 mtk_wed_wo_queue_kick(wo, q, q->head);
59 mtk_wed_wo_kickout(wo);
61 - spin_unlock_bh(&q->lock);
66 --- a/drivers/net/ethernet/mediatek/mtk_wed_wo.h
67 +++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
68 @@ -211,7 +211,6 @@ struct mtk_wed_wo_queue {
69 struct mtk_wed_wo_queue_regs regs;
71 struct page_frag_cache cache;
74 struct mtk_wed_wo_queue_desc *desc;