From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D4068A0C4C
	for <public@inbox.dpdk.org>; Mon, 12 Jul 2021 15:13:23 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id CC95D40685;
	Mon, 12 Jul 2021 15:13:23 +0200 (CEST)
Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com
 [209.85.221.53]) by mails.dpdk.org (Postfix) with ESMTP id 85AFB40685
 for <stable@dpdk.org>; Mon, 12 Jul 2021 15:13:22 +0200 (CEST)
Received: by mail-wr1-f53.google.com with SMTP id t5so11701125wrw.12
 for <stable@dpdk.org>; Mon, 12 Jul 2021 06:13:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=KJSAmxKw+CTjk3BS16EWjkCrQumiRLRlncfaWwY+7zY=;
 b=JObe4px/ACA17SgyaHcxcJgHCkeCICYKWJaSKbTng3neMG1pjxPU86hI0MAiJROPjM
 R7x+9Pe0WbLsTFFsyxYrVQi5Ebkycz8bmfaYvka3GQs/ZHpbGpoU4xNmizyqQSfYWW7H
 nFce99S+51ygCj4FdNpBiAlDuzkB86OoelcWzXtcm8OpyuivYNKIh6AMbxI5Z+eWLeBA
 rFFvcJ/2IrMf9w3ix4PwkMEn7U0kPATHd/1GdJahkJBh3w6vCIcFe+fJcupwSkSYOY88
 Lgz2lC1yccutSo+YOiAbsnsCHBBGZB0vAV/W9TL1aJjh/vr7dfEgEYEnfsJqdSCEzxk6
 DxSA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=KJSAmxKw+CTjk3BS16EWjkCrQumiRLRlncfaWwY+7zY=;
 b=P70l84kMVl2UY19pGCbqjBZ5AcWWhpvSQxICe/De/d51RLsMoBzbRls5XdYG/Nd/QV
 mBFwF42fnyXnbGcqiDd73N7ieoPtOovVy9Z3s9una1ACU7kZCaSwiDnf2gluzls3w2cH
 jHkXegXu6pyCxGV7wDuu1vnEefDbfABc2ZedzVJcfgZDMp4AueV4RVIMnIfufOXMOXdi
 zRBKObFwmIyvzHH9p4IgXXcQAZW71SXY+Hfd/EYQM7mAw4K83yZgShM+owjQpT6Hp4HT
 8PYqRyzniCoRnhY3oZfkkYR5CD+cG7XvgNb9WdVzlHCSyTnIVSGcnNoYQYVan91eDjYO
 679A==
X-Gm-Message-State: AOAM531soC4M8hYN1L9Qz4RjfRGx/atLhEwBTwnqWgfYSgf0VTJlAvoI
 WdoFRnX20lZ3KwiL97wgFR4=
X-Google-Smtp-Source: ABdhPJyg7t3nhx9nXBw9Z9fd0CLqGsyvjnf5JcZ0EHCt1pordOwgAn7OsQqymEn6ybZCEhb12UNkdg==
X-Received: by 2002:a5d:47a7:: with SMTP id 7mr27533188wrb.150.1626095602303; 
 Mon, 12 Jul 2021 06:13:22 -0700 (PDT)
Received: from localhost ([137.220.125.106])
 by smtp.gmail.com with ESMTPSA id y13sm14261255wrp.80.2021.07.12.06.13.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 12 Jul 2021 06:13:21 -0700 (PDT)
From: luca.boccassi@gmail.com
To: Huisong Li <lihuisong@huawei.com>
Cc: Min Hu <humin29@huawei.com>,
	dpdk stable <stable@dpdk.org>
Date: Mon, 12 Jul 2021 14:04:56 +0100
Message-Id: <20210712130551.2462159-61-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com>
References: <20210712130551.2462159-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'net/hns3: fix delay for waiting to stop Rx/Tx'
 has been queued to stable release 20.11.3
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi,

FYI, your patch has been queued to stable release 20.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/14/21. 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/badc3ae38ad45a79552d9f8dc97ec48ac414e5f8

Thanks.

Luca Boccassi

---
>From badc3ae38ad45a79552d9f8dc97ec48ac414e5f8 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Sun, 13 Jun 2021 10:31:52 +0800
Subject: [PATCH] net/hns3: fix delay for waiting to stop Rx/Tx

[ upstream commit 4d8cce267840556cec8483c61f8cfbf25873496d ]

