Skip to content

Commit c5092ba

Browse files
Allen Paiskuba-moo
authored andcommitted
net: macb: Convert tasklet API to new bottom half workqueue mechanism
Migrate tasklet APIs to the new bottom half workqueue mechanism. It replaces all occurrences of tasklet usage with the appropriate workqueue APIs throughout the macb driver. This transition ensures compatibility with the latest design and enhances performance. Signed-off-by: Allen Pais <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8d3beb6 commit c5092ba

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

drivers/net/ethernet/cadence/macb.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/net_tstamp.h>
1414
#include <linux/interrupt.h>
1515
#include <linux/phy/phy.h>
16+
#include <linux/workqueue.h>
1617

1718
#if defined(CONFIG_ARCH_DMA_ADDR_T_64BIT) || defined(CONFIG_MACB_USE_HWSTAMP)
1819
#define MACB_EXT_DESC
@@ -1330,7 +1331,7 @@ struct macb {
13301331
spinlock_t rx_fs_lock;
13311332
unsigned int max_tuples;
13321333

1333-
struct tasklet_struct hresp_err_tasklet;
1334+
struct work_struct hresp_err_bh_work;
13341335

13351336
int rx_bd_rd_prefetch;
13361337
int tx_bd_rd_prefetch;

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,9 +1792,9 @@ static int macb_tx_poll(struct napi_struct *napi, int budget)
17921792
return work_done;
17931793
}
17941794

1795-
static void macb_hresp_error_task(struct tasklet_struct *t)
1795+
static void macb_hresp_error_task(struct work_struct *work)
17961796
{
1797-
struct macb *bp = from_tasklet(bp, t, hresp_err_tasklet);
1797+
struct macb *bp = from_work(bp, work, hresp_err_bh_work);
17981798
struct net_device *dev = bp->dev;
17991799
struct macb_queue *queue;
18001800
unsigned int q;
@@ -1994,7 +1994,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
19941994
}
19951995

19961996
if (status & MACB_BIT(HRESP)) {
1997-
tasklet_schedule(&bp->hresp_err_tasklet);
1997+
queue_work(system_bh_wq, &bp->hresp_err_bh_work);
19981998
netdev_err(dev, "DMA bus error: HRESP not OK\n");
19991999

20002000
if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
@@ -5172,7 +5172,7 @@ static int macb_probe(struct platform_device *pdev)
51725172
goto err_out_unregister_mdio;
51735173
}
51745174

5175-
tasklet_setup(&bp->hresp_err_tasklet, macb_hresp_error_task);
5175+
INIT_WORK(&bp->hresp_err_bh_work, macb_hresp_error_task);
51765176

51775177
netdev_info(dev, "Cadence %s rev 0x%08x at 0x%08lx irq %d (%pM)\n",
51785178
macb_is_gem(bp) ? "GEM" : "MACB", macb_readl(bp, MID),
@@ -5216,7 +5216,7 @@ static void macb_remove(struct platform_device *pdev)
52165216
mdiobus_free(bp->mii_bus);
52175217

52185218
unregister_netdev(dev);
5219-
tasklet_kill(&bp->hresp_err_tasklet);
5219+
cancel_work_sync(&bp->hresp_err_bh_work);
52205220
pm_runtime_disable(&pdev->dev);
52215221
pm_runtime_dont_use_autosuspend(&pdev->dev);
52225222
if (!pm_runtime_suspended(&pdev->dev)) {

0 commit comments

Comments
 (0)