From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dai, Wei" Subject: Re: [PATCH] net/ixgbe: ensure link status is updated 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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: Laurent Hardy , "Zhang, Helin" , "Ananyev, Konstantin" 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) In-Reply-To: <1479403792-11928-1-git-send-email-laurent.hardy@6wind.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----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