From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shreyansh Jain Subject: Re: [PATCH v5 05/12] eal: add probe and remove support for rte_driver Date: Fri, 6 Jan 2017 17:14:34 +0530 Message-ID: <7af56aaf-b4dc-4933-588d-d0c375d23844@nxp.com> References: <1482756644-13726-1-git-send-email-shreyansh.jain@nxp.com> <1482758645-23057-1-git-send-email-shreyansh.jain@nxp.com> <1482758645-23057-6-git-send-email-shreyansh.jain@nxp.com> <5088350.GnaeIEgOPh@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: , To: Thomas Monjalon Return-path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0065.outbound.protection.outlook.com [104.47.34.65]) by dpdk.org (Postfix) with ESMTP id A9DA82A58 for ; Fri, 6 Jan 2017 12:41:07 +0100 (CET) In-Reply-To: <5088350.GnaeIEgOPh@xps13> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wednesday 04 January 2017 03:35 AM, Thomas Monjalon wrote: > 2016-12-26 18:53, Shreyansh Jain: >> --- a/lib/librte_eal/common/include/rte_dev.h >> +++ b/lib/librte_eal/common/include/rte_dev.h >> @@ -152,6 +162,8 @@ struct rte_driver { >> struct rte_bus *bus; /**< Bus serviced by this driver */ >> const char *name; /**< Driver name. */ >> const char *alias; /**< Driver alias. */ >> + driver_probe_t *probe; /**< Probe the device */ >> + driver_remove_t *remove; /**< Remove/hotplugging the device */ >> }; > > If I understand well, this probe function does neither scan nor match. > So it could be named init. Current model is: After scanning for devices and populating bus->device_list, Bus probe does: `-> bus->match() `-> rte_driver->probe() for matched driver For PCI drivers, '.probe = rte_eal_pci_probe'. For example, igb_ethdev.c: --->8--- static struct eth_driver rte_igb_pmd = { .pci_drv = { .driver = { .probe = rte_eal_pci_probe, .remove = rte_eal_pci_remove, }, ... --->8--- > > I think the probe (init) and remove ops must be specific to the bus. > We can have them in rte_bus, and as an example, the pci implementation > would call the pci probe and remove ops of rte_pci_driver. So, --- After scanning for devices (bus->scan()): Bus probe (rte_eal_bus_probe()): `-> bus->match() `-> bus->init() - a new fn rte_bus_pci_init() -> which calls rte_eal_pci_probe() -> and rte_pci_driver->probe() and remove rte_driver probe and remove callbacks because they are now redundant. (they were added in bus patches itself) --- Is the above correct understanding of your statement? Somehow I don't remember why I didn't do this in first place - it seems to be better option than introducing a rte_driver->probe()/remove() layer. I will change it (and think again why I rejected this idea in first place). Thanks. > > Please use rte_ prefix in public headers. > I am assuming you are referring to driver_probe_t/driver_remove_t.