From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com [209.85.128.173]) by dpdk.org (Postfix) with ESMTP id D8C2310BAC for ; Thu, 30 Mar 2017 11:20:03 +0200 (CEST) Received: by mail-wr0-f173.google.com with SMTP id k6so45630525wre.2 for ; Thu, 30 Mar 2017 02:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lut+SHVzC4ENkD3RUddBrbKxw2yGax7yDq5TrWIM0dk=; b=h8zX/HbRMDAJSpG7JWYFIVYLVzIxySU113d71/imU58dGN94pc/omFr2d/ZBE172YX G/1S88yUhoDqwH5jw+WFrpOsCe9SrMwFQxCf+48hoJuq6TbCPq4a4BI7lDprFp2s4J6+ BDxw2c2KtKJD9fW77S58Ef5dfGBx615wg1RbOiuHf1SrhFHh8iu+kksrI32dMRZv1HJD X+ncfTEnKRYZJn3PGgYSbvAmAw9GzY+mzUBXQrCht7+X2Z0UnQfp/1CuN8fogRvNdu+o mmWuntVkP7+eUcmjGT52pKyuOWj4U7BKi202cd4hYj+Hz8lnUNc9hh4fORHjHveBgcIm f0lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lut+SHVzC4ENkD3RUddBrbKxw2yGax7yDq5TrWIM0dk=; b=OGKbu1Kue7PGRU47LLZ+BDHkZXN5m0HppouVIjUjcyn6uwY5Koad3XUlep0Jd+TDbW FMuRNcld6DIDElnDtYh4C6u2mDxKyVGgB0OSPLg5mXPsXzNUL5vvfAL0DqNrMdKVPbPM 0ZNyBPV136gYax1M64rcNmI49WYhe5RDHjDBxkTHdXxshYppqLaxhrCkDSi2AtPZtZA5 i35oMn+KM5nm/hI6w+NLqmUSMFJePbJCnUyuqIpyOy4W7AJrVou56bPDmsnwpFnCnF9v NttGWGrgYB9XXJNh0kzdlOvoE5w3/aDFp0uHZ410IohxSZQqSTZTudgt1p3nk9WO4fQJ 92dA== X-Gm-Message-State: AFeK/H3hbDzIj6JDkSfrdupWoUMEmB86QFGZsGwXxQfMg2fXz7H/5vxfLGO7tBwSo8WqrFWG X-Received: by 10.223.177.138 with SMTP id q10mr4797991wra.164.1490865603137; Thu, 30 Mar 2017 02:20:03 -0700 (PDT) Received: from platinum (2a01cb0c03c651000226b0fffeed02fc.ipv6.abo.wanadoo.fr. [2a01:cb0c:3c6:5100:226:b0ff:feed:2fc]) by smtp.gmail.com with ESMTPSA id d10sm2017863wrd.14.2017.03.30.02.20.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Mar 2017 02:20:02 -0700 (PDT) Date: Thu, 30 Mar 2017 11:19:59 +0200 From: Olivier Matz To: dev@dpdk.org, helin.zhang@intel.com, konstantin.ananyev@intel.com, wei.dai@intel.com Cc: laurent.hardy@6wind.com Message-ID: <20170330111959.43ac9078@platinum> In-Reply-To: <1487262721-22370-1-git-send-email-olivier.matz@6wind.com> References: <1479403792-11928-1-git-send-email-laurent.hardy@6wind.com> <1487262721-22370-1-git-send-email-olivier.matz@6wind.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 09:20:04 -0000 Hi, Can this patch be applied? Thanks, Olivier 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 |= IXGBE_FLAG_NEED_LINK_UPDATE; > + intr->flags |= 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 = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > struct rte_eth_link link, old; > ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN; > + struct ixgbe_interrupt *intr = > + IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); > int link_up; > int diag; > + u32 speed = 0; > + bool autoneg = false; > > link.link_status = ETH_LINK_DOWN; > link.link_speed = 0; > @@ -3526,6 +3531,20 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) > > hw->mac.get_link_status = true; > > + if ((intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) && > + hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) { > + speed = 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 = 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 == 0 || dev->data->dev_conf.intr_conf.lsc != 0) > diag = 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 == 0) { > rte_ixgbe_dev_atomic_write_link_status(dev, &link); > + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG; > if (link.link_status == old.link_status) > return -1; > return 0; > } > + intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; > link.link_status = ETH_LINK_UP; > link.link_duplex = 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