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 4427F1B1C3 for ; Thu, 19 Oct 2017 12:22:35 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id l68so15348831wmd.5 for ; Thu, 19 Oct 2017 03:22: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=x9OdS+iC2bKcT6IEPsDuRU/vmSKSaMJTYJVMDvz+X7Q=; b=PhwbImTIuqDhIEaMZ6WbLCQ4GnWEDK16Zx8GJ8yfB42uk5J0jVb0LXJ/8JLhMQPw2J tIebcfhkfYDoDSWie64rHFOHQVssSh4Mj/XQkMoI1soCrSvnGya9VsRv7q1fF2BjDSdO 3kIQmF0B3B5Da22M/wXog0YaKFwH5wbXVJqm+2goJnMo/qtK3b6/p2k0wuOn8mui/Cra BBNp+sXCw87NlLkrL0qJivtAxFP7sNGgp98XHca1Yy0H43EDQHmxj+noNA53Lbc8f/O1 FKVd695JJK1eEXuL//W8JQdHGeD+iBjxjTogEamn8e9gV9nPKxiiRbDFbNLhFh+RZ6SU HpEw== 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=x9OdS+iC2bKcT6IEPsDuRU/vmSKSaMJTYJVMDvz+X7Q=; b=omMLHeaFoML8EgqBTIm3uvF2NYAPeiQMpz/0Mpp7ejvW3v4Dea0MgUpxrJjp1z+cce yjp78gpn+bwWtxSybST2DgWnZJpPeyGq1gEi547wuWXLxR9hihB/Z/AHGAO61va2YxTz 5k33l3sP4t15G1bDE8KM0AosLgs/rRqvcBjVMJeOzB3HbUuW769fReqH+CddzxUCJIGW 81H3H9PQoCItMTlBXg6snZa1reVbSa5ItMkMU2zpnfi5NeJlHybKiee4JytVZ3Bn/tIy asxwvp6lPRorsproxKQmTpQJRH90nG5RVNPO+eSkp4ZKf0e/X4PZhF42twP6pXb55g5m GCEw== X-Gm-Message-State: AMCzsaWXq3NlIJhhXqv5Tia3PmDQTlcfm9Xi6uorpr5TohHy/82XKpV1 MLU+rqzPgC+eWlEbf9aD4ntSqw== X-Google-Smtp-Source: ABhQp+RvC12OUFANMEvwcIr+oX5/9ZjXuWfN2xCTaP6sW4NDF2gV/FlTECiaLFHyP98mCfzEDaHSlg== X-Received: by 10.28.93.145 with SMTP id r139mr1195246wmb.72.1508408554847; Thu, 19 Oct 2017 03:22:34 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id x19sm2090666wrd.10.2017.10.19.03.22.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 03:22:33 -0700 (PDT) Date: Thu, 19 Oct 2017 12:22:22 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Raslan Darawsheh Cc: dev@dpdk.org, thomas@monjalon.net Message-ID: <20171019102222.GE3596@bidouze.vm.6wind.com> References: <1508404312-16996-1-git-send-email-rasland@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1508404312-16996-1-git-send-email-rasland@mellanox.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] net/failsafe: fix PCI devices init 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, 19 Oct 2017 10:22:36 -0000 Hello Raslan, Thanks for spotting the issue and fixing it. Small nit below. On Thu, Oct 19, 2017 at 12:11:52PM +0300, Raslan Darawsheh wrote: > When trying to attach a port as a sub-device, the ethdev port > was compared with devargs. > In the case of a PCI device, the name in devargs is the PCI address. > And since DPDK 17.08, the devargs name of the underlying device was > used to match an ethdev port: > a1e7c17555e8 ("ethdev: use device name from device structure") > > But the recent commit 72e3efb149cc has reverted this wrong matching > to use the ethdev port name as identifier of the port. > It impacts functions like rte_eth_dev_allocated() used in failsafe > for matching ports with given devargs. > The fix is to search for matching devargs in underlying device of > all ethdev ports. > If many ports match the same PCI device, only the first one is matched. > > This limitation was already present in previous implementation of > rte_eth_dev_allocated(), and must be adressed later with a better > devargs syntax. > > Fixes: 72e3efb149cc ("ethdev: revert use port name from device structure") > > Signed-off-by: Raslan Darawsheh With the nit below fixed: Acked-by: Gaetan Rivet > --- > drivers/net/failsafe/failsafe_eal.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c > index aeb87a0..734b25c 100644 > --- a/drivers/net/failsafe/failsafe_eal.c > +++ b/drivers/net/failsafe/failsafe_eal.c > @@ -41,6 +41,7 @@ fs_bus_init(struct rte_eth_dev *dev) > struct sub_device *sdev; > struct rte_devargs *da; > uint8_t i; > + uint16_t j; > int ret; > > FOREACH_SUBDEV(sdev, i, dev) { > @@ -57,7 +58,13 @@ fs_bus_init(struct rte_eth_dev *dev) > rte_errno ? ")" : ""); > continue; > } > - ETH(sdev) = rte_eth_dev_allocated(da->name); > + RTE_ETH_FOREACH_DEV(j) { > + if (!strcmp(rte_eth_devices[j].device->name, > + da->name)) { The explicit comparison to 0 should be preferred, as done in failsafe_args.c. > + ETH(sdev) = &rte_eth_devices[j]; > + break; > + } > + } > if (ETH(sdev) == NULL) { > ERROR("sub_device %d init went wrong", i); > return -ENODEV; > -- > 2.7.4 > -- Gaëtan Rivet 6WIND