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 1DA794CA7 for ; Tue, 30 Oct 2018 11:21:03 +0100 (CET) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181030102102euoutp01a762b31289240770818573726b54ade4~iW7aloJ_s0169101691euoutp01E for ; Tue, 30 Oct 2018 10:21:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181030102102euoutp01a762b31289240770818573726b54ade4~iW7aloJ_s0169101691euoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540894862; bh=rI1UYEz11K9CJqYtk2wellqJU46czAjaFiMhx5hJ5GI=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=ksnBGH7rahrTjK+GGcwMpZwoqmearwFAH+wYadgqCypBCLtd8MUacwJMrbsptbZJ0 WoQLhXyAlhQ+zcvMvuljn8PGIV8e+lQqTfiYrlaz9/SB8Wu4iaw9cvANYljHZvWXwC h/R/U9GMX35N5CwJYmSkh+ucCARNymWIJpmDuXTs= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181030102101eucas1p2b8554a2bde711659abe4af616c056b2f~iW7Z_sHSC2403524035eucas1p2T; Tue, 30 Oct 2018 10:21:01 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id FE.D4.04441.D8038DB5; Tue, 30 Oct 2018 10:21:01 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181030102100eucas1p1606920c5d5dc8c14a8153953dee31123~iW7ZHWOeT2080520805eucas1p1X; Tue, 30 Oct 2018 10:21:00 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181030102100eusmtrp1d0193c1897283c4606da15a9a41c5771~iW7Y3ImAA0937509375eusmtrp1M; Tue, 30 Oct 2018 10:21:00 +0000 (GMT) X-AuditID: cbfec7f2-a1ae89c000001159-b7-5bd8308d8729 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 79.DC.04284.C8038DB5; Tue, 30 Oct 2018 10:21:00 +0000 (GMT) Received: from [106.109.129.180] (unknown [106.109.129.180]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20181030102100eusmtip10c158549fe100bba85629d7007d48dd4~iW7YQzROI1926719267eusmtip1K; Tue, 30 Oct 2018 10:20:59 +0000 (GMT) To: dev@dpdk.org Cc: Wenzhuo Lu , Konstantin Ananyev , Laurent Hardy , Wei Dai , stable@dpdk.org, Qi Zhang , Thomas Monjalon , Ferruh Yigit From: Ilya Maximets Message-ID: Date: Tue, 30 Oct 2018 13:20:54 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20180831123824eucas1p1cd2981c716c4764703e24c3eeb4d33c7~P_GOOSRuf0867908679eucas1p1K@eucas1p1.samsung.com> Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKKsWRmVeSWpSXmKPExsWy7djPc7q9BjeiDQ7+ULR492k7k8WdvafZ La60/2S3eP9nEYvF5TPTWSymb+hns/jX8Yfd4sum6WwWB161sFhsPfOX0YHL42L/HUaPXwuW snos3vOSyaNvyyrGAJYoLpuU1JzMstQifbsErozlj36wFhxRqTg6rZ2tgfGTbBcjJ4eEgInE k9mtbF2MXBxCAisYJfZfeMcO4XxhlHj6+wUzhPOZUeLvlF+sXYwcYC1nXpZAxJczSnSsnc4C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0XCKUWLPv58sIAk2AR2JU6shGngF7CRmnZwFto1FQFXi7e29YLaoQITE2ZfroGoEJU7O fMICcimnQLnEuuPBEPPVJf7Mu8QMYYtLNH1ZyQphy0tsfzuHeQKj0Cwk3bOQtMxC0jILScsC RpZVjCKppcW56bnFhnrFibnFpXnpesn5uZsYgZG47djPzTsYL20MPsQowMGoxMOroXM9Wog1 say4MvcQowQHs5IIbzDXjWgh3pTEyqrUovz4otKc1OJDjKZAv01klhJNzgcmibySeENTQ3ML S0NzY3NjMwslcd7zBpVRQgLpiSWp2ampBalFMH1MHJxSDYzB0atkins39Pwt0zDhe9v79fY8 m0n27UYsep26JZx+gasbCv5K167Uu/ha6qRGkftMX2kDj+PmYr/lpTYrlmhzLrof0DSthOXn bMu1NpWWt9dKP9bx2i4g6frM9/bNBO5kJ01Bj+2O/SFtW3a8Klg1qy5sBmdfZYPATAuhSL/H PG4+NcsXKrEUZyQaajEXFScCAJyF2JraAgAA X-CMS-MailID: 20181030102100eucas1p1606920c5d5dc8c14a8153953dee31123 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: <20180831123824eucas1p1cd2981c716c4764703e24c3eeb4d33c7~P_GOOSRuf0867908679eucas1p1K@eucas1p1.samsung.com> Subject: Re: [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: Tue, 30 Oct 2018 10:21:04 -0000 Any more thoughts on that fix? Or is there any chance for it to be accepted? Best regards, Ilya Maximets. On 31.08.2018 15:39, Ilya Maximets wrote: > 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; >