[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240621050525.3720069-11-allen.lkml@gmail.com>
Date: Thu, 20 Jun 2024 22:05:20 -0700
From: Allen Pais <allen.lkml@...il.com>
To: kuba@...nel.org,
Cai Huoqing <cai.huoqing@...ux.dev>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>
Cc: jes@...ined-monkey.org,
kda@...ux-powerpc.org,
dougmill@...ux.ibm.com,
npiggin@...il.com,
christophe.leroy@...roup.eu,
aneesh.kumar@...nel.org,
naveen.n.rao@...ux.ibm.com,
nnac123@...ux.ibm.com,
tlfalcon@...ux.ibm.com,
cooldavid@...ldavid.org,
marcin.s.wojtas@...il.com,
mlindner@...vell.com,
stephen@...workplumber.org,
nbd@....name,
sean.wang@...iatek.com,
Mark-MC.Lee@...iatek.com,
lorenzo@...nel.org,
matthias.bgg@...il.com,
angelogioacchino.delregno@...labora.com,
borisp@...dia.com,
bryan.whitehead@...rochip.com,
UNGLinuxDriver@...rochip.com,
louis.peens@...igine.com,
richardcochran@...il.com,
linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-acenic@...site.dk,
linux-net-drivers@....com,
Allen Pais <allen.lkml@...il.com>,
netdev@...r.kernel.org
Subject: [PATCH 10/15] net: hinic: 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 huawei hinic driver. This transition ensures
compatibility with the latest design and enhances performance.
Signed-off-by: Allen Pais <allen.lkml@...il.com>
---
.../net/ethernet/huawei/hinic/hinic_hw_cmdq.c | 2 +-
.../net/ethernet/huawei/hinic/hinic_hw_eqs.c | 17 ++++++++---------
.../net/ethernet/huawei/hinic/hinic_hw_eqs.h | 2 +-
3 files changed, 10 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..381ced8f3c93 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,8 @@ 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, wrap: %d, ceqe: 0x%x\n",
q_id, ci, eq->cons_idx, pi,
- eq->ceq_tasklet.state,
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
Powered by blists - more mailing lists