Commit c5092ba3 authored by Allen Pais's avatar Allen Pais Committed by Jakub Kicinski

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: default avatarAllen Pais <allen.lkml@gmail.com>
Link: https://patch.msgid.link/20240730183403.4176544-5-allen.lkml@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8d3beb6b
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/net_tstamp.h> #include <linux/net_tstamp.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/workqueue.h>
#if defined(CONFIG_ARCH_DMA_ADDR_T_64BIT) || defined(CONFIG_MACB_USE_HWSTAMP) #if defined(CONFIG_ARCH_DMA_ADDR_T_64BIT) || defined(CONFIG_MACB_USE_HWSTAMP)
#define MACB_EXT_DESC #define MACB_EXT_DESC
...@@ -1330,7 +1331,7 @@ struct macb { ...@@ -1330,7 +1331,7 @@ struct macb {
spinlock_t rx_fs_lock; spinlock_t rx_fs_lock;
unsigned int max_tuples; unsigned int max_tuples;
struct tasklet_struct hresp_err_tasklet; struct work_struct hresp_err_bh_work;
int rx_bd_rd_prefetch; int rx_bd_rd_prefetch;
int tx_bd_rd_prefetch; int tx_bd_rd_prefetch;
......
...@@ -1792,9 +1792,9 @@ static int macb_tx_poll(struct napi_struct *napi, int budget) ...@@ -1792,9 +1792,9 @@ static int macb_tx_poll(struct napi_struct *napi, int budget)
return work_done; 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 net_device *dev = bp->dev;
struct macb_queue *queue; struct macb_queue *queue;
unsigned int q; unsigned int q;
...@@ -1994,7 +1994,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) ...@@ -1994,7 +1994,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
} }
if (status & MACB_BIT(HRESP)) { 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"); netdev_err(dev, "DMA bus error: HRESP not OK\n");
if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
...@@ -5172,7 +5172,7 @@ static int macb_probe(struct platform_device *pdev) ...@@ -5172,7 +5172,7 @@ static int macb_probe(struct platform_device *pdev)
goto err_out_unregister_mdio; 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", 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), macb_is_gem(bp) ? "GEM" : "MACB", macb_readl(bp, MID),
...@@ -5216,7 +5216,7 @@ static void macb_remove(struct platform_device *pdev) ...@@ -5216,7 +5216,7 @@ static void macb_remove(struct platform_device *pdev)
mdiobus_free(bp->mii_bus); mdiobus_free(bp->mii_bus);
unregister_netdev(dev); unregister_netdev(dev);
tasklet_kill(&bp->hresp_err_tasklet); cancel_work_sync(&bp->hresp_err_bh_work);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev);
if (!pm_runtime_suspended(&pdev->dev)) { if (!pm_runtime_suspended(&pdev->dev)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment