mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Allen Pais <allen.lkml@gmail.com>
To: kuba@kernel.org, Cai Huoqing <cai.huoqing@linux.dev>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>
Cc: jes@trained-monkey.org, kda@linux-powerpc.org,
	dougmill@linux.ibm.com, npiggin@gmail.com,
	christophe.leroy@csgroup.eu, aneesh.kumar@kernel.org,
	naveen.n.rao@linux.ibm.com, nnac123@linux.ibm.com,
	tlfalcon@linux.ibm.com, cooldavid@cooldavid.org,
	marcin.s.wojtas@gmail.com, mlindner@marvell.com,
	stephen@networkplumber.org, nbd@nbd.name, sean.wang@mediatek.com,
	Mark-MC.Lee@mediatek.com, lorenzo@kernel.org,
	matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
	borisp@nvidia.com, bryan.whitehead@microchip.com,
	UNGLinuxDriver@microchip.com, louis.peens@corigine.com,
	richardcochran@gmail.com, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-acenic@sunsite.dk,
	linux-net-drivers@amd.com, netdev@vger.kernel.org,
	Allen Pais <allen.lkml@gmail.com>
Subject: [net-next v3 10/15] net: hinic: Convert tasklet API to new bottom half workqueue mechanism
Date: Tue, 30 Jul 2024 11:33:58 -0700	[thread overview]
Message-ID: <20240730183403.4176544-11-allen.lkml@gmail.com> (raw)
In-Reply-To: <20240730183403.4176544-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 huawei hinic driver. This transition ensures
compatibility with the latest design and enhances performance.

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 .../net/ethernet/huawei/hinic/hinic_hw_cmdq.c  |  2 +-
 .../net/ethernet/huawei/hinic/hinic_hw_eqs.c   | 18 +++++++++---------
 .../net/ethernet/huawei/hinic/hinic_hw_eqs.h   |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
index d39eec9c62bf..f54feae40ef8 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
@@ -344,7 +344,7 @@ static int cmdq_sync_cmd_direct_resp(struct hinic_cmdq *cmdq,
 	struct hinic_hw_wqe *hw_wqe;
 	struct completion done;
 
-	/* Keep doorbell index correct. bh - for tasklet(ceq). */
+	/* Keep doorbell index correct. For bh_work(ceq). */
 	spin_lock_bh(&cmdq->cmdq_lock);
 
 	/* WQE_SIZE = WQEBB_SIZE, we will get the wq element and not shadow*/
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c
index 045c47786a04..1aecc934039e 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c
@@ -368,12 +368,12 @@ static void eq_irq_work(struct work_struct *work)
 }
 
 /**
- * ceq_tasklet - the tasklet of the EQ that received the event
- * @t: the tasklet struct pointer
+ * ceq_bh_work - the bh_work of the EQ that received the event
+ * @work: the work struct pointer
  **/
-static void ceq_tasklet(struct tasklet_struct *t)
+static void ceq_bh_work(struct work_struct *work)
 {
-	struct hinic_eq *ceq = from_tasklet(ceq, t, ceq_tasklet);
+	struct hinic_eq *ceq = from_work(ceq, work, ceq_bh_work);
 
 	eq_irq_handler(ceq);
 }
@@ -413,7 +413,7 @@ static irqreturn_t ceq_interrupt(int irq, void *data)
 	/* clear resend timer cnt register */
 	hinic_msix_attr_cnt_clear(ceq->hwif, ceq->msix_entry.entry);
 
-	tasklet_schedule(&ceq->ceq_tasklet);
+	queue_work(system_bh_wq, &ceq->ceq_bh_work);
 
 	return IRQ_HANDLED;
 }
@@ -782,7 +782,7 @@ static int init_eq(struct hinic_eq *eq, struct hinic_hwif *hwif,
 
 		INIT_WORK(&aeq_work->work, eq_irq_work);
 	} else if (type == HINIC_CEQ) {
-		tasklet_setup(&eq->ceq_tasklet, ceq_tasklet);
+		INIT_WORK(&eq->ceq_bh_work, ceq_bh_work);
 	}
 
 	/* set the attributes of the msix entry */
