From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v7 14/15] dev: use new hotplug API in attach / detach Date: Thu, 29 Jun 2017 23:05:00 +0200 Message-ID: <2309847.WUWjzkZ3SS@xps> References: <20170629182206.1072-1-jblunck@infradead.org> <20170629182206.1072-15-jblunck@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, gaetan.rivet@6wind.com, shreyansh.jain@nxp.com To: Jan Blunck Return-path: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id E4A88271 for ; Thu, 29 Jun 2017 23:05:01 +0200 (CEST) In-Reply-To: <20170629182206.1072-15-jblunck@infradead.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 29/06/2017 20:22, Jan Blunck: > Using the new generic API allows attach and detach to be backwards > compatible while decoupling from the concrete bus implementations. > > Signed-off-by: Jan Blunck > --- > int rte_eal_dev_attach(const char *name, const char *devargs) > { > - struct rte_pci_addr addr; > + 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; > + ret = rte_eal_hotplug_add("PCI", name, devargs); > + if (ret && ret != -EINVAL) > + return ret; > > - } else { > - if (rte_vdev_init(name, devargs)) > - goto err; > - } > + /* > + * If we haven't found a bus device the user meant to "hotplug" a > + * virtual device instead. > + */ > + ret = rte_vdev_init(name, devargs); > + if (ret) > + RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", > + name); > + return ret; > +} I really don't like this function. It is not really decoupled from the buses (cf "PCI" and rte_vdev_init). However I think it is acceptable if it is explictly deprecated and kept only for the legacy rte_eth_dev_attach() function.