From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v11 12/13] pci: use bus driver for attach/detach Date: Wed, 15 Feb 2017 12:26:08 +0100 Message-ID: <4461200.YtTWm2ltHQ@xps13> References: <1484748329-5418-1-git-send-email-shreyansh.jain@nxp.com> <1484801117-779-13-git-send-email-thomas.monjalon@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: Shreyansh Jain , dev@dpdk.org To: Jan Blunck Return-path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id 827DC37B0 for ; Wed, 15 Feb 2017 12:26:10 +0100 (CET) Received: by mail-wr0-f178.google.com with SMTP id c4so30903106wrd.2 for ; Wed, 15 Feb 2017 03:26:10 -0800 (PST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2017-02-15 12:08, Jan Blunck: > > int rte_eal_dev_attach(const char *name, const char *devargs) > > { > > - struct rte_pci_addr addr; > > + int ret = 1; > > + struct rte_bus *bus; > > > > 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_eal_pci_probe_one(&addr) < 0) > > + FOREACH_BUS(bus) { > > + if (!bus->attach) { > > + RTE_LOG(DEBUG, EAL, "Bus (%s) doesn't implement" > > + " attach.\n", bus->name); > > + continue; > > + } > > + ret = bus->attach(name); > > Enforcing a globally unique naming scheme for the low-level device > makes this complicated for users. There are buses that enumerate the > devices just by an integer so we will have conflicts. > > I think it is better to change the signature of rte_eal_dev_attach() > instead and find the correct bus based on its name. Also I believe the > API is more user friendly if we pass the complete (raw) devargs string > instead of the name/args pair. I thought we could have a bus prefix in the name so there is no conflict. How do you imagine the full devargs? > > + if (!ret) /* device successfully attached */ > > + return ret; > > + if (ret > 0) /* device not found on bus */ > > + continue; > > + else > > goto err; > > + } >