netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for tx queue
@ 2023-01-11 17:26 Lorenzo Bianconi
  2023-01-12  5:37 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2023-01-11 17:26 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, lorenzo.bianconi, nbd, john,
	sean.wang, Mark-MC.Lee, sujuan.chen

Similar to MTK Wireless Ethernet Dispatcher (WED) MCU rx queue,
we do not need to protect WED MCU tx queue with a spin lock since
the tx queue is accessed in the two following routines:
- mtk_wed_wo_queue_tx_skb():
  it is run at initialization and during mt7915 normal operation.
  Moreover MCU messages are serialized through MCU mutex.
- mtk_wed_wo_queue_tx_clean():
  it runs just at mt7915 driver module unload when no more messages
  are sent to the MCU.

Remove tx queue spinlock.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
This patch is based on the following patch not applied yet:
https://lore.kernel.org/netdev/36ec3b729542ea60898471d890796f745479ba32.1673342990.git.lorenzo@kernel.org/
---
 drivers/net/ethernet/mediatek/mtk_wed_wo.c | 7 -------
 drivers/net/ethernet/mediatek/mtk_wed_wo.h | 1 -
 2 files changed, 8 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.c b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
index d32b86499896..69fba29055e9 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
@@ -258,7 +258,6 @@ mtk_wed_wo_queue_alloc(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q,
 		       int n_desc, int buf_size, int index,
 		       struct mtk_wed_wo_queue_regs *regs)
 {
-	spin_lock_init(&q->lock);
 	q->regs = *regs;
 	q->n_desc = n_desc;
 	q->buf_size = buf_size;
@@ -290,7 +289,6 @@ mtk_wed_wo_queue_tx_clean(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q)
 	struct page *page;
 	int i;
 
-	spin_lock_bh(&q->lock);
 	for (i = 0; i < q->n_desc; i++) {
 		struct mtk_wed_wo_queue_entry *entry = &q->entry[i];
 
@@ -299,7 +297,6 @@ mtk_wed_wo_queue_tx_clean(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q)
 		skb_free_frag(entry->buf);
 		entry->buf = NULL;
 	}
-	spin_unlock_bh(&q->lock);
 
 	if (!q->cache.va)
 		return;
@@ -347,8 +344,6 @@ int mtk_wed_wo_queue_tx_skb(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q,
 	int ret = 0, index;
 	u32 ctrl;
 
-	spin_lock_bh(&q->lock);
-
 	q->tail = mtk_wed_mmio_r32(wo, q->regs.dma_idx);
 	index = (q->head + 1) % q->n_desc;
 	if (q->tail == index) {
@@ -379,8 +374,6 @@ int mtk_wed_wo_queue_tx_skb(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q,
 	mtk_wed_wo_queue_kick(wo, q, q->head);
 	mtk_wed_wo_kickout(wo);
 out:
-	spin_unlock_bh(&q->lock);
-
 	dev_kfree_skb(skb);
 
 	return ret;
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.h b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
index c8fb85795864..dbcf42ce9173 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.h
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
@@ -211,7 +211,6 @@ struct mtk_wed_wo_queue {
 	struct mtk_wed_wo_queue_regs regs;
 
 	struct page_frag_cache cache;
-	spinlock_t lock;
 
 	struct mtk_wed_wo_queue_desc *desc;
 	dma_addr_t desc_dma;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for tx queue
  2023-01-11 17:26 [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for tx queue Lorenzo Bianconi
@ 2023-01-12  5:37 ` Jakub Kicinski
  2023-01-12  9:15   ` Lorenzo Bianconi
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2023-01-12  5:37 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: netdev, davem, edumazet, pabeni, lorenzo.bianconi, nbd, john,
	sean.wang, Mark-MC.Lee, sujuan.chen

On Wed, 11 Jan 2023 18:26:29 +0100 Lorenzo Bianconi wrote:
> This patch is based on the following patch not applied yet:

The patchwork automation does not support any sort of patch dependency
tracking (it's probably quite doable, some special tag pointing at a
series ID in patchwork, but I ain't got the time..)
You'll have to repost.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for tx queue
  2023-01-12  5:37 ` Jakub Kicinski
@ 2023-01-12  9:15   ` Lorenzo Bianconi
  0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2023-01-12  9:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, davem, edumazet, pabeni, lorenzo.bianconi, nbd, john,
	sean.wang, Mark-MC.Lee, sujuan.chen

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

> On Wed, 11 Jan 2023 18:26:29 +0100 Lorenzo Bianconi wrote:
> > This patch is based on the following patch not applied yet:
> 
> The patchwork automation does not support any sort of patch dependency
> tracking (it's probably quite doable, some special tag pointing at a
> series ID in patchwork, but I ain't got the time..)
> You'll have to repost.

ack, no worries.

Regards,
Lorenzo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-12  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11 17:26 [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for tx queue Lorenzo Bianconi
2023-01-12  5:37 ` Jakub Kicinski
2023-01-12  9:15   ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).