Skip to content

Commit 20a3bcf

Browse files
Allen Paiskuba-moo
authored andcommitted
net: alteon: 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 alteon 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 9bb3ec1 commit 20a3bcf

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

drivers/net/ethernet/alteon/acenic.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,9 +1560,9 @@ static void ace_watchdog(struct net_device *data, unsigned int txqueue)
15601560
}
15611561

15621562

1563-
static void ace_tasklet(struct tasklet_struct *t)
1563+
static void ace_bh_work(struct work_struct *work)
15641564
{
1565-
struct ace_private *ap = from_tasklet(ap, t, ace_tasklet);
1565+
struct ace_private *ap = from_work(ap, work, ace_bh_work);
15661566
struct net_device *dev = ap->ndev;
15671567
int cur_size;
15681568

@@ -1595,7 +1595,7 @@ static void ace_tasklet(struct tasklet_struct *t)
15951595
#endif
15961596
ace_load_jumbo_rx_ring(dev, RX_JUMBO_SIZE - cur_size);
15971597
}
1598-
ap->tasklet_pending = 0;
1598+
ap->bh_work_pending = 0;
15991599
}
16001600

16011601

@@ -1617,7 +1617,7 @@ static void ace_dump_trace(struct ace_private *ap)
16171617
*
16181618
* Loading rings is safe without holding the spin lock since this is
16191619
* done only before the device is enabled, thus no interrupts are
1620-
* generated and by the interrupt handler/tasklet handler.
1620+
* generated and by the interrupt handler/bh handler.
16211621
*/
16221622
static void ace_load_std_rx_ring(struct net_device *dev, int nr_bufs)
16231623
{
@@ -2160,7 +2160,7 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
21602160
*/
21612161
if (netif_running(dev)) {
21622162
int cur_size;
2163-
int run_tasklet = 0;
2163+
int run_bh_work = 0;
21642164

21652165
cur_size = atomic_read(&ap->cur_rx_bufs);
21662166
if (cur_size < RX_LOW_STD_THRES) {
@@ -2172,7 +2172,7 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
21722172
ace_load_std_rx_ring(dev,
21732173
RX_RING_SIZE - cur_size);
21742174
} else
2175-
run_tasklet = 1;
2175+
run_bh_work = 1;
21762176
}
21772177

21782178
if (!ACE_IS_TIGON_I(ap)) {
@@ -2188,7 +2188,7 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
21882188
ace_load_mini_rx_ring(dev,
21892189
RX_MINI_SIZE - cur_size);
21902190
} else
2191-
run_tasklet = 1;
2191+
run_bh_work = 1;
21922192
}
21932193
}
21942194

@@ -2205,12 +2205,12 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
22052205
ace_load_jumbo_rx_ring(dev,
22062206
RX_JUMBO_SIZE - cur_size);
22072207
} else
2208-
run_tasklet = 1;
2208+
run_bh_work = 1;
22092209
}
22102210
}
2211-
if (run_tasklet && !ap->tasklet_pending) {
2212-
ap->tasklet_pending = 1;
2213-
tasklet_schedule(&ap->ace_tasklet);
2211+
if (run_bh_work && !ap->bh_work_pending) {
2212+
ap->bh_work_pending = 1;
2213+
queue_work(system_bh_wq, &ap->ace_bh_work);
22142214
}
22152215
}
22162216

@@ -2267,7 +2267,7 @@ static int ace_open(struct net_device *dev)
22672267
/*
22682268
* Setup the bottom half rx ring refill handler
22692269
*/
2270-
tasklet_setup(&ap->ace_tasklet, ace_tasklet);
2270+
INIT_WORK(&ap->ace_bh_work, ace_bh_work);
22712271
return 0;
22722272
}
22732273

@@ -2301,7 +2301,7 @@ static int ace_close(struct net_device *dev)
23012301
cmd.idx = 0;
23022302
ace_issue_cmd(regs, &cmd);
23032303

2304-
tasklet_kill(&ap->ace_tasklet);
2304+
cancel_work_sync(&ap->ace_bh_work);
23052305

23062306
/*
23072307
* Make sure one CPU is not processing packets while

drivers/net/ethernet/alteon/acenic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef _ACENIC_H_
33
#define _ACENIC_H_
44
#include <linux/interrupt.h>
5-
5+
#include <linux/workqueue.h>
66

77
/*
88
* Generate TX index update each time, when TX ring is closed.
@@ -667,8 +667,8 @@ struct ace_private
667667
struct rx_desc *rx_mini_ring;
668668
struct rx_desc *rx_return_ring;
669669

670-
int tasklet_pending, jumbo;
671-
struct tasklet_struct ace_tasklet;
670+
int bh_work_pending, jumbo;
671+
struct work_struct ace_bh_work;
672672

673673
struct event *evt_ring;
674674

@@ -776,7 +776,7 @@ static int ace_open(struct net_device *dev);
776776
static netdev_tx_t ace_start_xmit(struct sk_buff *skb,
777777
struct net_device *dev);
778778
static int ace_close(struct net_device *dev);
779-
static void ace_tasklet(struct tasklet_struct *t);
779+
static void ace_bh_work(struct work_struct *work);
780780
static void ace_dump_trace(struct ace_private *ap);
781781
static void ace_set_multicast_list(struct net_device *dev);
782782
static int ace_change_mtu(struct net_device *dev, int new_mtu);

0 commit comments

Comments
 (0)