From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 61240CF7A for ; Thu, 30 Mar 2017 18:32:51 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 30 Mar 2017 09:32:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,247,1486454400"; d="scan'208";a="1128982451" Received: from kmsmsx152.gar.corp.intel.com ([172.21.73.87]) by fmsmga001.fm.intel.com with ESMTP; 30 Mar 2017 09:32:48 -0700 Received: from pgsmsx101.gar.corp.intel.com ([169.254.1.119]) by KMSMSX152.gar.corp.intel.com ([169.254.11.139]) with mapi id 14.03.0248.002; Fri, 31 Mar 2017 00:32:47 +0800 From: "Dai, Wei" To: Olivier Matz , "dev@dpdk.org" , "Zhang, Helin" , "Ananyev, Konstantin" CC: "laurent.hardy@6wind.com" Thread-Topic: [dpdk-dev] [PATCH v2] net/ixgbe: ensure link status is updated Thread-Index: AQHSiHJOqts/q/V/ZECtHkAm9kAqd6Gs1pqAgADyDqA= Date: Thu, 30 Mar 2017 16:32:47 +0000 Message-ID: <49759EB36A64CF4892C1AFEC9231E8D650A23CB0@PGSMSX101.gar.corp.intel.com> References: <1479403792-11928-1-git-send-email-laurent.hardy@6wind.com> <1487262721-22370-1-git-send-email-olivier.matz@6wind.com> <20170330111959.43ac9078@platinum> In-Reply-To: <20170330111959.43ac9078@platinum> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDc5ZjA1YmUtMjc4OS00ZmFjLWIxZTUtNTIyODA0NGQwYTY2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlU1Q3hlT0ZCNHl5d1UrMFNsc0ZHRTVnK0h6VjZUaUl6d2hrTXluUUhhZTg9In0= x-ctpclassification: CTP_IC x-originating-ip: [172.30.20.206] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: ensure link status is updated 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, 30 Mar 2017 16:32:52 -0000 Hi, Olivier Has anyone already tested this patch ? Can you present some useful info on how to test it ? Can I use ethtool with some argument to downgrade or upgrade the rate of pe= er port ? I have just run testpmd with 82599, the hw->phy. autoneg_advertised is 0 af= ter rte_eal_init() and rte_eth_dev_start(). So I think the codes in if (!speed) { ... } is likely to be run. I agree with most of your codes. But why to limit speed of NIC to 10Gbps if autoneg is false and 10Gbps is s= upported ? In this case, how about setting multiple speed ? Thanks=20 -Wei=20 > -----Original Message----- > From: Olivier Matz [mailto:olivier.matz@6wind.com] > Sent: Thursday, March 30, 2017 5:20 PM > To: dev@dpdk.org; Zhang, Helin ; Ananyev, > Konstantin ; Dai, Wei > Cc: laurent.hardy@6wind.com > Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: ensure link status is updat= ed >=20 > Hi, >=20 > Can this patch be applied? >=20 > Thanks, > Olivier >=20 >=20 > On Thu, 16 Feb 2017 17:32:01 +0100, Olivier Matz > wrote: > > From: Laurent Hardy > > > > In case of fiber and link speed set to 1Gb at peer side (with autoneg > > or with defined speed), link status could be not properly updated at > > time cable is plugged-in. > > Indeed if cable was not plugged when device has been configured and > > started then link status will not be updated properly with new speed > > as no link setup will be triggered. > > > > To avoid this issue, IXGBE_FLAG_NEED_LINK_CONFIG is set to try a link > > setup each time link_update() is triggered and current link status is > > down. When cable is plugged-in, link setup will be performed via > > ixgbe_setup_link(). > > > > Signed-off-by: Laurent Hardy > > --- > > > > v1 -> v2: > > - rebase on top of head (change flag to 1<<4) > > - fix regression with copper links: only update link for fiber links > > > > drivers/net/ixgbe/ixgbe_ethdev.c | 21 +++++++++++++++++++++ > > drivers/net/ixgbe/ixgbe_ethdev.h | 1 + > > 2 files changed, 22 insertions(+) > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index 0b89598..1114106 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -2357,6 +2357,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) > > > > /* set flag to update link status after init */ > > intr->flags |=3D IXGBE_FLAG_NEED_LINK_UPDATE; > > + intr->flags |=3D IXGBE_FLAG_NEED_LINK_CONFIG; > > > > /* > > * Initialize to TRUE. If any of Rx queues doesn't meet the bulk @@ > > -3515,8 +3516,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int > wait_to_complete) > > struct ixgbe_hw *hw =3D > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > struct rte_eth_link link, old; > > ixgbe_link_speed link_speed =3D IXGBE_LINK_SPEED_UNKNOWN; > > + struct ixgbe_interrupt *intr =3D > > + IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); > > int link_up; > > int diag; > > + u32 speed =3D 0; > > + bool autoneg =3D false; > > > > link.link_status =3D ETH_LINK_DOWN; > > link.link_speed =3D 0; > > @@ -3526,6 +3531,20 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, > > int wait_to_complete) > > > > hw->mac.get_link_status =3D true; > > > > + if ((intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) && > > + hw->mac.ops.get_media_type(hw) =3D=3D ixgbe_media_type_fiber) { > > + speed =3D hw->phy.autoneg_advertised; > > + if (!speed) { > > + ixgbe_get_link_capabilities(hw, &speed, &autoneg); > > + /* setup the highest link when no autoneg */ > > + if (!autoneg) { > > + if (speed & IXGBE_LINK_SPEED_10GB_FULL) > > + speed =3D IXGBE_LINK_SPEED_10GB_FULL; > > + } > > + } > > + ixgbe_setup_link(hw, speed, true); > > + } > > + > > /* check if it needs to wait to complete, if lsc interrupt is enabled= */ > > if (wait_to_complete =3D=3D 0 || dev->data->dev_conf.intr_conf.lsc != =3D 0) > > diag =3D ixgbe_check_link(hw, &link_speed, &link_up, 0); @@ -3543,10 > > +3562,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int > > wait_to_complete) > > > > if (link_up =3D=3D 0) { > > rte_ixgbe_dev_atomic_write_link_status(dev, &link); > > + intr->flags |=3D IXGBE_FLAG_NEED_LINK_CONFIG; > > if (link.link_status =3D=3D old.link_status) > > return -1; > > return 0; > > } > > + intr->flags &=3D ~IXGBE_FLAG_NEED_LINK_CONFIG; > > link.link_status =3D ETH_LINK_UP; > > link.link_duplex =3D ETH_LINK_FULL_DUPLEX; > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h > > b/drivers/net/ixgbe/ixgbe_ethdev.h > > index aabbb00..bed4379 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.h > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h > > @@ -45,6 +45,7 @@ > > #define IXGBE_FLAG_MAILBOX (uint32_t)(1 << 1) > > #define IXGBE_FLAG_PHY_INTERRUPT (uint32_t)(1 << 2) > > #define IXGBE_FLAG_MACSEC (uint32_t)(1 << 3) > > +#define IXGBE_FLAG_NEED_LINK_CONFIG (uint32_t)(1 << 4) > > > > /* > > * Defines that were not part of ixgbe_type.h as they are not used by > > the