From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 94BF143345 for ; Thu, 16 Nov 2023 14:24:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E2D6402DD; Thu, 16 Nov 2023 14:24:24 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 6F364402C6 for ; Thu, 16 Nov 2023 14:24:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700141063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pv4fB577qYAMT1B2VCQ8Ar7Amoo/IvnYZNfjOYyOJV8=; b=RQ9YCNKewOSrx1+hjakZgKBCRFsagXFIEb8nz9URJtULWIx1UCAqkTQjtZ/ZV8JW2Pbcj+ dWN0806hFw0hxerBMJIsC5rVMt1bEKNfXaHcfzProKiwCroPMAg/6WG3+pbSHjS1D/xmaX onwghaiNi1ejubuOppHDDEuavKpQoes= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-362-qD8HEVWHNoCoelIqrFOQrA-1; Thu, 16 Nov 2023 08:24:20 -0500 X-MC-Unique: qD8HEVWHNoCoelIqrFOQrA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B7AFF82A662; Thu, 16 Nov 2023 13:24:19 +0000 (UTC) Received: from rh.Home (unknown [10.39.194.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22E3A2166B27; Thu, 16 Nov 2023 13:24:18 +0000 (UTC) From: Kevin Traynor To: Dengdui Huang Cc: dpdk stable Subject: patch 'net/hns3: refactor interrupt state query' has been queued to stable release 21.11.6 Date: Thu, 16 Nov 2023 13:22:58 +0000 Message-ID: <20231116132348.557257-16-ktraynor@redhat.com> In-Reply-To: <20231116132348.557257-1-ktraynor@redhat.com> References: <20231116132348.557257-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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 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 --- 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@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)