From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 038001BA32 for ; Tue, 10 Apr 2018 10:20:34 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id b127so24335428wmf.5 for ; Tue, 10 Apr 2018 01:20:34 -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:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=KYTRMllucdbgS1+x9L/Rv2OvtpMlIrPK0Vywswas/Cs=; b=lsdmakLqVWhvAHOihcS2YUfk3uICO0Tx8yMmO8xV7sw1Bvl5igYVfipHMh+3GCt/P+ Q6fzXV7aWFAbW3jljv1O4wRBEFZYNNnxqL0OZtSP/RECoqlcwjVYpr7fj8enhLx9BZEa G2Zb/hrbc/ekmtF5RCtVLK/lcJh9f/cDM+FZc82PXKrtoDuQF1WE0ICy0+bdSGP9ncYf lOU9HtB0eUaF1BUW/vxcQ58sz00c3e1CYfeoiO+rNIGC8Hv+IKprm9qVJMnKk4fxRueB +6Xg3zoDha4NPiqtVIVyvG9u4iTKBUx/ICQiPYEfa2cIVkoMpN4GG3OWGrxnwApHNBLs uvGg== 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=KYTRMllucdbgS1+x9L/Rv2OvtpMlIrPK0Vywswas/Cs=; b=R7ISckoou7G0CzDzEOvHqutC+8I5ZVhuS/in4Mv8jEz47vHFowbu015KODQAUhBSe0 u5ejzRK1OryONJmmkHOZ/SklLsYCGBSqxhVqg5rLt+Dx4ogz6wJp8AdlvA2BGzeOCy+b hmPu/zCAUCT9CdeR/WDxfCISnKtrZUg5TxQS4svg67UEBRyOzp1xNxwQa+Pozpe7glOI 07hE8EIr0pURI1xZc9OF+x5n30waBtjxqjHyTgkTkCsnR80nwezxw1POmnV2UYfMD7WW ikP2RxJ+A8FvhBNSS8EI0lYbVKZuOx0aNpjLKHWaCJ/K0wb7UnEKMp40Fwo7gGSE0vAM k8wg== X-Gm-Message-State: ALQs6tAX6RaPfgyWw/xEZ7ymwK6JUO0F0ax2lRW1okP6tt772wjo1F0B haSp4KN7Q2f++SCEZseA4Yy7kXL9FA== X-Google-Smtp-Source: AIpwx4+Jv29lHHN9iq/ezQOag+xSdgF+zeuERvwqVBeqEB+XwNXJrrJou4bbPr/73c+JAORuU5Se2A== X-Received: by 10.80.184.74 with SMTP id k10mr1818026ede.21.1523348434769; Tue, 10 Apr 2018 01:20:34 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id c3sm1386432edb.34.2018.04.10.01.20.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Apr 2018 01:20:34 -0700 (PDT) Date: Tue, 10 Apr 2018 10:20:51 +0200 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Shahaf Shuler Cc: ferruh.yigit@intel.com, thomas@monjalon.net, dev@dpdk.org, stable@dpdk.org, stephen@networkplumber.org Message-ID: <20180410082051.vhumihdzc3qhy7wy@laranjeiro-vm.dev.6wind.com> References: <20180410061631.50301-1-shahafs@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180410061631.50301-1-shahafs@mellanox.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-stable] [PATCH] ethdev: fix link status query X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Apr 2018 08:20:35 -0000 On Tue, Apr 10, 2018 at 09:16:31AM +0300, Shahaf Shuler wrote: > When application works with LSC interrupts the ethdev layer skips > the PMD callback and update according to the link status exists on > device data. It is because it assumes the link status on the device data > is the correct one since any link change is processed by the application. > > As multiple PMDs install the link status interrupt handler only on port > start and uninstall it on port stop, the link status may be incorrect in > case the query is called after port stop or before port start. It seems also logical to not process interrupts from stopped device, for them accessing to the link status should always end by calling the devop function. This patch is the result of discussion on thread [1]. > Fixing the query implementation to use the PMD callback for such cases. > > Fixes: b77d21cc2364 ("ethdev: add link status get/set helper functions") > Cc: stable@dpdk.org > Cc: stephen@networkplumber.org > Cc: nelio.laranjeiro@6wind.com Acked-by: Nelio Laranjeiro > Signed-off-by: Shahaf Shuler > --- > lib/librte_ether/rte_ethdev.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 2c74f7e049..0857670ebe 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -1789,7 +1789,8 @@ rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link) > RTE_ETH_VALID_PORTID_OR_RET(port_id); > dev = &rte_eth_devices[port_id]; > > - if (dev->data->dev_conf.intr_conf.lsc) > + if (dev->data->dev_conf.intr_conf.lsc && > + dev->data->dev_started) > rte_eth_linkstatus_get(dev, eth_link); > else { > RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update); > @@ -1806,7 +1807,8 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link) > RTE_ETH_VALID_PORTID_OR_RET(port_id); > dev = &rte_eth_devices[port_id]; > > - if (dev->data->dev_conf.intr_conf.lsc) > + if (dev->data->dev_conf.intr_conf.lsc && > + dev->data->dev_started) > rte_eth_linkstatus_get(dev, eth_link); > else { > RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update); > -- > 2.12.0 > Thanks, [1] https://dpdk.org/ml/archives/dev/2018-April/094788.html -- Nélio Laranjeiro 6WIND