From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id C49B91B1FA for ; Mon, 2 Oct 2017 14:09:47 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id t69so10141314wmt.2 for ; Mon, 02 Oct 2017 05:09:47 -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=l6GvN5rPY+/s1bXQRrq/c39Srq3HmM5eXEQUTL9Nuto=; b=Tyf3TlZUJao8iGBkFSIa5KuienFgqAjxLKBHAX+6kSim0YdbjlJ4JNPxjgdsemzzX9 Z2xMaeKJqp/mLgxukeLzkOWjzddBVw3PeotlDvZCB8bL0hLIW54cj4cWDqdCQwXym7Z1 BqD8oP+kMnWEvFKPKN62bAnMyFGa+ns6VYHJXqSJMCX+189rrzAmq6VfjH+BHxtb69zS Kpf+kpkv9ctP4vVWwoy44RZlktFpYnVmkaR7ZTQr1bqoxRfMB9EcAoM77LCmZRRAiWQ6 i4gB3HapvM+f115gTgH9eLzCGzU92x/V1TquuIwUmO40Jj7FXFqnBfle4WqWVknMtkz5 Y1Cw== 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=l6GvN5rPY+/s1bXQRrq/c39Srq3HmM5eXEQUTL9Nuto=; b=l2trq1sN1gXs+edJFxHcPZNcjgXgHmlcGpqYunJQd9ui2czsuwSz0FjMwsVkCupoD7 gpXar1u89OcrC8oKh4e17DiCEYvKKA9wtE7DK8pgAL+BDMMtgm2pdbFnewgvXSts6DmN 9W+276Cg3mRM+VFem3lmOghW6PDHKSVsWnge4HvRYdsdl0vF2qAE7004HsARDk9BHX9G q+WCYEy2JGjGYx6c18DL8mz+8QiMRRNSNECJo79xzUT447wj083mCM+O0FBcg/clnKVx zTVTcaVux3Ir6Cqg9UPwYIYyl893e/aXGojuAwun5tZVwNwoGqCuoCssAqP1rf1qw2fM hTNg== X-Gm-Message-State: AMCzsaUNQ38DlEU+s9cIwtZCBSAaHOQs1IlEj8FIrSrl79tYQDW3SGpc jpv55cKvXWOGRuD2pJyeMncXjnai X-Google-Smtp-Source: AOwi7QAHX9Awf+R3UnxzyMqMVLfK40giDavs2cSf7V2UML4X7pCKDqiQLNSD/sH3Qge1yxrjB5FAnA== X-Received: by 10.28.232.75 with SMTP id f72mr8204140wmh.90.1506946187049; Mon, 02 Oct 2017 05:09:47 -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 90sm5786812wrp.69.2017.10.02.05.09.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 05:09:46 -0700 (PDT) Date: Mon, 2 Oct 2017 14:09:35 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Gowrishankar Cc: dev@dpdk.org, Thomas Monjalon , Declan Doherty Message-ID: <20171002120935.GD24386@bidouze.vm.6wind.com> References: <266cd54d289bfd6e9535a173c9607f0234f8b1b7.1499167396.git.gowrishankar.m@linux.vnet.ibm.com> <502c45826dbbfd2bc3f4f743aeea87f159921ae9.1505929849.git.gowrishankar.m@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <502c45826dbbfd2bc3f4f743aeea87f159921ae9.1505929849.git.gowrishankar.m@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v3] net/bonding: support bifurcated driver in eal cli using --vdev 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: Mon, 02 Oct 2017 12:09:48 -0000 Hi Gowrishankar, There will be a trivial conflict with my PCI patchset on the pci_addr_cmp function. I don't know the best way to solve this. It depends on my patchset being accepted as-is or not, and which address namespace has precedence over the other. You could rename pci_addr_cmp with a reference to the bonding namespace, it is always nice when debugging to know that we are within the bonding PMD, even if the function is static inlined... Anyway, on the principle anyway the code seems ok to me, so Reviewed-by: Gaetan Rivet On Wed, Sep 20, 2017 at 11:34:58PM +0530, Gowrishankar wrote: > From: Gowrishankar Muthukrishnan > > At present, creating bonding devices using --vdev is broken for PMD like > mlx5 as it is neither UIO nor VFIO based and hence PMD driver is unknown > to find_port_id_by_pci_addr(), as below. > > testpmd --vdev 'net_bonding0,mode=1,slave=,socket_id=0' > > PMD: bond_ethdev_parse_slave_port_kvarg(150) - Invalid slave port value > () specified > EAL: Failed to parse slave ports for bonded device net_bonding0 > > This patch fixes parsing PCI ID from bonding device params by verifying > it in RTE PCI bus, rather than checking dev->kdrv. > > Fixes: eac901ce ("ethdev: decouple from PCI device") > Signed-off-by: Gowrishankar Muthukrishnan > --- > v3: > - adapt rte_bus API (with suggestions from Declan and Gaëtan) > > drivers/net/bonding/rte_eth_bond_args.c | 35 ++++++++++++++++++++++----------- > 1 file changed, 24 insertions(+), 11 deletions(-) > > diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c > index bb634c6..7c65dda 100644 > --- a/drivers/net/bonding/rte_eth_bond_args.c > +++ b/drivers/net/bonding/rte_eth_bond_args.c > @@ -61,16 +61,6 @@ > unsigned i; > > for (i = 0; i < rte_eth_dev_count(); i++) { > - > - /* Currently populated by rte_eth_copy_pci_info(). > - * > - * TODO: Once the PCI bus has arrived we should have a better > - * way to test for being a PCI device or not. > - */ > - if (rte_eth_devices[i].data->kdrv == RTE_KDRV_UNKNOWN || > - rte_eth_devices[i].data->kdrv == RTE_KDRV_NONE) > - continue; > - > pci_dev = RTE_ETH_DEV_TO_PCI(&rte_eth_devices[i]); > eth_pci_addr = &pci_dev->addr; > > @@ -98,6 +88,16 @@ > return -1; > } > > +static inline int > +pci_addr_cmp(const struct rte_device *dev, const void *_pci_addr) > +{ > + struct rte_pci_device *pdev; > + const struct rte_pci_addr *paddr = _pci_addr; > + > + pdev = RTE_DEV_TO_PCI(*(struct rte_device **)(void *)&dev); > + return rte_eal_compare_pci_addr(&pdev->addr, paddr); > +} > + > /** > * Parses a port identifier string to a port id by pci address, then by name, > * and finally port id. > @@ -106,10 +106,23 @@ > parse_port_id(const char *port_str) > { > struct rte_pci_addr dev_addr; > + struct rte_bus *pci_bus; > + struct rte_device *dev; > int port_id; > > + pci_bus = rte_bus_find_by_name("pci"); > + if (pci_bus == NULL) { > + RTE_LOG(ERR, PMD, "unable to find PCI bus\n"); > + return -1; > + } > + > /* try parsing as pci address, physical devices */ > - if (eal_parse_pci_DomBDF(port_str, &dev_addr) == 0) { > + if (pci_bus->parse(port_str, &dev_addr) == 0) { > + dev = pci_bus->find_device(NULL, pci_addr_cmp, &dev_addr); > + if (dev == NULL) { > + RTE_LOG(ERR, PMD, "unable to find PCI device\n"); > + return -1; > + } > port_id = find_port_id_by_pci_addr(&dev_addr); > if (port_id < 0) > return -1; > -- > 1.9.1 > -- Gaëtan Rivet 6WIND