From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 0D5E51BA36 for ; Tue, 10 Apr 2018 10:20:35 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id 66so17907341wmd.3 for ; Tue, 10 Apr 2018 01:20:35 -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=ceFagiP6YPtC/3HvAP/1B11AJqB+hbUScbm9aV1Pp1YM5qA24SISh/zxd3/6/ZVE5C FePmT92GQ4IwolE2kErVV0ocNwa1YJgIu03lTTNVCF3zTc2rYmJybbwnL5WBEjnHkeH5 Fsq5o4IzSoLVqHjyBEIg0c8zNplFgxMG3+tACy6g8bmJSud+8jRH8pJ4bGAa3cWtCx1Y +i7UrCJwboEnl2ORHZnGUpOSgZafqCI402c19V2H2VYRkE9xCpqmQSq5MpqVRv9cLK5G g1fnBSHOPWCmpta6joHuMwSKnpAoFj3HsbxSj4GOQvkbqjTQccdG0tQADnb+OBKPSJsl 1LwQ== X-Gm-Message-State: ALQs6tB/ZODYpkI1Br8sEPSOqWbQ+J1aCx+IEcqkrStSEUCgzaruEe2p NhFe2cnKwktMt+Uind4+kxPA 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-dev] [PATCH] ethdev: fix link status query 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: 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