@@ -833,7 +833,7 @@ static void remove_eq(struct hinic_eq *eq)
 		hinic_hwif_write_reg(eq->hwif,
 				     HINIC_CSR_AEQ_CTRL_1_ADDR(eq->q_id), 0);
 	} else if (eq->type == HINIC_CEQ) {
-		tasklet_kill(&eq->ceq_tasklet);
+		cancel_work_sync(&eq->ceq_bh_work);
 		/* clear ceq_len to avoid hw access host memory */
 		hinic_hwif_write_reg(eq->hwif,
 				     HINIC_CSR_CEQ_CTRL_1_ADDR(eq->q_id), 0);
@@ -968,9 +968,9 @@ void hinic_dump_ceq_info(struct hinic_hwdev *hwdev)
 		ci = hinic_hwif_read_reg(hwdev->hwif, addr);
 		addr = EQ_PROD_IDX_REG_ADDR(eq);
 		pi = hinic_hwif_read_reg(hwdev->hwif, addr);
-		dev_err(&hwdev->hwif->pdev->dev, "Ceq id: %d, ci: 0x%08x, sw_ci: 0x%08x, pi: 0x%x, tasklet_state: 0x%lx, wrap: %d, ceqe: 0x%x\n",
+		dev_err(&hwdev->hwif->pdev->dev, "Ceq id: %d, ci: 0x%08x, sw_ci: 0x%08x, pi: 0x%x, work_pending: %d, wrap: %d, ceqe: 0x%x\n",
 			q_id, ci, eq->cons_idx, pi,
-			eq->ceq_tasklet.state,
+			work_pending(&eq->ceq_bh_work),
 			eq->wrapped, be32_to_cpu(*(__be32 *)(GET_CURR_CEQ_ELEM(eq))));
 	}
 }
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.h b/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.h
index 2f3222174fc7..8fed3155f15c 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.h
+++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.h
@@ -193,7 +193,7 @@ struct hinic_eq {
 
 	struct hinic_eq_work    aeq_work;
 
-	struct tasklet_struct   ceq_tasklet;
+	struct work_struct	ceq_bh_work;
 };
 
 struct hinic_hw_event_cb {
-- 
2.34.1


  parent reply	other threads:[~2024-07-30 18:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30 18:33 [net-next v3 00/15] ethernet: Convert from tasklet to BH workqueue Allen Pais
2024-07-30 18:33 ` [net-next v3 01/15] net: alteon: Convert tasklet API to new bottom half workqueue mechanism Allen Pais
2024-07-30 18:33 ` [net-next v3 02/15] net: xgbe: " Allen Pais
2024-07-30 18:33 ` [net-next v3 03/15] net: cnic: " Allen Pais
2024-07-30 18:33 ` [net-next v3 04/15] net: macb: " Allen Pais
2024-07-30 18:33 ` [net-next v3 05/15] net: cavium/liquidio: " Allen Pais
2024-08-01  2:08   ` Jakub Kicinski
2024-08-01 22:00     ` Allen
2024-08-02  0:57       ` Jakub Kicinski
2024-08-05 17:23         ` Allen
2024-08-05 19:39           ` Jakub Kicinski
2024-08-07  3:15             ` Allen
2024-08-07 14:37               ` Jakub Kicinski
2024-08-09  2:31                 ` Allen
2024-08-10  3:36                   ` Jakub Kicinski
2024-08-15 16:45                     ` Allen
2024-08-15 23:49                       ` Jakub Kicinski
2024-08-17 16:27                         ` Allen
2024-07-30 18:33 ` [net-next v3 06/15] net: octeon: " Allen Pais
2024-07-30 18:33 ` [net-next v3 07/15] net: thunderx: " Allen Pais
2024-07-30 18:33 ` [net-next v3 08/15] net: chelsio: " Allen Pais
2024-07-30 18:33 ` [net-next v3 09/15] net: sundance: " Allen Pais
2024-07-30 18:33 ` Allen Pais [this message]
2024-07-30 18:33 ` [net-next v3 11/15] net: ehea: " Allen Pais
2024-07-30 18:34 ` [net-next v3 12/15] net: ibmvnic: " Allen Pais
2024-07-30 18:34 ` [net-next v3 13/15] net: jme: " Allen Pais
2024-07-30 18:34 ` [net-next v3 14/15] net: marvell: " Allen Pais
2024-07-30 20:39   ` Andrew Lunn
2024-07-30 22:22     ` Russell King (Oracle)
2024-07-31 20:46       ` Allen
2024-07-31 20:41     ` Allen
2024-07-30 18:34 ` [net-next v3 15/15] net: mtk-wed: " 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=20240730183403.4176544-11-allen.lkml@gmail.com \
    --to=allen.lkml@gmail.com \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=borisp@nvidia.com \
    --cc=bryan.whitehead@microchip.com \
    --cc=cai.huoqing@linux.dev \
    --cc=christophe.leroy@csgroup.eu \
    --cc=cooldavid@cooldavid.org \
    --cc=davem@davemloft.net \
    --cc=dougmill@linux.ibm.com \
    --cc=edumazet@google.com \
    --cc=jes@trained-monkey.org \
    --cc=kda@linux-powerpc.org \
    --cc=kuba@kernel.org \
    --cc=linux-acenic@sunsite.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net-drivers@amd.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=louis.peens@corigine.com \
    --cc=marcin.s.wojtas@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mlindner@marvell.com \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=nnac123@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=sean.wang@mediatek.com \
    --cc=stephen@networkplumber.org \
    --cc=tlfalcon@linux.ibm.com \
    /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

all inboxes | Powered by JetHome®