From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 74E8258EC for ; Fri, 31 Aug 2018 14:38:27 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180831123826euoutp010a9eb1e7da8b45b6671e9f9b04872efd~P_GP50_yf2315123151euoutp01B for ; Fri, 31 Aug 2018 12:38:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180831123826euoutp010a9eb1e7da8b45b6671e9f9b04872efd~P_GP50_yf2315123151euoutp01B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1535719106; bh=iPuFxP8YZUory9f/OOLNvfNg9+hxzODylTSCR2/wRho=; h=From:To:Cc:Subject:Date:References:From; b=GF2HRmzrFvCgoDcalaviu79ukmy/AjuhB8LuebrJQqe3bih0933AxE0pgReMnEz3m 34scP9QvWrPXlW/ShwmSAdfcovjrCuu50sAE4gjcGJbBG+S14agLdIxj0Alkhu8yhD vAKrGpEVmyDaqfFsMa3PFvRNb39dYhTGMnEwSAXE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180831123825eucas1p2f7ede171a92bd3385995629cbb1eb727~P_GPPxexe1885518855eucas1p2c; Fri, 31 Aug 2018 12:38:25 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A3.11.04441.1C6398B5; Fri, 31 Aug 2018 13:38:25 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20180831123824eucas1p1cd2981c716c4764703e24c3eeb4d33c7~P_GOOSRuf0867908679eucas1p1K; Fri, 31 Aug 2018 12:38:24 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180831123824eusmtrp207b7b8e41be5cf06592797578b50dc27~P_GN9gS5Z2317923179eusmtrp25; Fri, 31 Aug 2018 12:38:24 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-79-5b8936c1e5b2 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 79.90.04284.0C6398B5; Fri, 31 Aug 2018 13:38:24 +0100 (BST) Received: from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20180831123823eusmtip230ffc111e33eb6591976eb658234b1fe~P_GNfXIxE1898518985eusmtip2C; Fri, 31 Aug 2018 12:38:23 +0000 (GMT) From: Ilya Maximets To: dev@dpdk.org Cc: Wenzhuo Lu , Konstantin Ananyev , Laurent Hardy , Wei Dai , Ilya Maximets , stable@dpdk.org Date: Fri, 31 Aug 2018 15:39:46 +0300 X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJIsWRmVeSWpSXmKPExsWy7djP87oHzTqjDY5s5bN492k7k8WV9p/s Fu//LGKxuHxmOovFv44/7BYHXrWwWGw985fRgd3jYv8dRo9fC5ayeize85LJo2/LKsYAligu m5TUnMyy1CJ9uwSujPf7TzAWHFWsOHnrO2MDY4dMFyMnh4SAicTDVx2sXYxcHEICKxglDs/+ B+V8YZR4fHAyG4TzmVHiUO8kRpiWtnmL2SESyxkldt98zATh/GCUOLW1nwmkik1AR+LU6iNg HSICAhKfOxezgdjMAncZJWbvdehi5OAQFnCReHRAECTMIqAq8XXHcWaIBfISqzccYAaZKSFw hk1i3pqPYDN5BcokTu78zQrSKwHUu3iqG0S9sMSr41vYIWwZif875zNB2PUS91teMkLM6WCU mH7oH1TCXmLL63PsIHOYBTQl1u/Shwg7Srxu+8kMMZ5P4sZbQY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PTmlcl2SXvRmNS5E7ben9JWu2uBtFZu senKvoPpRTfOK+vc1enaupTBb+UqF+6l7P8vLb5v86dN7+CrIvUDL5e9Y688W3LqiVNQ4OGG zIP3HzsxXpr3/lGz+r3qu2e5xQWfX33A2MPposi8zdRfiaU4I9FQi7moOBEAndleelECAAA= Message-Id: <20180831123824eucas1p1cd2981c716c4764703e24c3eeb4d33c7~P_GOOSRuf0867908679eucas1p1K@eucas1p1.samsung.com> X-CMS-MailID: 20180831123824eucas1p1cd2981c716c4764703e24c3eeb4d33c7 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20180831123824eucas1p1cd2981c716c4764703e24c3eeb4d33c7 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180831123824eucas1p1cd2981c716c4764703e24c3eeb4d33c7 References: Subject: [dpdk-dev] [PATCH] net/ixgbe: fix busy polling while fiber link update X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2018 12:38:27 -0000 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") CC: stable@dpdk.org Signed-off-by: Ilya Maximets --- 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 26b192737..a33b9a6e8 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -221,6 +221,8 @@ static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev, struct rte_intr_handle *handle); 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); static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index); @@ -2791,6 +2793,8 @@ 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); @@ -3969,6 +3973,25 @@ ixgbevf_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed, return ret_val; } +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 ixgbe_dev_link_update_share(struct rte_eth_dev *dev, @@ -3981,9 +4004,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev, IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); int link_up; int diag; - u32 speed = 0; int wait = 1; - bool autoneg = false; memset(&link, 0, sizeof(link)); link.link_status = ETH_LINK_DOWN; @@ -3993,13 +4014,8 @@ 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 */ if (wait_to_complete == 0 || dev->data->dev_conf.intr_conf.lsc != 0) @@ -4017,11 +4033,14 @@ 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; @@ -5128,6 +5147,8 @@ 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); hw->adapter_stopped = 1; -- 2.17.1