[dpdk-stable] patch 'net/ixgbe: fix link status inconsistencies' has been queued to stable release 19.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue May 19 15:02:34 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.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 05/21/20. 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.

Thanks.

Luca Boccassi

---
>From 4493efb719981e4053f526dcbbc2324e9054f01e Mon Sep 17 00:00:00 2001
From: Tao Zhu <taox.zhu at intel.com>
Date: Wed, 26 Feb 2020 20:06:37 +0800
Subject: [PATCH] net/ixgbe: fix link status inconsistencies

[ upstream commit efa8c72f1ecf7b02239a0627c482b7ba9af66f40 ]

Setting LINK UP or LINK DOWN is divided into two parts, with
the main task done in a separate thread, which can take up
to 9 seconds. If cancel the thread in execution, may cause state
inconsistencies. Therefore, must wait for the previous setting
to exit normally before setting the new state.

Note: before using threads, use alarm to handle main tasks.
When canceling alarm, the execution of alarm will not be interrupted.

Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events")

Signed-off-by: Tao Zhu <taox.zhu at intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye at intel.com>
Tested-by: Yu Jiang <yux.jiang at intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3f66b490ed..2cedd1a273 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4140,16 +4140,35 @@ out:
 	return ret_val;
 }
 
+/* return 1: setup complete, return 0: setup not complete, and wait timeout*/
+static int
+ixgbe_dev_wait_setup_link_complete(struct rte_eth_dev *dev)
+{
+#define DELAY_INTERVAL 100 /* 100ms */
+#define MAX_TIMEOUT    90 /* 9s (90 * 100ms) in total */
+	struct ixgbe_adapter *ad = dev->data->dev_private;
+	int timeout = MAX_TIMEOUT;
+
+	while (rte_atomic32_read(&ad->link_thread_running) && timeout) {
+		msec_delay(DELAY_INTERVAL);
+		timeout--;
+	}
+
+
+	return !!timeout;
+}
+
 static void
 ixgbe_dev_cancel_link_thread(struct rte_eth_dev *dev)
 {
 	struct ixgbe_adapter *ad = dev->data->dev_private;
 	void *retval;
 
-	if (rte_atomic32_read(&ad->link_thread_running)) {
+	if (!ixgbe_dev_wait_setup_link_complete(dev)) {
 		pthread_cancel(ad->link_thread_tid);
 		pthread_join(ad->link_thread_tid, &retval);
 		rte_atomic32_clear(&ad->link_thread_running);
+		PMD_DRV_LOG(ERR, "Link thread not complete, cancel it!");
 	}
 }
 
@@ -4259,7 +4278,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	if (link_up == 0) {
 		if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
 			intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
-			if (rte_atomic32_test_and_set(&ad->link_thread_running)) {
+			if (ixgbe_dev_wait_setup_link_complete(dev) &&
+			    rte_atomic32_test_and_set(&ad->link_thread_running)) {
 				if (rte_ctrl_thread_create(&ad->link_thread_tid,
 					"ixgbe-link-handler",
 					NULL,
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 14:04:45.379117229 +0100
+++ 0019-net-ixgbe-fix-link-status-inconsistencies.patch	2020-05-19 14:04:44.128646777 +0100
@@ -1,8 +1,10 @@
-From efa8c72f1ecf7b02239a0627c482b7ba9af66f40 Mon Sep 17 00:00:00 2001
+From 4493efb719981e4053f526dcbbc2324e9054f01e Mon Sep 17 00:00:00 2001
 From: Tao Zhu <taox.zhu at intel.com>
 Date: Wed, 26 Feb 2020 20:06:37 +0800
 Subject: [PATCH] net/ixgbe: fix link status inconsistencies
 
+[ upstream commit efa8c72f1ecf7b02239a0627c482b7ba9af66f40 ]
+
 Setting LINK UP or LINK DOWN is divided into two parts, with
 the main task done in a separate thread, which can take up
 to 9 seconds. If cancel the thread in execution, may cause state
@@ -13,7 +15,6 @@
 When canceling alarm, the execution of alarm will not be interrupted.
 
 Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events")
-Cc: stable at dpdk.org
 
 Signed-off-by: Tao Zhu <taox.zhu at intel.com>
 Acked-by: Xiaolong Ye <xiaolong.ye at intel.com>
@@ -23,10 +24,10 @@
  1 file changed, 22 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
-index 13f5ac2357..2a8543fd73 100644
+index 3f66b490ed..2cedd1a273 100644
 --- a/drivers/net/ixgbe/ixgbe_ethdev.c
 +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
-@@ -4143,16 +4143,35 @@ out:
+@@ -4140,16 +4140,35 @@ out:
  	return ret_val;
  }
  
@@ -63,7 +64,7 @@
  	}
  }
  
-@@ -4263,7 +4282,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
+@@ -4259,7 +4278,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
  	if (link_up == 0) {
  		if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
  			intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;


More information about the stable mailing list