When the primary process executes dev_stop or is being reset, the packet
sending and receiving functions is changed. In this moment, the primary
process requests secondary processes to change their Rx/Tx functions, and
delays a period of time in case of crashes when queues are still in use.
The delay time depends on the number of queues actually used, instead of
the maximum number of queues supported by the device.

Fixes: 23d4b61fee5d ("net/hns3: support multiple process")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 4 ++--
 drivers/net/hns3/hns3_ethdev_vf.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 637e6134f9..249ab31040 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -5169,7 +5169,7 @@ hns3_dev_stop(struct rte_eth_dev *dev)
 	/* Disable datapath on secondary process. */
 	hns3_mp_req_stop_rxtx(dev);
 	/* Prevent crashes when queues are still in use. */
-	rte_delay_ms(hw->tqps_num);
+	rte_delay_ms(hw->cfg_max_queues);
 
 	rte_spinlock_lock(&hw->lock);
 	if (rte_atomic16_read(&hw->reset.resetting) == 0) {
@@ -5657,7 +5657,7 @@ hns3_stop_service(struct hns3_adapter *hns)
 	rte_wmb();
 	/* Disable datapath on secondary process. */
 	hns3_mp_req_stop_rxtx(eth_dev);
-	rte_delay_ms(hw->tqps_num);
+	rte_delay_ms(hw->cfg_max_queues);
 
 	rte_spinlock_lock(&hw->lock);
 	if (hns->hw.adapter_state == HNS3_NIC_STARTED ||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index ed9dd9b3c3..5a9550d853 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1968,7 +1968,7 @@ hns3vf_dev_stop(struct rte_eth_dev *dev)
 	/* Disable datapath on secondary process. */
 	hns3_mp_req_stop_rxtx(dev);
 	/* Prevent crashes when queues are still in use. */
-	rte_delay_ms(hw->tqps_num);
+	rte_delay_ms(hw->cfg_max_queues);
 
 	rte_spinlock_lock(&hw->lock);
 	if (rte_atomic16_read(&hw->reset.resetting) == 0) {
@@ -2411,7 +2411,7 @@ hns3vf_stop_service(struct hns3_adapter *hns)
 	rte_wmb();
 	/* Disable datapath on secondary process. */
 	hns3_mp_req_stop_rxtx(eth_dev);
-	rte_delay_ms(hw->tqps_num);
+	rte_delay_ms(hw->cfg_max_queues);
 
 	rte_spinlock_lock(&hw->lock);
 	if (hw->adapter_state == HNS3_NIC_STARTED ||
-- 
2.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-07-12 13:41:39.833329750 +0100
+++ 0061-net-hns3-fix-delay-for-waiting-to-stop-Rx-Tx.patch	2021-07-12 13:41:36.510123027 +0100
@@ -1 +1 @@
-From 4d8cce267840556cec8483c61f8cfbf25873496d Mon Sep 17 00:00:00 2001
+From badc3ae38ad45a79552d9f8dc97ec48ac414e5f8 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 4d8cce267840556cec8483c61f8cfbf25873496d ]
+
@@ -14 +15,0 @@
-Cc: stable@dpdk.org
@@ -24 +25 @@
-index 20491305e7..dff265828e 100644
+index 637e6134f9..249ab31040 100644
@@ -27 +28 @@
-@@ -5895,7 +5895,7 @@ hns3_dev_stop(struct rte_eth_dev *dev)
+@@ -5169,7 +5169,7 @@ hns3_dev_stop(struct rte_eth_dev *dev)
@@ -35,2 +36,2 @@
- 	if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) {
-@@ -6511,7 +6511,7 @@ hns3_stop_service(struct hns3_adapter *hns)
+ 	if (rte_atomic16_read(&hw->reset.resetting) == 0) {
+@@ -5657,7 +5657,7 @@ hns3_stop_service(struct hns3_adapter *hns)
@@ -46 +47 @@
-index 41dd8ee129..7a5c162964 100644
+index ed9dd9b3c3..5a9550d853 100644
@@ -49 +50 @@
-@@ -2107,7 +2107,7 @@ hns3vf_dev_stop(struct rte_eth_dev *dev)
+@@ -1968,7 +1968,7 @@ hns3vf_dev_stop(struct rte_eth_dev *dev)
@@ -57,2 +58,2 @@
- 	if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) {
-@@ -2558,7 +2558,7 @@ hns3vf_stop_service(struct hns3_adapter *hns)
+ 	if (rte_atomic16_read(&hw->reset.resetting) == 0) {
+@@ -2411,7 +2411,7 @@ hns3vf_stop_service(struct hns3_adapter *hns)