[dpdk-stable] patch 'net/ixgbe: fix busy polling while fiber link update' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Fri Nov 23 11:26:41 CET 2018


Hi,

FYI, your patch has been queued to stable release 18.08.1

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/29/18. 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. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From dd7b21ed335e5334d5188b5438b61c6aeaa29e45 Mon Sep 17 00:00:00 2001
From: Ilya Maximets <i.maximets at samsung.com>
Date: Thu, 1 Nov 2018 19:04:59 +0300
Subject: [PATCH] net/ixgbe: fix busy polling while fiber link update

[ upstream commit 0408f47ba4d67f0cb96f5e907bc9336b6cbff0dd ]

If the multispeed fiber link is in DOWN state, ixgbe_setup_link
could take around a second of busy polling. This is highly
inconvenient for the case where single thread periodically
checks the link statuses. For example, OVS main thread
periodically updates the link statuses and hangs for a really
long time busy waiting on ixgbe_setup_link() for a DOWN fiber
ports. For case with 3 down ports it hangs for a 3 seconds and
unable to do anything including packet processing.
Fix that by shifting that workaround to a separate thread by
alarm handler that will try to set up link if it is DOWN.

Fixes: c12d22f65b13 ("net/ixgbe: ensure link status is updated")

Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
Reviewed-by: Qi Zhang <qi.z.zhang at intel.com>
Reviewed-by: Wei Zhao <wei.zhao1 at intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 43 ++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index eab9e2e7e..0293022b2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -222,4 +222,6 @@ static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
 static void ixgbe_dev_interrupt_handler(void *param);
 static void ixgbe_dev_interrupt_delayed_handler(void *param);
+static void ixgbe_dev_setup_link_alarm_handler(void *param);
+
 static int ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
 			 uint32_t index, uint32_t pool);
@@ -2797,4 +2799,6 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
+	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);
+
 	/* disable interrupts */
 	ixgbe_disable_intr(hw);
@@ -3975,4 +3979,23 @@ out:
 }
 
+static void
+ixgbe_dev_setup_link_alarm_handler(void *param)
+{
+	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct ixgbe_interrupt *intr =
+		IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
+	u32 speed;
+	bool autoneg = false;
+
+	speed = hw->phy.autoneg_advertised;
+	if (!speed)
+		ixgbe_get_link_capabilities(hw, &speed, &autoneg);
+
+	ixgbe_setup_link(hw, speed, true);
+
+	intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
+}
+
 /* return 0 means link status changed, -1 means not changed */
 int
@@ -3987,7 +4010,5 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	int link_up;
 	int diag;
-	u32 speed = 0;
 	int wait = 1;
-	bool autoneg = false;
 
 	memset(&link, 0, sizeof(link));
@@ -3999,11 +4020,6 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	hw->mac.get_link_status = true;
 
-	if ((intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) &&
-		ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
-		speed = hw->phy.autoneg_advertised;
-		if (!speed)
-			ixgbe_get_link_capabilities(hw, &speed, &autoneg);
-		ixgbe_setup_link(hw, speed, true);
-	}
+	if (intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG)
+		return rte_eth_linkstatus_set(dev, &link);
 
 	/* check if it needs to wait to complete, if lsc interrupt is enabled */
@@ -4023,9 +4039,12 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 
 	if (link_up == 0) {
-		intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
+		if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
+			intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
+			rte_eal_alarm_set(10,
+				ixgbe_dev_setup_link_alarm_handler, dev);
+		}
 		return rte_eth_linkstatus_set(dev, &link);
 	}
 
-	intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
 	link.link_status = ETH_LINK_UP;
 	link.link_duplex = ETH_LINK_FULL_DUPLEX;
@@ -5134,4 +5153,6 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
+	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);
+
 	ixgbevf_intr_disable(dev);
 
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-23 10:22:55.220436825 +0000
+++ 0037-net-ixgbe-fix-busy-polling-while-fiber-link-update.patch	2018-11-23 10:22:54.000000000 +0000
@@ -1,8 +1,10 @@
-From 0408f47ba4d67f0cb96f5e907bc9336b6cbff0dd Mon Sep 17 00:00:00 2001
+From dd7b21ed335e5334d5188b5438b61c6aeaa29e45 Mon Sep 17 00:00:00 2001
 From: Ilya Maximets <i.maximets at samsung.com>
 Date: Thu, 1 Nov 2018 19:04:59 +0300
 Subject: [PATCH] net/ixgbe: fix busy polling while fiber link update
 
+[ upstream commit 0408f47ba4d67f0cb96f5e907bc9336b6cbff0dd ]
+
 If the multispeed fiber link is in DOWN state, ixgbe_setup_link
 could take around a second of busy polling. This is highly
 inconvenient for the case where single thread periodically
@@ -15,7 +17,6 @@
 alarm handler that will try to set up link if it is DOWN.
 
 Fixes: c12d22f65b13 ("net/ixgbe: ensure link status is updated")
-Cc: stable at dpdk.org
 
 Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
 Reviewed-by: Qi Zhang <qi.z.zhang at intel.com>
@@ -25,24 +26,24 @@
  1 file changed, 32 insertions(+), 11 deletions(-)
 
 diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
-index 5a2c35143..c9e82d515 100644
+index eab9e2e7e..0293022b2 100644
 --- a/drivers/net/ixgbe/ixgbe_ethdev.c
 +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
-@@ -221,4 +221,6 @@ static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev);
+@@ -222,4 +222,6 @@ static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
  static void ixgbe_dev_interrupt_handler(void *param);
  static void ixgbe_dev_interrupt_delayed_handler(void *param);
 +static void ixgbe_dev_setup_link_alarm_handler(void *param);
 +
  static int ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
  			 uint32_t index, uint32_t pool);
-@@ -2794,4 +2796,6 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
+@@ -2797,4 +2799,6 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
  	PMD_INIT_FUNC_TRACE();
  
 +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);
 +
  	/* disable interrupts */
  	ixgbe_disable_intr(hw);
-@@ -3972,4 +3976,23 @@ out:
+@@ -3975,4 +3979,23 @@ out:
  }
  
 +static void
@@ -66,7 +67,7 @@
 +
  /* return 0 means link status changed, -1 means not changed */
  int
-@@ -3984,7 +4007,5 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
+@@ -3987,7 +4010,5 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
  	int link_up;
  	int diag;
 -	u32 speed = 0;
@@ -74,7 +75,7 @@
 -	bool autoneg = false;
  
  	memset(&link, 0, sizeof(link));
-@@ -3996,11 +4017,6 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
+@@ -3999,11 +4020,6 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
  	hw->mac.get_link_status = true;
  
 -	if ((intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) &&
@@ -88,7 +89,7 @@
 +		return rte_eth_linkstatus_set(dev, &link);
  
  	/* check if it needs to wait to complete, if lsc interrupt is enabled */
-@@ -4020,9 +4036,12 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
+@@ -4023,9 +4039,12 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
  
  	if (link_up == 0) {
 -		intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
@@ -103,7 +104,7 @@
 -	intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
  	link.link_status = ETH_LINK_UP;
  	link.link_duplex = ETH_LINK_FULL_DUPLEX;
-@@ -5129,4 +5148,6 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
+@@ -5134,4 +5153,6 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
  	PMD_INIT_FUNC_TRACE();
  
 +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);


More information about the stable mailing list