729-17-v6.3-net-ethernet-mtk_wed-get-rid-of-queue-lock-for-tx-qu.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From: Lorenzo Bianconi <[email protected]>
  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
  4. Similar to MTK Wireless Ethernet Dispatcher (WED) MCU rx queue,
  5. we do not need to protect WED MCU tx queue with a spin lock since
  6. the tx queue is accessed in the two following routines:
  7. - mtk_wed_wo_queue_tx_skb():
  8. it is run at initialization and during mt7915 normal operation.
  9. Moreover MCU messages are serialized through MCU mutex.
  10. - mtk_wed_wo_queue_tx_clean():
  11. it runs just at mt7915 driver module unload when no more messages
  12. are sent to the MCU.
  13. Remove tx queue spinlock.
  14. Signed-off-by: Lorenzo Bianconi <[email protected]>
  15. Link: https://lore.kernel.org/r/7bd0337b2a13ab1a63673b7c03fd35206b3b284e.1673515140.git.lorenzo@kernel.org
  16. Signed-off-by: Jakub Kicinski <[email protected]>
  17. ---
  18. --- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c
  19. +++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
  20. @@ -258,7 +258,6 @@ mtk_wed_wo_queue_alloc(struct mtk_wed_wo
  21. int n_desc, int buf_size, int index,
  22. struct mtk_wed_wo_queue_regs *regs)
  23. {
  24. - spin_lock_init(&q->lock);
  25. q->regs = *regs;
  26. q->n_desc = n_desc;
  27. q->buf_size = buf_size;
  28. @@ -290,7 +289,6 @@ mtk_wed_wo_queue_tx_clean(struct mtk_wed
  29. struct page *page;
  30. int i;
  31. - spin_lock_bh(&q->lock);
  32. for (i = 0; i < q->n_desc; i++) {
  33. struct mtk_wed_wo_queue_entry *entry = &q->entry[i];
  34. @@ -299,7 +297,6 @@ mtk_wed_wo_queue_tx_clean(struct mtk_wed
  35. skb_free_frag(entry->buf);
  36. entry->buf = NULL;
  37. }
  38. - spin_unlock_bh(&q->lock);
  39. if (!q->cache.va)
  40. return;
  41. @@ -347,8 +344,6 @@ int mtk_wed_wo_queue_tx_skb(struct mtk_w
  42. int ret = 0, index;
  43. u32 ctrl;
  44. - spin_lock_bh(&q->lock);
  45. -
  46. q->tail = mtk_wed_mmio_r32(wo, q->regs.dma_idx);
  47. index = (q->head + 1) % q->n_desc;
  48. if (q->tail == index) {
  49. @@ -379,8 +374,6 @@ int mtk_wed_wo_queue_tx_skb(struct mtk_w
  50. mtk_wed_wo_queue_kick(wo, q, q->head);
  51. mtk_wed_wo_kickout(wo);
  52. out:
  53. - spin_unlock_bh(&q->lock);
  54. -
  55. dev_kfree_skb(skb);
  56. return ret;
  57. --- a/drivers/net/ethernet/mediatek/mtk_wed_wo.h
  58. +++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
  59. @@ -211,7 +211,6 @@ struct mtk_wed_wo_queue {
  60. struct mtk_wed_wo_queue_regs regs;
  61. struct page_frag_cache cache;
  62. - spinlock_t lock;
  63. struct mtk_wed_wo_queue_desc *desc;
  64. dma_addr_t desc_dma;