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 DE3EC43C60 for ; Thu, 7 Mar 2024 02:35:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D348D42EF7; Thu, 7 Mar 2024 02:35:54 +0100 (CET) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mails.dpdk.org (Postfix) with ESMTP id 8920142EE6 for ; Thu, 7 Mar 2024 02:35:53 +0100 (CET) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-412e96284b9so3266235e9.3 for ; Wed, 06 Mar 2024 17:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709775353; x=1710380153; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pya9CB3sNQed63CecPkgxSZ4+Qra6t5Rc9c9o0LZr9k=; b=jf7yLcu1AA6naDWARdok75/dPtFO85xVltQUZarY+FucpTVNbsiDmDbA+1W+6GnEBq 52DnswAfkpA1L2USUT8PGrQT9EeY+hEEBjOjHftU8EyDVaX5ye7T8Lfx8EPoaFNxbPhD RxWTZF/7wo1AvWq7Gtd8cft804Qr6Se4cmFV8XlvtqMmc1Ddo21jT2Zo40dfY91oCoJW xGFVPrvbCXx0Dxn/4vnFI54NLW5lKz+nD13ssf1TonrDY88A2Rpet0Oo/IlKAtYOMJmb dUYVv9t/AgnqRgIurn5B861swwT8JFEwYCY3S5WTHXjOGS7fwC05QmzcHWyhrquzJFPY LK2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709775353; x=1710380153; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pya9CB3sNQed63CecPkgxSZ4+Qra6t5Rc9c9o0LZr9k=; b=m9NBM7mPof/G83ITD7YlV6NRQhJAW6pSt5BjwyJRUXK5eKh2nFq9dzKIK01VyntttU MBroSVtzbeT+H5GBBXxOXaxI5sbG0JEJ7ni4UXJn4mcIY83AegarFJ60+0+jL0P757FJ e7mt6vR8kwmH5IWU2Vy8/rE3lw8wc31GVkqLP8c2rFq8X1NebAWOGjKH3wyNvZnM5aox zAu/lwGeTGm2G1eYHAs5pmDfLoAKcdLgxo+yrrpa3kTtmxmEvgE+b9fYNvCmr3g2Duo/ xjri86wTTc4asTn0mghBFV/mEWJaZe6LwyxkHPBFqlFQZzpEO84Q1r6T1gugWn4P4GbW 0Ahw== X-Forwarded-Encrypted: i=1; AJvYcCUxKa7HFGqXVA0RsRasXxAeiSC2pgdlMK5YMDa/5fIZwmucixfQsiXdot+j6q1yVBaCIcgdGDkYuIJe1Q2zq4I= X-Gm-Message-State: AOJu0Yxe5wP7sjjC4pb3+Qrg3h9pGuONya6K8HT2nd3yzSWqEmISllBZ ai0emuMrEOZ7KgYuKAxmu1Ziodu7AUIdwWwuFQ6yxN30vtpoDgBdieKMJvVeznU= X-Google-Smtp-Source: AGHT+IGk3oU4CNZCQClNBSqKOq0924bGWO9A82Ho/FP4BcaI8wTPbr119xjZ5054JyN8HRkzkLOjRA== X-Received: by 2002:a05:600c:34d0:b0:412:ef4b:cd5a with SMTP id d16-20020a05600c34d000b00412ef4bcd5amr4280070wmq.9.1709775353162; Wed, 06 Mar 2024 17:35:53 -0800 (PST) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id l11-20020a05600c1d0b00b00412fc25691bsm864321wms.38.2024.03.06.17.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 17:35:52 -0800 (PST) From: luca.boccassi@gmail.com 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 22.11.5 Date: Thu, 7 Mar 2024 01:31:22 +0000 Message-Id: <20240307013159.1735343-65-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240307013159.1735343-1-luca.boccassi@gmail.com> References: <20240307013159.1735343-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22.11.5 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/09/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/cfeb27992c31cb8048cd1247162d452a04765d15 Thanks. Luca Boccassi --- >From cfeb27992c31cb8048cd1247162d452a04765d15 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 27b890b37f..9e5d69f485 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -650,13 +650,8 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) val = hns3_read_dev(hw, HNS3_VF_RST_ING); 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; goto out; @@ -671,9 +666,9 @@ 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; } @@ -1812,11 +1807,25 @@ is_vf_reset_done(struct hns3_hw *hw) return true; } +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; /* * According to the protocol of PCIe, FLR to a PF device resets the PF @@ -1839,13 +1848,18 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) if (rte_eal_process_type() != RTE_PROC_PRIMARY) 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.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-07 01:05:40.379603113 +0000 +++ 0065-net-hns3-fix-VF-multiple-count-on-one-reset.patch 2024-03-07 01:05:34.858941290 +0000 @@ -1 +1 @@ -From 072a07a9dcbd604b1983bf2cb266d3dd4dc89824 Mon Sep 17 00:00:00 2001 +From cfeb27992c31cb8048cd1247162d452a04765d15 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 27b890b37f..9e5d69f485 100644 @@ -31 +32 @@ -@@ -569,13 +569,8 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) +@@ -650,13 +650,8 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) @@ -47 +48 @@ -@@ -590,9 +585,9 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) +@@ -671,9 +666,9 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) @@ -59 +60 @@ -@@ -1731,11 +1726,25 @@ is_vf_reset_done(struct hns3_hw *hw) +@@ -1812,11 +1807,25 @@ is_vf_reset_done(struct hns3_hw *hw) @@ -86 +87 @@ -@@ -1758,13 +1767,18 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) +@@ -1839,13 +1848,18 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns)