* [PATCH 15/15] net: mtk-wed: Convert tasklet API to new bottom half workqueue mechanism
2024-06-21 5:05 [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue Allen Pais
@ 2024-06-21 5:05 ` Allen Pais
2024-06-21 15:25 ` [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue Stephen Hemminger
2024-06-25 10:24 ` Paolo Abeni
2 siblings, 0 replies; 5+ messages in thread
From: Allen Pais @ 2024-06-21 5:05 UTC (permalink / raw)
To: kuba, Felix Fietkau, Sean Wang, Mark Lee, Lorenzo Bianconi,
David S. Miller, Eric Dumazet, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: jes, kda, cai.huoqing, dougmill, npiggin, christophe.leroy,
aneesh.kumar, naveen.n.rao, nnac123, tlfalcon, cooldavid,
marcin.s.wojtas, mlindner, stephen, borisp, bryan.whitehead,
UNGLinuxDriver, louis.peens, richardcochran, linux-rdma,
linux-kernel, linux-acenic, linux-net-drivers, Allen Pais, netdev,
linux-arm-kernel, linux-mediatek
Migrate tasklet APIs to the new bottom half workqueue mechanism. It
replaces all occurrences of tasklet usage with the appropriate workqueue
APIs throughout the mtk-wed driver. This transition ensures compatibility
with the latest design and enhances performance.
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/net/ethernet/mediatek/mtk_wed_wo.c | 12 ++++++------
drivers/net/ethernet/mediatek/mtk_wed_wo.h | 3 ++-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.c b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
index 7063c78bd35f..acca9ec67fcf 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
@@ -71,7 +71,7 @@ static void
mtk_wed_wo_irq_enable(struct mtk_wed_wo *wo, u32 mask)
{
mtk_wed_wo_set_isr_mask(wo, 0, mask, false);
- tasklet_schedule(&wo->mmio.irq_tasklet);
+ queue_work(system_bh_wq, &wo->mmio.irq_bh_work);
}
static void
@@ -227,14 +227,14 @@ mtk_wed_wo_irq_handler(int irq, void *data)
struct mtk_wed_wo *wo = data;
mtk_wed_wo_set_isr(wo, 0);
- tasklet_schedule(&wo->mmio.irq_tasklet);
+ queue_work(system_bh_wq, &wo->mmio.irq_bh_work);
return IRQ_HANDLED;
}
-static void mtk_wed_wo_irq_tasklet(struct tasklet_struct *t)
+static void mtk_wed_wo_irq_bh_work(struct work_struct *work)
{
- struct mtk_wed_wo *wo = from_tasklet(wo, t, mmio.irq_tasklet);
+ struct mtk_wed_wo *wo = from_work(wo, work, mmio.irq_bh_work);
u32 intr, mask;
/* disable interrupts */
@@ -395,7 +395,7 @@ mtk_wed_wo_hardware_init(struct mtk_wed_wo *wo)
wo->mmio.irq = irq_of_parse_and_map(np, 0);
wo->mmio.irq_mask = MTK_WED_WO_ALL_INT_MASK;
spin_lock_init(&wo->mmio.lock);
- tasklet_setup(&wo->mmio.irq_tasklet, mtk_wed_wo_irq_tasklet);
+ INIT_WORK(&wo->mmio.irq_bh_work, mtk_wed_wo_irq_bh_work);
ret = devm_request_irq(wo->hw->dev, wo->mmio.irq,
mtk_wed_wo_irq_handler, IRQF_TRIGGER_HIGH,
@@ -449,7 +449,7 @@ mtk_wed_wo_hw_deinit(struct mtk_wed_wo *wo)
/* disable interrupts */
mtk_wed_wo_set_isr(wo, 0);
- tasklet_disable(&wo->mmio.irq_tasklet);
+ disable_work_sync(&wo->mmio.irq_bh_work);
disable_irq(wo->mmio.irq);
devm_free_irq(wo->hw->dev, wo->mmio.irq, wo);
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.h b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
index 87a67fa3868d..50d619fa213a 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.h
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
@@ -6,6 +6,7 @@
#include <linux/skbuff.h>
#include <linux/netdevice.h>
+#include <linux/workqueue.h>
struct mtk_wed_hw;
@@ -247,7 +248,7 @@ struct mtk_wed_wo {
struct regmap *regs;
spinlock_t lock;
- struct tasklet_struct irq_tasklet;
+ struct work_struct irq_bh_work;
int irq;
u32 irq_mask;
} mmio;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue
2024-06-21 5:05 [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue Allen Pais
2024-06-21 5:05 ` [PATCH 15/15] net: mtk-wed: Convert tasklet API to new bottom half workqueue mechanism Allen Pais
@ 2024-06-21 15:25 ` Stephen Hemminger
2024-06-21 17:49 ` Allen
2024-06-25 10:24 ` Paolo Abeni
2 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2024-06-21 15:25 UTC (permalink / raw)
To: Allen Pais
Cc: kuba, Matthias Brugger, AngeloGioacchino Del Regno, jes, davem,
edumazet, pabeni, kda, cai.huoqing, dougmill, npiggin,
christophe.leroy, aneesh.kumar, naveen.n.rao, nnac123, tlfalcon,
cooldavid, marcin.s.wojtas, mlindner, nbd, sean.wang, Mark-MC.Lee,
lorenzo, borisp, bryan.whitehead, UNGLinuxDriver, louis.peens,
richardcochran, linux-rdma, linux-kernel, linux-acenic,
linux-net-drivers, linux-arm-kernel, linux-mediatek
On Thu, 20 Jun 2024 22:05:10 -0700
Allen Pais <allen.lkml@gmail.com> wrote:
> The only generic interface to execute asynchronously in the BH context is
> tasklet; however, it's marked deprecated and has some design flaws. To
> replace tasklets, BH workqueue support was recently added. A BH workqueue
> behaves similarly to regular workqueues except that the queued work items
> are executed in the BH context.
>
> This patch converts a few drivers in drivers/ethernet/* from tasklet
> to BH workqueue. The next set will be sent out after the next -rc is
> out.
>
> This series is based on
> commit a6ec08beec9e ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
>
> First version converting all the drivers can be found at:
> https://lore.kernel.org/all/20240507190111.16710
> -2-apais@linux.microsoft.com/
>
>
> Allen Pais (15):
> net: alteon: Convert tasklet API to new bottom half workqueue
> mechanism
> net: xgbe: Convert tasklet API to new bottom half workqueue mechanism
> net: cnic: Convert tasklet API to new bottom half workqueue mechanism
> net: macb: Convert tasklet API to new bottom half workqueue mechanism
> net: cavium/liquidio: Convert tasklet API to new bottom half workqueue
> mechanism
> net: octeon: Convert tasklet API to new bottom half workqueue
> mechanism
> net: thunderx: Convert tasklet API to new bottom half workqueue
> mechanism
> net: chelsio: Convert tasklet API to new bottom half workqueue
> mechanism
> net: sundance: Convert tasklet API to new bottom half workqueue
> mechanism
> net: hinic: Convert tasklet API to new bottom half workqueue mechanism
> net: ehea: Convert tasklet API to new bottom half workqueue mechanism
> net: ibmvnic: Convert tasklet API to new bottom half workqueue
> mechanism
> net: jme: Convert tasklet API to new bottom half workqueue mechanism
> net: marvell: Convert tasklet API to new bottom half workqueue
> mechanism
> net: mtk-wed: Convert tasklet API to new bottom half workqueue
> mechanism
>
> drivers/net/ethernet/alteon/acenic.c | 26 +++----
> drivers/net/ethernet/alteon/acenic.h | 8 +--
> drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 30 ++++----
> drivers/net/ethernet/amd/xgbe/xgbe-i2c.c | 16 ++---
> drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 16 ++---
> drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 4 +-
> drivers/net/ethernet/amd/xgbe/xgbe.h | 10 +--
> drivers/net/ethernet/broadcom/cnic.c | 19 ++---
> drivers/net/ethernet/broadcom/cnic.h | 2 +-
> drivers/net/ethernet/cadence/macb.h | 3 +-
> drivers/net/ethernet/cadence/macb_main.c | 10 +--
> .../net/ethernet/cavium/liquidio/lio_core.c | 4 +-
> .../net/ethernet/cavium/liquidio/lio_main.c | 24 +++----
> .../ethernet/cavium/liquidio/lio_vf_main.c | 10 +--
> .../ethernet/cavium/liquidio/octeon_droq.c | 4 +-
> .../ethernet/cavium/liquidio/octeon_main.h | 4 +-
> .../net/ethernet/cavium/octeon/octeon_mgmt.c | 13 ++--
> drivers/net/ethernet/cavium/thunder/nic.h | 5 +-
> .../net/ethernet/cavium/thunder/nicvf_main.c | 24 +++----
> .../ethernet/cavium/thunder/nicvf_queues.c | 4 +-
> .../ethernet/cavium/thunder/nicvf_queues.h | 2 +-
> drivers/net/ethernet/chelsio/cxgb/sge.c | 19 ++---
> drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 9 +--
> .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +-
> .../ethernet/chelsio/cxgb4/cxgb4_tc_mqprio.c | 4 +-
> .../net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 2 +-
> drivers/net/ethernet/chelsio/cxgb4/sge.c | 40 +++++------
> drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 6 +-
> drivers/net/ethernet/dlink/sundance.c | 41 +++++------
> .../net/ethernet/huawei/hinic/hinic_hw_cmdq.c | 2 +-
> .../net/ethernet/huawei/hinic/hinic_hw_eqs.c | 17 +++--
> .../net/ethernet/huawei/hinic/hinic_hw_eqs.h | 2 +-
> drivers/net/ethernet/ibm/ehea/ehea.h | 3 +-
> drivers/net/ethernet/ibm/ehea/ehea_main.c | 14 ++--
> drivers/net/ethernet/ibm/ibmvnic.c | 24 +++----
> drivers/net/ethernet/ibm/ibmvnic.h | 2 +-
> drivers/net/ethernet/jme.c | 72 +++++++++----------
> drivers/net/ethernet/jme.h | 8 +--
> .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 +-
> drivers/net/ethernet/marvell/skge.c | 12 ++--
> drivers/net/ethernet/marvell/skge.h | 3 +-
> drivers/net/ethernet/mediatek/mtk_wed_wo.c | 12 ++--
> drivers/net/ethernet/mediatek/mtk_wed_wo.h | 3 +-
> 43 files changed, 273 insertions(+), 266 deletions(-)
>
This should also go to netdev@vger.kernel.org
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue
2024-06-21 15:25 ` [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue Stephen Hemminger
@ 2024-06-21 17:49 ` Allen
0 siblings, 0 replies; 5+ messages in thread
From: Allen @ 2024-06-21 17:49 UTC (permalink / raw)
To: Stephen Hemminger
Cc: kuba, Matthias Brugger, AngeloGioacchino Del Regno, jes, davem,
edumazet, pabeni, kda, cai.huoqing, dougmill, npiggin,
christophe.leroy, aneesh.kumar, naveen.n.rao, nnac123, tlfalcon,
cooldavid, marcin.s.wojtas, mlindner, nbd, sean.wang, Mark-MC.Lee,
lorenzo, borisp, bryan.whitehead, UNGLinuxDriver, louis.peens,
richardcochran, linux-rdma, linux-kernel, linux-acenic,
linux-net-drivers, linux-arm-kernel, linux-mediatek
>
> > The only generic interface to execute asynchronously in the BH context is
> > tasklet; however, it's marked deprecated and has some design flaws. To
> > replace tasklets, BH workqueue support was recently added. A BH workqueue
> > behaves similarly to regular workqueues except that the queued work items
> > are executed in the BH context.
> >
> > This patch converts a few drivers in drivers/ethernet/* from tasklet
> > to BH workqueue. The next set will be sent out after the next -rc is
> > out.
> >
> > This series is based on
> > commit a6ec08beec9e ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
> >
> > First version converting all the drivers can be found at:
> > https://lore.kernel.org/all/20240507190111.16710
> > -2-apais@linux.microsoft.com/
> >
> >
> > Allen Pais (15):
> > net: alteon: Convert tasklet API to new bottom half workqueue
> > mechanism
> > net: xgbe: Convert tasklet API to new bottom half workqueue mechanism
> > net: cnic: Convert tasklet API to new bottom half workqueue mechanism
> > net: macb: Convert tasklet API to new bottom half workqueue mechanism
> > net: cavium/liquidio: Convert tasklet API to new bottom half workqueue
> > mechanism
> > net: octeon: Convert tasklet API to new bottom half workqueue
> > mechanism
> > net: thunderx: Convert tasklet API to new bottom half workqueue
> > mechanism
> > net: chelsio: Convert tasklet API to new bottom half workqueue
> > mechanism
> > net: sundance: Convert tasklet API to new bottom half workqueue
> > mechanism
> > net: hinic: Convert tasklet API to new bottom half workqueue mechanism
> > net: ehea: Convert tasklet API to new bottom half workqueue mechanism
> > net: ibmvnic: Convert tasklet API to new bottom half workqueue
> > mechanism
> > net: jme: Convert tasklet API to new bottom half workqueue mechanism
> > net: marvell: Convert tasklet API to new bottom half workqueue
> > mechanism
> > net: mtk-wed: Convert tasklet API to new bottom half workqueue
> > mechanism
> >
> > drivers/net/ethernet/alteon/acenic.c | 26 +++----
> > drivers/net/ethernet/alteon/acenic.h | 8 +--
> > drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 30 ++++----
> > drivers/net/ethernet/amd/xgbe/xgbe-i2c.c | 16 ++---
> > drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 16 ++---
> > drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 4 +-
> > drivers/net/ethernet/amd/xgbe/xgbe.h | 10 +--
> > drivers/net/ethernet/broadcom/cnic.c | 19 ++---
> > drivers/net/ethernet/broadcom/cnic.h | 2 +-
> > drivers/net/ethernet/cadence/macb.h | 3 +-
> > drivers/net/ethernet/cadence/macb_main.c | 10 +--
> > .../net/ethernet/cavium/liquidio/lio_core.c | 4 +-
> > .../net/ethernet/cavium/liquidio/lio_main.c | 24 +++----
> > .../ethernet/cavium/liquidio/lio_vf_main.c | 10 +--
> > .../ethernet/cavium/liquidio/octeon_droq.c | 4 +-
> > .../ethernet/cavium/liquidio/octeon_main.h | 4 +-
> > .../net/ethernet/cavium/octeon/octeon_mgmt.c | 13 ++--
> > drivers/net/ethernet/cavium/thunder/nic.h | 5 +-
> > .../net/ethernet/cavium/thunder/nicvf_main.c | 24 +++----
> > .../ethernet/cavium/thunder/nicvf_queues.c | 4 +-
> > .../ethernet/cavium/thunder/nicvf_queues.h | 2 +-
> > drivers/net/ethernet/chelsio/cxgb/sge.c | 19 ++---
> > drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 9 +--
> > .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +-
> > .../ethernet/chelsio/cxgb4/cxgb4_tc_mqprio.c | 4 +-
> > .../net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 2 +-
> > drivers/net/ethernet/chelsio/cxgb4/sge.c | 40 +++++------
> > drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 6 +-
> > drivers/net/ethernet/dlink/sundance.c | 41 +++++------
> > .../net/ethernet/huawei/hinic/hinic_hw_cmdq.c | 2 +-
> > .../net/ethernet/huawei/hinic/hinic_hw_eqs.c | 17 +++--
> > .../net/ethernet/huawei/hinic/hinic_hw_eqs.h | 2 +-
> > drivers/net/ethernet/ibm/ehea/ehea.h | 3 +-
> > drivers/net/ethernet/ibm/ehea/ehea_main.c | 14 ++--
> > drivers/net/ethernet/ibm/ibmvnic.c | 24 +++----
> > drivers/net/ethernet/ibm/ibmvnic.h | 2 +-
> > drivers/net/ethernet/jme.c | 72 +++++++++----------
> > drivers/net/ethernet/jme.h | 8 +--
> > .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 +-
> > drivers/net/ethernet/marvell/skge.c | 12 ++--
> > drivers/net/ethernet/marvell/skge.h | 3 +-
> > drivers/net/ethernet/mediatek/mtk_wed_wo.c | 12 ++--
> > drivers/net/ethernet/mediatek/mtk_wed_wo.h | 3 +-
> > 43 files changed, 273 insertions(+), 266 deletions(-)
> >
>
> This should also go to netdev@vger.kernel.org
My Bad, I thought I had it marked. Thanks for pointing it out.
- Allen
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue
2024-06-21 5:05 [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue Allen Pais
2024-06-21 5:05 ` [PATCH 15/15] net: mtk-wed: Convert tasklet API to new bottom half workqueue mechanism Allen Pais
2024-06-21 15:25 ` [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue Stephen Hemminger
@ 2024-06-25 10:24 ` Paolo Abeni
2 siblings, 0 replies; 5+ messages in thread
From: Paolo Abeni @ 2024-06-25 10:24 UTC (permalink / raw)
To: Allen Pais, kuba, Matthias Brugger, AngeloGioacchino Del Regno
Cc: jes, davem, edumazet, kda, cai.huoqing, dougmill, npiggin,
christophe.leroy, aneesh.kumar, naveen.n.rao, nnac123, tlfalcon,
cooldavid, marcin.s.wojtas, mlindner, stephen, nbd, sean.wang,
Mark-MC.Lee, lorenzo, borisp, bryan.whitehead, UNGLinuxDriver,
louis.peens, richardcochran, linux-rdma, linux-kernel,
linux-acenic, linux-net-drivers, linux-arm-kernel, linux-mediatek
On Thu, 2024-06-20 at 22:05 -0700, Allen Pais wrote:
> The only generic interface to execute asynchronously in the BH context is
> tasklet; however, it's marked deprecated and has some design flaws. To
> replace tasklets, BH workqueue support was recently added. A BH workqueue
> behaves similarly to regular workqueues except that the queued work items
> are executed in the BH context.
>
> This patch converts a few drivers in drivers/ethernet/* from tasklet
> to BH workqueue. The next set will be sent out after the next -rc is
> out.
>
> This series is based on
> commit a6ec08beec9e ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
>
> First version converting all the drivers can be found at:
> https://lore.kernel.org/all/20240507190111.16710
> -2-apais@linux.microsoft.com/
The above link was mangled.
I guess you will have to re-submit to cope at least with Andrew's
feedback, but it think it's better to wait a little longer for the next
version, to give the vendors more time to actually test this.
When you will re-submit you can retain the already collected ack.
Please include the target tree ('net-next') in the subj title and a
revision counter ('v3'). The whole subj should be:
[PATCH net-next v3 00/15] ethernet: Convert from tasklet to BH workqueue
Thanks,
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread