Skip to content

Commit 8d3beb6

Browse files
Allen Paiskuba-moo
authored andcommitted
net: cnic: 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 cnic 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 2d671dc commit 8d3beb6

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

drivers/net/ethernet/broadcom/cnic.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/if_vlan.h>
3232
#include <linux/prefetch.h>
3333
#include <linux/random.h>
34+
#include <linux/workqueue.h>
3435
#if IS_ENABLED(CONFIG_VLAN_8021Q)
3536
#define BCM_VLAN 1
3637
#endif
@@ -3015,9 +3016,9 @@ static int cnic_service_bnx2(void *data, void *status_blk)
30153016
return cnic_service_bnx2_queues(dev);
30163017
}
30173018

3018-
static void cnic_service_bnx2_msix(struct tasklet_struct *t)
3019+
static void cnic_service_bnx2_msix(struct work_struct *work)
30193020
{
3020-
struct cnic_local *cp = from_tasklet(cp, t, cnic_irq_task);
3021+
struct cnic_local *cp = from_work(cp, work, cnic_irq_bh_work);
30213022
struct cnic_dev *dev = cp->dev;
30223023

30233024
cp->last_status_idx = cnic_service_bnx2_queues(dev);
@@ -3036,7 +3037,7 @@ static void cnic_doirq(struct cnic_dev *dev)
30363037
prefetch(cp->status_blk.gen);
30373038
prefetch(&cp->kcq1.kcq[KCQ_PG(prod)][KCQ_IDX(prod)]);
30383039

3039-
tasklet_schedule(&cp->cnic_irq_task);
3040+
queue_work(system_bh_wq, &cp->cnic_irq_bh_work);
30403041
}
30413042
}
30423043

@@ -3140,9 +3141,9 @@ static u32 cnic_service_bnx2x_kcq(struct cnic_dev *dev, struct kcq_info *info)
31403141
return last_status;
31413142
}
31423143

3143-
static void cnic_service_bnx2x_bh(struct tasklet_struct *t)
3144+
static void cnic_service_bnx2x_bh_work(struct work_struct *work)
31443145
{
3145-
struct cnic_local *cp = from_tasklet(cp, t, cnic_irq_task);
3146+
struct cnic_local *cp = from_work(cp, work, cnic_irq_bh_work);
31463147
struct cnic_dev *dev = cp->dev;
31473148
struct bnx2x *bp = netdev_priv(dev->netdev);
31483149
u32 status_idx, new_status_idx;
@@ -4428,7 +4429,7 @@ static void cnic_free_irq(struct cnic_dev *dev)
44284429

44294430
if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) {
44304431
cp->disable_int_sync(dev);
4431-
tasklet_kill(&cp->cnic_irq_task);
4432+
cancel_work_sync(&cp->cnic_irq_bh_work);
44324433
free_irq(ethdev->irq_arr[0].vector, dev);
44334434
}
44344435
}
@@ -4441,7 +4442,7 @@ static int cnic_request_irq(struct cnic_dev *dev)
44414442

44424443
err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0, "cnic", dev);
44434444
if (err)
4444-
tasklet_disable(&cp->cnic_irq_task);
4445+
disable_work_sync(&cp->cnic_irq_bh_work);
44454446

44464447
return err;
44474448
}
@@ -4464,7 +4465,7 @@ static int cnic_init_bnx2_irq(struct cnic_dev *dev)
44644465
CNIC_WR(dev, base + BNX2_HC_CMD_TICKS_OFF, (64 << 16) | 220);
44654466

44664467
cp->last_status_idx = cp->status_blk.bnx2->status_idx;
4467-
tasklet_setup(&cp->cnic_irq_task, cnic_service_bnx2_msix);
4468+
INIT_WORK(&cp->cnic_irq_bh_work, cnic_service_bnx2_msix);
44684469
err = cnic_request_irq(dev);
44694470
if (err)
44704471
return err;
@@ -4873,7 +4874,7 @@ static int cnic_init_bnx2x_irq(struct cnic_dev *dev)
48734874
struct cnic_eth_dev *ethdev = cp->ethdev;
48744875
int err = 0;
48754876

4876-
tasklet_setup(&cp->cnic_irq_task, cnic_service_bnx2x_bh);
4877+
INIT_WORK(&cp->cnic_irq_bh_work, cnic_service_bnx2x_bh_work);
48774878
if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX)
48784879
err = cnic_request_irq(dev);
48794880

drivers/net/ethernet/broadcom/cnic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ struct cnic_local {
268268
u32 bnx2x_igu_sb_id;
269269
u32 int_num;
270270
u32 last_status_idx;
271-
struct tasklet_struct cnic_irq_task;
271+
struct work_struct cnic_irq_bh_work;
272272

273273
struct kcqe *completed_kcq[MAX_COMPLETED_KCQE];
274274

0 commit comments

Comments
 (0)