patch 'net/hns3: refactor interrupt state query' has been queued to stable release 21.11.6
Kevin Traynor
ktraynor at redhat.com
Thu Nov 16 14:22:58 CET 2023
Hi,
FYI, your patch has been queued to stable release 21.11.6
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/21/23. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/df93e5cc12d3c5c4196632d3e3a790796e4fec6f
Thanks.
Kevin
---
>From df93e5cc12d3c5c4196632d3e3a790796e4fec6f Mon Sep 17 00:00:00 2001
From: Dengdui Huang <huangdengdui at huawei.com>
Date: Fri, 27 Oct 2023 14:09:46 +0800
Subject: [PATCH] net/hns3: refactor interrupt state query
[ upstream commit c01ffb24a241a360361ed5c94a819824a8542f3f ]
PF driver get all interrupt states by reading three registers. This logic
code block is distributed in many places. So this patch extracts a common
function to do this to improve the maintenance.
Fixes: f53a793bb7c2 ("net/hns3: add more hardware error types")
Fixes: 3988ab0eee52 ("net/hns3: add abnormal interrupt process")
Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
---
drivers/net/hns3/hns3_ethdev.c | 57 +++++++++++++++++++---------------
1 file changed, 32 insertions(+), 25 deletions(-)
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 90eec4a09b..352e7f277b 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -63,4 +63,10 @@ enum hns3_evt_cause {
};
+struct hns3_intr_state {
+ uint32_t vector0_state;
+ uint32_t cmdq_state;
+ uint32_t hw_err_state;
+};
+
#define HNS3_SPEEDS_SUPP_FEC (RTE_ETH_LINK_SPEED_10G | \
RTE_ETH_LINK_SPEED_25G | \
@@ -156,18 +162,21 @@ hns3_proc_global_reset_event(struct hns3_adapter *hns, uint32_t *vec_val)
}
+static void
+hns3_query_intr_state(struct hns3_hw *hw, struct hns3_intr_state *state)
+{
+ state->vector0_state = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG);
+ state->cmdq_state = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG);
+ state->hw_err_state = hns3_read_dev(hw, HNS3_RAS_PF_OTHER_INT_STS_REG);
+}
+
static enum hns3_evt_cause
hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
{
struct hns3_hw *hw = &hns->hw;
- uint32_t vector0_int_stats;
- uint32_t cmdq_src_val;
- uint32_t hw_err_src_reg;
+ struct hns3_intr_state state;
uint32_t val;
enum hns3_evt_cause ret;
- /* fetch the events from their corresponding regs */
- vector0_int_stats = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG);
- cmdq_src_val = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG);
- hw_err_src_reg = hns3_read_dev(hw, HNS3_RAS_PF_OTHER_INT_STS_REG);
+ hns3_query_intr_state(hw, &state);
/*
@@ -178,5 +187,5 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
* from H/W just for the mailbox.
*/
- if (BIT(HNS3_VECTOR0_IMPRESET_INT_B) & vector0_int_stats) { /* IMP */
+ if (BIT(HNS3_VECTOR0_IMPRESET_INT_B) & state.vector0_state) { /* IMP */
ret = hns3_proc_imp_reset_event(hns, &val);
goto out;
@@ -184,5 +193,5 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
/* Global reset */
- if (BIT(HNS3_VECTOR0_GLOBALRESET_INT_B) & vector0_int_stats) {
+ if (BIT(HNS3_VECTOR0_GLOBALRESET_INT_B) & state.vector0_state) {
ret = hns3_proc_global_reset_event(hns, &val);
goto out;
@@ -190,5 +199,5 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
/* Check for vector0 1588 event source */
- if (BIT(HNS3_VECTOR0_1588_INT_B) & vector0_int_stats) {
+ if (BIT(HNS3_VECTOR0_1588_INT_B) & state.vector0_state) {
val = BIT(HNS3_VECTOR0_1588_INT_B);
ret = HNS3_VECTOR0_EVENT_PTP;
@@ -197,7 +206,7 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
/* check for vector0 msix event source */
- if (vector0_int_stats & HNS3_VECTOR0_REG_MSIX_MASK ||
- hw_err_src_reg & HNS3_RAS_REG_NFE_MASK) {
- val = vector0_int_stats | hw_err_src_reg;
+ if (state.vector0_state & HNS3_VECTOR0_REG_MSIX_MASK ||
+ state.hw_err_state & HNS3_RAS_REG_NFE_MASK) {
+ val = state.vector0_state | state.hw_err_state;
ret = HNS3_VECTOR0_EVENT_ERR;
goto out;
@@ -205,12 +214,12 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
/* check for vector0 mailbox(=CMDQ RX) event source */
- if (BIT(HNS3_VECTOR0_RX_CMDQ_INT_B) & cmdq_src_val) {
- cmdq_src_val &= ~BIT(HNS3_VECTOR0_RX_CMDQ_INT_B);
- val = cmdq_src_val;
+ if (BIT(HNS3_VECTOR0_RX_CMDQ_INT_B) & state.cmdq_state) {
+ state.cmdq_state &= ~BIT(HNS3_VECTOR0_RX_CMDQ_INT_B);
+ val = state.cmdq_state;
ret = HNS3_VECTOR0_EVENT_MBX;
goto out;
}
- val = vector0_int_stats;
+ val = state.vector0_state;
ret = HNS3_VECTOR0_EVENT_OTHER;
@@ -299,8 +308,6 @@ hns3_interrupt_handler(void *param)
struct hns3_hw *hw = &hns->hw;
enum hns3_evt_cause event_cause;
+ struct hns3_intr_state state;
uint32_t clearval = 0;
- uint32_t vector0_int;
- uint32_t ras_int;
- uint32_t cmdq_int;
/* Disable interrupt */
@@ -308,7 +315,5 @@ hns3_interrupt_handler(void *param)
event_cause = hns3_check_event_cause(hns, &clearval);
- vector0_int = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG);
- ras_int = hns3_read_dev(hw, HNS3_RAS_PF_OTHER_INT_STS_REG);
- cmdq_int = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG);
+ hns3_query_intr_state(hw, &state);
hns3_delay_before_clear_event_cause(hw, event_cause, clearval);
hns3_clear_event_cause(hw, event_cause, clearval);
@@ -317,5 +322,6 @@ hns3_interrupt_handler(void *param)
hns3_warn(hw, "received interrupt: vector0_int_stat:0x%x "
"ras_int_stat:0x%x cmdq_int_stat:0x%x",
- vector0_int, ras_int, cmdq_int);
+ state.vector0_state, state.hw_err_state,
+ state.cmdq_state);
hns3_handle_mac_tnl(hw);
hns3_handle_error(hns);
@@ -328,5 +334,6 @@ hns3_interrupt_handler(void *param)
hns3_warn(hw, "received unknown event: vector0_int_stat:0x%x "
"ras_int_stat:0x%x cmdq_int_stat:0x%x",
- vector0_int, ras_int, cmdq_int);
+ state.vector0_state, state.hw_err_state,
+ state.cmdq_state);
}
--
2.41.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2023-11-16 13:21:52.959197011 +0000
+++ 0016-net-hns3-refactor-interrupt-state-query.patch 2023-11-16 13:21:52.431946320 +0000
@@ -1 +1 @@
-From c01ffb24a241a360361ed5c94a819824a8542f3f Mon Sep 17 00:00:00 2001
+From df93e5cc12d3c5c4196632d3e3a790796e4fec6f Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit c01ffb24a241a360361ed5c94a819824a8542f3f ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index bb9dde9c5b..0feea52542 100644
+index 90eec4a09b..352e7f277b 100644
@@ -23 +24 @@
-@@ -58,4 +58,10 @@ enum hns3_evt_cause {
+@@ -63,4 +63,10 @@ enum hns3_evt_cause {
@@ -34 +35 @@
-@@ -152,18 +158,21 @@ hns3_proc_global_reset_event(struct hns3_adapter *hns, uint32_t *vec_val)
+@@ -156,18 +162,21 @@ hns3_proc_global_reset_event(struct hns3_adapter *hns, uint32_t *vec_val)
@@ -63 +64 @@
-@@ -174,5 +183,5 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
+@@ -178,5 +187,5 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
@@ -70 +71 @@
-@@ -180,5 +189,5 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
+@@ -184,5 +193,5 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
@@ -77 +78 @@
-@@ -186,5 +195,5 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
+@@ -190,5 +199,5 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
@@ -84 +85 @@
-@@ -193,7 +202,7 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
+@@ -197,7 +206,7 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
@@ -95 +96 @@
-@@ -201,12 +210,12 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
+@@ -205,12 +214,12 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
@@ -112 +113 @@
-@@ -347,8 +356,6 @@ hns3_interrupt_handler(void *param)
+@@ -299,8 +308,6 @@ hns3_interrupt_handler(void *param)
@@ -121,2 +122,2 @@
- if (!hns3_reset_event_valid(hw))
-@@ -359,7 +366,5 @@ hns3_interrupt_handler(void *param)
+ /* Disable interrupt */
+@@ -308,7 +315,5 @@ hns3_interrupt_handler(void *param)
@@ -131 +132 @@
-@@ -368,5 +373,6 @@ hns3_interrupt_handler(void *param)
+@@ -317,5 +322,6 @@ hns3_interrupt_handler(void *param)
@@ -139 +140 @@
-@@ -379,5 +385,6 @@ hns3_interrupt_handler(void *param)
+@@ -328,5 +334,6 @@ hns3_interrupt_handler(void *param)
More information about the stable
mailing list