From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 5C35D1B519 for ; Fri, 23 Nov 2018 11:29:53 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C189FC058CBE; Fri, 23 Nov 2018 10:29:52 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30FCA17DA1; Fri, 23 Nov 2018 10:29:50 +0000 (UTC) From: Kevin Traynor To: Ilya Maximets Cc: Qi Zhang , Wei Zhao , dpdk stable Date: Fri, 23 Nov 2018 10:26:41 +0000 Message-Id: <20181123102713.17309-37-ktraynor@redhat.com> In-Reply-To: <20181123102713.17309-1-ktraynor@redhat.com> References: <20181123102713.17309-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 23 Nov 2018 10:29:52 +0000 (UTC) Subject: [dpdk-stable] patch 'net/ixgbe: fix busy polling while fiber link update' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2018 10:29:53 -0000 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 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 Reviewed-by: Qi Zhang Reviewed-by: Wei Zhao --- 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 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@dpdk.org Signed-off-by: Ilya Maximets Reviewed-by: Qi Zhang @@ -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);