From: Allen Pais <allen.lkml@gmail.com>
To: netdev@vger.kernel.org
Cc: Allen Pais <allen.lkml@gmail.com>
Subject: [PATCH 12/15] net: ibmvnic: Convert tasklet API to new bottom half workqueue mechanism
Date: Fri, 21 Jun 2024 11:39:44 -0700 [thread overview]
Message-ID: <20240621183947.4105278-13-allen.lkml@gmail.com> (raw)
In-Reply-To: <20240621183947.4105278-1-allen.lkml@gmail.com>
Migrate tasklet APIs to the new bottom half workqueue mechanism. It
replaces all occurrences of tasklet usage with the appropriate workqueue
APIs throughout the ibmvnic driver. This transition ensures compatibility
with the latest design and enhances performance.
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 24 ++++++++++++------------
drivers/net/ethernet/ibm/ibmvnic.h | 2 +-
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 5e9a93bdb518..2e817a560c3a 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -2725,7 +2725,7 @@ static const char *reset_reason_to_string(enum ibmvnic_reset_reason reason)
/*
* Initialize the init_done completion and return code values. We
* can get a transport event just after registering the CRQ and the
- * tasklet will use this to communicate the transport event. To ensure
+ * bh work will use this to communicate the transport event. To ensure
* we don't miss the notification/error, initialize these _before_
* regisering the CRQ.
*/
@@ -4429,7 +4429,7 @@ static void send_request_cap(struct ibmvnic_adapter *adapter, int retry)
int cap_reqs;
/* We send out 6 or 7 REQUEST_CAPABILITY CRQs below (depending on
- * the PROMISC flag). Initialize this count upfront. When the tasklet
+ * the PROMISC flag). Initialize this count upfront. When the bh work
* receives a response to all of these, it will send the next protocol
* message (QUERY_IP_OFFLOAD).
*/
@@ -4965,7 +4965,7 @@ static void send_query_cap(struct ibmvnic_adapter *adapter)
int cap_reqs;
/* We send out 25 QUERY_CAPABILITY CRQs below. Initialize this count
- * upfront. When the tasklet receives a response to all of these, it
+ * upfront. When the bh work receives a response to all of these, it
* can send out the next protocol messaage (REQUEST_CAPABILITY).
*/
cap_reqs = 25;
@@ -5477,7 +5477,7 @@ static int handle_login_rsp(union ibmvnic_crq *login_rsp_crq,
int i;
/* CHECK: Test/set of login_pending does not need to be atomic
- * because only ibmvnic_tasklet tests/clears this.
+ * because only ibmvnic_bh_work tests/clears this.
*/
if (!adapter->login_pending) {
netdev_warn(netdev, "Ignoring unexpected login response\n");
@@ -6063,13 +6063,13 @@ static irqreturn_t ibmvnic_interrupt(int irq, void *instance)
{
struct ibmvnic_adapter *adapter = instance;
- tasklet_schedule(&adapter->tasklet);
+ queue_work(system_bh_wq, &adapter->bh_work);
return IRQ_HANDLED;
}
-static void ibmvnic_tasklet(struct tasklet_struct *t)
+static void ibmvnic_bh_work(struct work_struct *work)
{
- struct ibmvnic_adapter *adapter = from_tasklet(adapter, t, tasklet);
+ struct ibmvnic_adapter *adapter = from_work(adapter, work, bh_work);
struct ibmvnic_crq_queue *queue = &adapter->crq;
union ibmvnic_crq *crq;
unsigned long flags;
@@ -6150,7 +6150,7 @@ static void release_crq_queue(struct ibmvnic_adapter *adapter)
netdev_dbg(adapter->netdev, "Releasing CRQ\n");
free_irq(vdev->irq, adapter);
- tasklet_kill(&adapter->tasklet);
+ cancel_work_sync(&adapter->bh_work);
do {
rc = plpar_hcall_norets(H_FREE_CRQ, vdev->unit_address);
} while (rc == H_BUSY || H_IS_LONG_BUSY(rc));
@@ -6201,7 +6201,7 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
retrc = 0;
- tasklet_setup(&adapter->tasklet, (void *)ibmvnic_tasklet);
+ INIT_WORK(&adapter->bh_work, (void *)ibmvnic_bh_work);
netdev_dbg(adapter->netdev, "registering irq 0x%x\n", vdev->irq);
snprintf(crq->name, sizeof(crq->name), "ibmvnic-%x",
@@ -6223,12 +6223,12 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
spin_lock_init(&crq->lock);
/* process any CRQs that were queued before we enabled interrupts */
- tasklet_schedule(&adapter->tasklet);
+ queue_work(system_bh_wq, &adapter->bh_work);
return retrc;
req_irq_failed:
- tasklet_kill(&adapter->tasklet);
+ cancel_work_sync(&adapter->bh_work);
do {
rc = plpar_hcall_norets(H_FREE_CRQ, vdev->unit_address);
} while (rc == H_BUSY || H_IS_LONG_BUSY(rc));
@@ -6621,7 +6621,7 @@ static int ibmvnic_resume(struct device *dev)
if (adapter->state != VNIC_OPEN)
return 0;
- tasklet_schedule(&adapter->tasklet);
+ queue_work(system_bh_wq, &adapter->bh_work);
return 0;
}
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index 94ac36b1408b..b65b210a8059 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -1036,7 +1036,7 @@ struct ibmvnic_adapter {
u32 cur_rx_buf_sz;
u32 prev_rx_buf_sz;
- struct tasklet_struct tasklet;
+ struct work_struct bh_work;
enum vnic_state state;
/* Used for serialization of state field. When taking both state
* and rwi locks, take state lock first.
--
2.34.1
next prev parent reply other threads:[~2024-06-21 18:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 18:39 [PATCH 00/15] ethernet: Convert from tasklet to BH workqueue Allen Pais
2024-06-21 18:39 ` [PATCH 01/15] net: alteon: Convert tasklet API to new bottom half workqueue mechanism Allen Pais
2024-06-21 18:39 ` [PATCH 02/15] net: xgbe: " Allen Pais
2024-06-21 18:39 ` [PATCH 03/15] net: cnic: " Allen Pais
2024-06-21 18:39 ` [PATCH 04/15] net: macb: " Allen Pais
2024-06-21 18:39 ` [PATCH 05/15] net: cavium/liquidio: " Allen Pais
2024-06-21 18:39 ` [PATCH 06/15] net: octeon: " Allen Pais
2024-06-21 18:39 ` [PATCH 07/15] net: thunderx: " Allen Pais
2024-06-21 18:39 ` [PATCH 08/15] net: chelsio: " Allen Pais
2024-06-21 18:39 ` [PATCH 09/15] net: sundance: " Allen Pais
2024-06-21 18:39 ` [PATCH 10/15] net: hinic: " Allen Pais
2024-06-21 18:39 ` [PATCH 11/15] net: ehea: " Allen Pais
2024-06-21 18:39 ` Allen Pais [this message]
2024-06-21 18:39 ` [PATCH 13/15] net: jme: " Allen Pais
2024-06-21 18:39 ` [PATCH 14/15] net: marvell: " Allen Pais
2024-06-21 20:19 ` Andrew Lunn
2024-06-21 18:39 ` [PATCH 15/15] net: mtk-wed: " Allen Pais
[not found] <20240621050525.3720069-1-allen.lkml@gmail.com>
2024-06-21 5:05 ` [PATCH 12/15] net: ibmvnic: " Allen Pais
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240621183947.4105278-13-allen.lkml@gmail.com \
--to=allen.lkml@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).