From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 7376E952 for ; Wed, 8 Feb 2017 16:51:46 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP; 08 Feb 2017 07:51:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,348,1477983600"; d="scan'208";a="1123813148" Received: from kmsmsx154.gar.corp.intel.com ([172.21.73.14]) by fmsmga002.fm.intel.com with ESMTP; 08 Feb 2017 07:51:44 -0800 Received: from pgsmsx106.gar.corp.intel.com ([169.254.9.9]) by KMSMSX154.gar.corp.intel.com ([169.254.12.113]) with mapi id 14.03.0248.002; Wed, 8 Feb 2017 23:51:43 +0800 From: "Dai, Wei" To: Laurent Hardy , "Zhang, Helin" , "Ananyev, Konstantin" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/ixgbe: ensure link status is updated Thread-Index: AQHSQPhNTNmAGECDg0GKRm86FpOgSaFfs7ug Date: Wed, 8 Feb 2017 15:51:42 +0000 Message-ID: <49759EB36A64CF4892C1AFEC9231E8D63A359376@PGSMSX106.gar.corp.intel.com> References: <1479403792-11928-1-git-send-email-laurent.hardy@6wind.com> In-Reply-To: <1479403792-11928-1-git-send-email-laurent.hardy@6wind.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGY2N2VjMjgtYTZmYS00NjViLWI3N2MtYzY5MzhlMWQ3YjI1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IklpaE9BbmJyTXdxNHVKaVJ1cUUyRWZBS0RKeWZhV24ralpVMzM3UE83M1k9In0= x-ctpclassification: CTP_IC x-originating-ip: [172.30.20.205] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] 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: Wed, 08 Feb 2017 15:51:47 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Laurent Hardy > Sent: Friday, November 18, 2016 1:30 AM > To: Zhang, Helin ; Ananyev, Konstantin > > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] net/ixgbe: ensure link status is updated >=20 > In case of link speed set to 1Gb at peer side (with autoneg or with defin= ed > speed) and cable not plugged-in when device is configured and started, th= en > link status is not updated properly with new speed as no link setup is tr= iggered. >=20 > To avoid this issue, IXGBE_FLAG_NEED_LINK_CONFIG is set to try a link set= up > each time link_update() is triggered and current link status is down. Whe= n > cable is plugged-in, link setup will be performed via ixgbe_setup_link(). >=20 > Signed-off-by: Laurent Hardy > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++ > drivers/net/ixgbe/ixgbe_ethdev.h | 1 + > 2 files changed, 21 insertions(+) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > b/drivers/net/ixgbe/ixgbe_ethdev.c > index 52ebbe4..513d1d5 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -2095,6 +2095,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) >=20 > /* set flag to update link status after init */ > intr->flags |=3D IXGBE_FLAG_NEED_LINK_UPDATE; > + intr->flags |=3D IXGBE_FLAG_NEED_LINK_CONFIG; >=20 > /* > * Initialize to TRUE. If any of Rx queues doesn't meet the bulk @@ > -3117,8 +3118,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; >=20 > link.link_status =3D ETH_LINK_DOWN; > link.link_speed =3D 0; > @@ -3128,6 +3133,19 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, > int wait_to_complete) >=20 > hw->mac.get_link_status =3D true; >=20 > + if (intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) { > + 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); @@ -3145,10 > +3163,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int > wait_to_complete) >=20 > 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; >=20 > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h > b/drivers/net/ixgbe/ixgbe_ethdev.h > index e060c3d..9d335ba 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.h > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h > @@ -43,6 +43,7 @@ > #define IXGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0) > #define IXGBE_FLAG_MAILBOX (uint32_t)(1 << 1) > #define IXGBE_FLAG_PHY_INTERRUPT (uint32_t)(1 << 2) > +#define IXGBE_FLAG_NEED_LINK_CONFIG (uint32_t)(1 << 3) Now there is following macro in DPDK 17.02-rc2. #define IXGBE_FLAG_MACSEC (uint32_t)(1 << 3) You can redefine it as #define IXGBE_FLAG_NEED_LINK_CONFIG (uint32_t)(1 << = 4) >=20 > /* > * Defines that were not part of ixgbe_type.h as they are not used by th= e > -- > 1.7.10.4