From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id F10872C08 for ; Tue, 27 Jun 2017 16:47:28 +0200 (CEST) Received: by mail-wm0-f52.google.com with SMTP id b184so29175117wme.1 for ; Tue, 27 Jun 2017 07:47:28 -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=Ad8cJ8vl5TRx3sAIp8yzx+FjYufIpDEpnsueQZrMh/4=; b=pUyFRBxocJqoBm22sZ1CGcyPCO/4kColGhlEAkAxAsiDQK10IaGGHcYepDIMkCjcu8 XJgioOubCN+JTs40mIGFnrm9cc+UGUth82Y9hxVrS4OAIMO1bYlj2nO1ODma9zSlWFsn 7J4vmNWsy4F8+GIlZmbLl0QvriIeZu7rCJnafdx0GAMkVMZO1XthQGNj0NMB7U+BOCJN kQE9OCctnA860MRvckcgci5N8n3T9m+Aek7KXx1PVWPbg4F0cDr8aJPwR/F1+2UHeVdA yptMvhfUG82vMP4lwrQ6xVAgV1IvqAkB68TDCX62nQCMElqB+VvBrpXiKUSb75/Wxivw PEPQ== 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=Ad8cJ8vl5TRx3sAIp8yzx+FjYufIpDEpnsueQZrMh/4=; b=d1EqEXrjjWQto5Ui1wvcKyNa5RarQm4LVgUhvveDeP0PgoloVXZV8UkRk88lLHmOQ1 tuW2gUoge0wFVGElxjmAq8k1TIOtvvi0jMZGi+5qD+npYlHrA2yX8yb7qJ/rTXTb4dVJ 1WdFRhPtOutszGxcxFQbVNqNLHCOO65xGsjXcoR78g6/KMoI88twTFjbA3z38BuD/yCk ihwIoqsSAE7RKG45vj6dZ8Jx3LQm2pyxfTnkqMAsBTM8pwXDSCdRwXtr4Ze3BdpDxCbY weY5sbLL+UTAhOA1Gnt8xfY7KdHix9C3Sj5aL9984GfF+oaqKp5FQTFXE4NBHNJ1Z9RY 5tqA== X-Gm-Message-State: AKS2vOy9r2QV4yr5f/yYhJMcyS6qLpRtAgPcL07ZyhwQs+oQqbJnkyKC AsIJBpLztpiYUziL X-Received: by 10.28.148.18 with SMTP id w18mr3534291wmd.56.1498574848328; Tue, 27 Jun 2017 07:47:28 -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 e131sm3441285wmd.28.2017.06.27.07.47.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Jun 2017 07:47:27 -0700 (PDT) Date: Tue, 27 Jun 2017 16:47:20 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Bruce Richardson Cc: dev@dpdk.org, Jan Blunck Message-ID: <20170627144720.GC13355@bidouze.vm.6wind.com> References: <20170627135855.GI104744@bricha3-MOBL3.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170627135855.GI104744@bricha3-MOBL3.ger.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v5 12/12] eal: make virtual driver probe and remove take rte_vdev_device 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, 27 Jun 2017 14:47:29 -0000 On Tue, Jun 27, 2017 at 02:58:55PM +0100, Bruce Richardson wrote: > On Mon, Jun 26, 2017 at 02:22:10AM +0200, Gaetan Rivet wrote: > > From: Jan Blunck > > > > This is a preparation to embed the generic rte_device into the rte_eth_dev > > also for virtual devices. > > > > Signed-off-by: Jan Blunck > > Signed-off-by: Gaetan Rivet > > --- > > lib/librte_eal/common/eal_common_dev.c | 93 ++++++++++++++++++++++++++-------- > > 1 file changed, 71 insertions(+), 22 deletions(-) > > > > diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c > > index a400ddd..d83ae41 100644 > > --- a/lib/librte_eal/common/eal_common_dev.c > > +++ b/lib/librte_eal/common/eal_common_dev.c > > @@ -37,6 +37,7 @@ > > #include > > #include > > > > +#include > > #include > > #include > > #include > > @@ -45,50 +46,98 @@ > > > > #include "eal_private.h" > > > > +static int cmp_detached_dev_name(const struct rte_device *dev, > > + const void *_name) > > +{ > > + const char *name = _name; > > + > > + /* skip attached devices */ > > + if (dev->driver) > > + return 0; > > + > > Does returning 0 from this function not mean that all already-attached > devices with match? Is that really what we want, as it doesn't seem to > match the logic in the function below. Please explain if I'm wrong here. > Yes, this was a mistake, good catch. > > + return strcmp(dev->name, name); > > +} > > + > > int rte_eal_dev_attach(const char *name, const char *devargs) > > { > > - struct rte_pci_addr addr; > > + struct rte_device *dev; > > + int ret; > > > > if (name == NULL || devargs == NULL) { > > RTE_LOG(ERR, EAL, "Invalid device or arguments provided\n"); > > return -EINVAL; > > } > > > > - if (eal_parse_pci_DomBDF(name, &addr) == 0) { > > - if (rte_pci_probe_one(&addr) < 0) > > - goto err; > > + dev = rte_bus_find_device(cmp_detached_dev_name, name, NULL); > > + if (dev) { > > + struct rte_bus *bus; > > + > > + bus = rte_bus_find_by_device(dev); > > + if (!bus) { > > + RTE_LOG(ERR, EAL, "Cannot find bus for device (%s)\n", > > + name); > > + return -EINVAL; > > + } > > > > - } else { > > - if (rte_vdev_init(name, devargs)) > > - goto err; > > + if (!bus->plug) { > > + RTE_LOG(ERR, EAL, "Bus function not supported\n"); > > + return -ENOTSUP; > > + } > > + > > + ret = (bus->plug(dev->devargs) == NULL); > > + goto out; > > } > > > > - return 0; > > + /* > > + * If we haven't found a bus device the user meant to "hotplug" a > > + * virtual device instead. > > + */ > > + ret = rte_vdev_init(name, devargs); > > +out: > > + if (ret) > > + RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", > > + name); > > + return ret; > > +} > > + > > > Regards, > /Bruce On Tue, Jun 27, 2017 at 03:00:58PM +0100, Bruce Richardson wrote: > I'm also not sure about the commit title of this patch. It doesn't > match > my understanding of what the patch does. > > /Bruce I have a few issues with this patch myself. However, to properly fix those, I need the rte_devargs evolutions coming afterward. As an intermediate step, this is good enough to support the current rte_dev attach / detach API and follow the new hotplug API. It makes sense to have it as part of this series, so that the latter is self-contained and internally consistent. But it will evolve. I will rewrite the commit log. -- Gaëtan Rivet 6WIND