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 AFA4843829 for ; Tue, 5 Mar 2024 16:35:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB20742E24; Tue, 5 Mar 2024 16:35:58 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id C61B242E23 for ; Tue, 5 Mar 2024 16:35:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709652957; 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=gn7+0O3Mpc5Ei391C4gcQm2VsyUkwGhkVaFeK7CCnVQ=; b=aD+dGiNPeVYNoh8qdgtpf5ypBoCTs/9sz2kMYemhZfTRPmK9X5krN++b2YENuVYN+VPH1i UNXUGkMUJd05Uy+GdQru/2ckJ+XvP7wW8greBJkD9lsv8k4RollAaeMTJDQt7L34B2kyy9 2AOOVcmJXWZ0re080mk02/4GlwzpJiE= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-ttXQwpDLOzepnpwB_4i-5Q-1; Tue, 05 Mar 2024 10:35:54 -0500 X-MC-Unique: ttXQwpDLOzepnpwB_4i-5Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 AD2903801FEF; Tue, 5 Mar 2024 15:35:53 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id D252F200AE7F; Tue, 5 Mar 2024 15:35:52 +0000 (UTC) From: Kevin Traynor To: Dengdui Huang Cc: Jie Hai , dpdk stable Subject: patch 'net/hns3: fix VF multiple count on one reset' has been queued to stable release 21.11.7 Date: Tue, 5 Mar 2024 15:34:16 +0000 Message-ID: <20240305153449.263666-43-ktraynor@redhat.com> In-Reply-To: <20240305153449.263666-1-ktraynor@redhat.com> References: <20240305153449.263666-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 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.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/11/24. 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/72126b1d1cefd4bb79dc989f6186cc71aec39488 Thanks. Kevin --- >From 72126b1d1cefd4bb79dc989f6186cc71aec39488 Mon Sep 17 00:00:00 2001 From: Dengdui Huang Date: Fri, 8 Dec 2023 15:44:14 +0800 Subject: [PATCH] net/hns3: fix VF multiple count on one reset [ upstream commit 072a07a9dcbd604b1983bf2cb266d3dd4dc89824 ] There are two ways for the hns3 VF driver to know reset event, namely, interrupt task and periodic detection task. For the latter, the real reset process will delay several microseconds to execute. Both tasks cause the count to increase by 1. However, the periodic detection task also detects a reset event A after interrupt task receive a reset event A. As a result, the reset count will be double. So this patch adds the comparison of reset level for VF in case of the multiple reset count. Fixes: a5475d61fa34 ("net/hns3: support VF") Signed-off-by: Dengdui Huang Signed-off-by: Jie Hai --- drivers/net/hns3/hns3_ethdev_vf.c | 44 ++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 639a00615e..deef914649 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -643,11 +643,6 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) hns3_write_dev(hw, HNS3_VF_RST_ING, val | HNS3_VF_RST_ING_BIT); val = cmdq_stat_reg & ~BIT(HNS3_VECTOR0_RST_INT_B); - if (clearval) { - hw->reset.stats.global_cnt++; - hns3_warn(hw, "Global reset detected, clear reset status"); - } else { - hns3_schedule_delayed_reset(hns); - hns3_warn(hw, "Global reset detected, don't clear reset status"); - } + hw->reset.stats.global_cnt++; + hns3_warn(hw, "Global reset detected, clear reset status"); ret = HNS3VF_VECTOR0_EVENT_RST; @@ -664,7 +659,7 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) val = 0; ret = HNS3VF_VECTOR0_EVENT_OTHER; + out: - if (clearval) - *clearval = val; + *clearval = val; return ret; } @@ -1821,9 +1816,23 @@ is_vf_reset_done(struct hns3_hw *hw) } +static enum hns3_reset_level +hns3vf_detect_reset_event(struct hns3_hw *hw) +{ + enum hns3_reset_level reset = HNS3_NONE_RESET; + uint32_t cmdq_stat_reg; + + cmdq_stat_reg = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_STAT_REG); + if (BIT(HNS3_VECTOR0_RST_INT_B) & cmdq_stat_reg) + reset = HNS3_VF_RESET; + + return reset; +} + bool hns3vf_is_reset_pending(struct hns3_adapter *hns) { + enum hns3_reset_level last_req; struct hns3_hw *hw = &hns->hw; - enum hns3_reset_level reset; + enum hns3_reset_level new_req; /* @@ -1848,11 +1857,16 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) return false; - hns3vf_check_event_cause(hns, NULL); - reset = hns3vf_get_reset_level(hw, &hw->reset.pending); - if (hw->reset.level != HNS3_NONE_RESET && reset != HNS3_NONE_RESET && - hw->reset.level < reset) { - hns3_warn(hw, "High level reset %d is pending", reset); + new_req = hns3vf_detect_reset_event(hw); + if (new_req == HNS3_NONE_RESET) + return false; + + last_req = hns3vf_get_reset_level(hw, &hw->reset.pending); + if (last_req == HNS3_NONE_RESET || last_req < new_req) { + __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); + hns3_schedule_delayed_reset(hns); + hns3_warn(hw, "High level reset detected, delay do reset"); return true; } + return false; } -- 2.43.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 14:08:55.681563979 +0000 +++ 0043-net-hns3-fix-VF-multiple-count-on-one-reset.patch 2024-03-05 14:08:54.662520797 +0000 @@ -1 +1 @@ -From 072a07a9dcbd604b1983bf2cb266d3dd4dc89824 Mon Sep 17 00:00:00 2001 +From 72126b1d1cefd4bb79dc989f6186cc71aec39488 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 072a07a9dcbd604b1983bf2cb266d3dd4dc89824 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index f5a7a2b1f4..83d3d66005 100644 +index 639a00615e..deef914649 100644 @@ -31 +32 @@ -@@ -570,11 +570,6 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) +@@ -643,11 +643,6 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) @@ -45 +46 @@ -@@ -591,7 +586,7 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) +@@ -664,7 +659,7 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) @@ -55 +56 @@ -@@ -1732,9 +1727,23 @@ is_vf_reset_done(struct hns3_hw *hw) +@@ -1821,9 +1816,23 @@ is_vf_reset_done(struct hns3_hw *hw) @@ -80 +81 @@ -@@ -1759,11 +1768,16 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) +@@ -1848,11 +1857,16 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns)