From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 9A827324D for ; Thu, 1 Nov 2018 17:05:08 +0100 (CET) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181101160507euoutp02604c90b0f44a5c418e2ebba8f16bbe9d~jC6aEVO962187021870euoutp02C for ; Thu, 1 Nov 2018 16:05:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181101160507euoutp02604c90b0f44a5c418e2ebba8f16bbe9d~jC6aEVO962187021870euoutp02C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1541088307; bh=30lj1UW9SXKEHU71JR32ej2psUbDOXtGalmBz1eb0QU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lqbkv77myR4U3mf5wJSyNR79Cqygmqbf6gNXF5ZYMtWbsGzI6v5uUHBR6HsVlbXKp aA0kjfZTS8zvJ76X6s8mwdSALmPQbWma6+MIToKtku3qO2WvWRk2/l7dZN6OJj6+Bz mQAoSh7WYtSEyIQE+l+Fe6uLTIu79wnKzHcNLvNM= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181101160506eucas1p1cac72acf92e525770ac88c09dedff97c~jC6ZX1Wla1130111301eucas1p1j; Thu, 1 Nov 2018 16:05:06 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id CF.DC.04806.2342BDB5; Thu, 1 Nov 2018 16:05:06 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181101160505eucas1p1fcf268f3febaa80dcbb3e573b2fc2c68~jC6YjP_tK1757117571eucas1p11; Thu, 1 Nov 2018 16:05:05 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20181101160505eusmtrp296d150efc25317fa33d8d625ee6a96ae~jC6YUn3Fn1803218032eusmtrp2S; Thu, 1 Nov 2018 16:05:05 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-30-5bdb243205e2 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 22.BA.04128.1342BDB5; Thu, 1 Nov 2018 16:05:05 +0000 (GMT) Received: from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181101160504eusmtip2c9a58b75be48810dbbbf3e835312bbe1~jC6XshL1y0245202452eusmtip2S; Thu, 1 Nov 2018 16:05:04 +0000 (GMT) From: Ilya Maximets To: dev@dpdk.org, Qi Zhang Cc: Wenzhuo Lu , Konstantin Ananyev , Laurent Hardy , Wei Dai , Ferruh Yigit , Ilya Maximets , stable@dpdk.org Date: Thu, 1 Nov 2018 19:04:59 +0300 Message-Id: <20181101160459.23586-1-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180831123824eucas1p1cd2981c716c4764703e24c3eeb4d33c7~P_GOOSRuf0867908679eucas1p1K@eucas1p1.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgleLIzCtJLcpLzFFi42LZduzneV0jldvRBls38Fm8+7SdyeLO3tPs Flfaf7JbvP+ziMXi8pnpLBbTN/SzWfzr+MNuceBVC4vF1jN/GR04PS7232H0+LVgKavH4j0v mTz6tqxiDGCJ4rJJSc3JLEst0rdL4Mo4saiTpWCeUsXu5R9ZGxhvy3QxcnJICJhILPtzja2L kYtDSGAFo8Sx9X1MEM4XRol1C2axQjifGSVmfT7CBtOy5tRUqJbljBJHZ1+FqvrBKPF76mSw KjYBHYlTq48wgtgiAoYSa+6/YQE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QgJlEkuf /2adwMi3gJFhFaNIamlxbnpusZFecWJucWleul5yfu4mRmD4bjv2c8sOxq53wYcYBTgYlXh4 GZRvRwuxJpYVV+YeYpTgYFYS4Z184Va0EG9KYmVValF+fFFpTmrxIUZToJsmMkuJJucDYyuv JN7Q1NDcwtLQ3Njc2MxCSZz3vEFllJBAemJJanZqakFqEUwfEwenVANjp0RKd37r3N8BfxQ9 AwpXZE1hX/Ob73rxc87pndd6ZMXvf9iV0Xel5YrWlIMbZAOEl017t6v6cUXmVc9ZvLvZbLd+ M3cU7vjx5Nnf5zZZz39pTuwVP3WEQ+Hwwkn9N18wn97x+B6Pe9P8JOGf2TePKb9fWrXu4oqv c7nqwu6GFt1/Lb7VzD6hTImlOCPRUIu5qDgRAA1QTbR1AgAA X-CMS-MailID: 20181101160505eucas1p1fcf268f3febaa80dcbb3e573b2fc2c68 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181101160505eucas1p1fcf268f3febaa80dcbb3e573b2fc2c68 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181101160505eucas1p1fcf268f3febaa80dcbb3e573b2fc2c68 References: <20180831123824eucas1p1cd2981c716c4764703e24c3eeb4d33c7~P_GOOSRuf0867908679eucas1p1K@eucas1p1.samsung.com> Subject: [dpdk-dev] [PATCH v2] 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: Thu, 01 Nov 2018 16:05:08 -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 --- Version 2: * Minor rebase on dpdk-next-net-intel/master 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 5a2c35143..c9e82d515 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -220,6 +220,8 @@ static int ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev); 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); static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index); @@ -2793,6 +2795,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); @@ -3971,6 +3975,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, @@ -3983,9 +4006,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; @@ -3995,13 +4016,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) @@ -4019,11 +4035,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