Skip to content

Commit

Permalink
net: macb: Convert tasklet API to new bottom half workqueue mechanism
Browse files Browse the repository at this point in the history
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 <allen.lkml@gmail.com>
Link: https://patch.msgid.link/20240730183403.4176544-5-allen.lkml@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Allen Pais authored and Jakub Kicinski committed Aug 1, 2024
1 parent 8d3beb6 commit c5092ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/cadence/macb.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/net_tstamp.h>
#include <linux/interrupt.h>
#include <linux/phy/phy.h>
#include <linux/workqueue.h>

#if defined(CONFIG_ARCH_DMA_ADDR_T_64BIT) || defined(CONFIG_MACB_USE_HWSTAMP)
#define MACB_EXT_DESC
Expand Down Expand Up @@ -1330,7 +1331,7 @@ struct macb {
spinlock_t rx_fs_lock;
unsigned int max_tuples;

struct tasklet_struct hresp_err_tasklet;
struct work_struct hresp_err_bh_work;

int rx_bd_rd_prefetch;
int tx_bd_rd_prefetch;
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/cadence/macb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1792,9 +1792,9 @@ static int macb_tx_poll(struct napi_struct *napi, int budget)
return work_done;
}

static void macb_hresp_error_task(struct tasklet_struct *t)
static void macb_hresp_error_task(struct work_struct *work)
{
struct macb *bp = from_tasklet(bp, t, hresp_err_tasklet);
struct macb *bp = from_work(bp, work, hresp_err_bh_work);
struct net_device *dev = bp->dev;
struct macb_queue *queue;
unsigned int q;
Expand Down Expand Up @@ -1994,7 +1994,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
}

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

if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
Expand Down Expand Up @@ -5172,7 +5172,7 @@ static int macb_probe(struct platform_device *pdev)
goto err_out_unregister_mdio;
}

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

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

unregister_netdev(dev);
tasklet_kill(&bp->hresp_err_tasklet);
cancel_work_sync(&bp->hresp_err_bh_work);
pm_runtime_disable(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev);
if (!pm_runtime_suspended(&pdev->dev)) {
Expand Down

0 comments on commit c5092ba

Please sign in to comment.