Message ID | 1482758645-23057-6-git-send-email-shreyansh.jain@nxp.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id F1E97F929; Mon, 26 Dec 2016 14:21:41 +0100 (CET) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0065.outbound.protection.outlook.com [104.47.33.65]) by dpdk.org (Postfix) with ESMTP id 4F54CF614 for <dev@dpdk.org>; Mon, 26 Dec 2016 14:21:24 +0100 (CET) Received: from DM2PR03CA0035.namprd03.prod.outlook.com (10.141.96.34) by MWHPR03MB2477.namprd03.prod.outlook.com (10.169.200.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Mon, 26 Dec 2016 13:21:23 +0000 Received: from BN1AFFO11FD041.protection.gbl (2a01:111:f400:7c10::138) by DM2PR03CA0035.outlook.office365.com (2a01:111:e400:2428::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11 via Frontend Transport; Mon, 26 Dec 2016 13:21:23 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD041.mail.protection.outlook.com (10.58.52.252) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Mon, 26 Dec 2016 13:21:22 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBQDKVCV029786; Mon, 26 Dec 2016 06:21:19 -0700 From: Shreyansh Jain <shreyansh.jain@nxp.com> To: <david.marchand@6wind.com> CC: <dev@dpdk.org>, <thomas.monjalon@6wind.com>, Shreyansh Jain <shreyansh.jain@nxp.com> Date: Mon, 26 Dec 2016 18:53:58 +0530 Message-ID: <1482758645-23057-6-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482758645-23057-1-git-send-email-shreyansh.jain@nxp.com> References: <1482756644-13726-1-git-send-email-shreyansh.jain@nxp.com> <1482758645-23057-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131272320829315542; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(336005)(39860400002)(39380400002)(39850400002)(39400400002)(39450400003)(39410400002)(39840400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(4326007)(626004)(97736004)(69596002)(5660300001)(2906002)(92566002)(8936002)(50226002)(104016004)(189998001)(50986999)(76176999)(50466002)(356003)(305945005)(48376002)(81156014)(81166006)(8676002)(110136003)(68736007)(47776003)(85426001)(106466001)(36756003)(38730400001)(2351001)(77096006)(8656002)(105606002)(6666003)(33646002)(6916009)(86362001)(5003940100001)(2950100002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2477; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD041; 1:6q99fushe0xqhBDgquYJ340YFj6sJb+Ut129vMjh75kqakmFK/yKk3Y4kkW9n5lJxc7LsSD/65Tv04K2Ll7+Teg3U6H8lnxclpXn0rw5PFiVZuqvzith7Kl0tblg2WVKQJ4yzU2sPORjs3+vQxl3ucFjcTzSoT3Zi0c/TJJRixSb6EwE6KIFSEhyOzDQ2wJu0+gFO125kQIyqLMYB6oMsGe55LkXHZ0dRD8fXtFF68yNblvyYniFq6hHHhR8YdXnVz375jJEuXsA19IOfLybpShsi4kK4GTEuwL1eWzQpnO+hO/+rQk0yHTFHU4YkN/LpslZCyVkrIrzB/3Nsh/OV6Z9TCT8vEHJXkRDK6jDV7VBZj2xcN+YE/BmyytpEJtPXSSQS/A3HcyPtMkxO2MGLkIe4VRpxJVUo3agnipiMwRkdtZ0UvzmirtW4hhVayeb2Ljkqtv7YGmw9hq4Y2gXvNx/YglGlkssY4rXEVmHNbSptANf6rX4+LRvuNODCdDGGrpdlnuFm2r4tsi/iotVbIozWyx0PlkJU0WepprRi5sWqMUov6/NvTvTsDZLNI0UmFrJeAQu3k8BfCBivbAM+gfkuJCRkWXyHikpBVZCi60P+OPe5Dnye26W3E1KgI+OVKokWfyBEDbAYehRWMHHaEi32G7MnNucNA7AerXeC8Vvnk44itataQzcmP5byNadKo+kiLZY9ppPhRjw5lg52otueWetqll9b9wqUK/1yCY= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: c9faba25-5143-462b-ed88-08d42d921640 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 3:gFcam+iRr3vVIKT1/OqxmKxF1gdNRKXKxAzy3Q4UJctOFbZkG9NbIAW9T53mGDsPcKrnU1Db+dztUGwvewDmNJ94yCLAHumll9kvjqqT0zWp9FBYbr7A9M+DzOWHu2Bv9ecTNjlz9N61Q+YaHa4AM+w5UgmX1Db1OglxKEDU+73+vp0U9jD7ieRhIYW1n+XAl06dTkvPR8+O9LqB+CqUEeK4dVCZ8JkGaDBI1iiKG2Paw/IDZ/9IVs95/LA8tbvOO3tbQ8v6ibCrWAXaXIVwV8p723caVuQvnwI+ShCN3b0goDmYqeJvE3z45DSk4y6RVKe6AShXrG/ggtzzw7juCq2steevtlmXvYJ9YzFUS7vF4F5D2aW9jR//CIhMDlBn; 25:7Ib+0kWqsNxVmYlKBGOeHWAFzCLx6K5c4qZR0yXCljsFDMInMxbHt1vf4ctekxtMKN7U2BvrBc1TG51ACFjXpFBqhPHguQYKekWTCmp1ETj+qLVJZD23W3uYE/Qbaxfr5nOJvZe14tqi6DzJis6xpI08gDraK65UwPz5cXAd20ksITAeEJz2sQzvUjsCNFipjvVjBMMYefLrXYdeZ0Nq/YVhWCqJc8LCTnsVD+tTzdZKE7GDtWGn+13avVD6SoQz/g/f+ERc6fvhxbNCVk6WAly5PZH0syM2goAJSU5+76o4NYsFBGaLhWP+0J+ZGIbC684qy2jlcNzsLAGW5iJTBquGtxbhCdJcIiB2xVcfv96U4B12zGQUQ07FRg1JRtqIbhcxpbaZJZSL940e9IHeQGGSZYUXfKR9JGqkf/aKXI91hmedABcgDX0PD1No5uGtwMbCP71Pk5WbLkghf9+2xQ== X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 31:ZWuyhOFxmfwrtwDh+Z40B2XdcEHUNJx6EwqkyuXhwu21dC4gpudJ7sgtmV4B2uYhoj2tOm2aXKAzDFPOueodZyc72IWZrgetjiilKrMdD8AH5UvIuHdfcwz2px38zcWvxbe+rTERtElI+mkrbG1aMTj/ksDMIyPAellpAUqvq2jBKFWXAI0GbO2Bn4L/CKu+KXXm0oqBW7HszWt7VZe9sNbtyuK8UgR1twXSWUWB+2QNP+LTZzQXvEHFUO6UdOnoBWIvxY9pabaaDyWb0e9j0w== X-Microsoft-Antispam-PRVS: <MWHPR03MB2477944CE9960D40986FC45090960@MWHPR03MB2477.namprd03.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:MWHPR03MB2477; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 4:haQcPHxdsYoVRDgw0rD+OoBn4cWvfRw0uGKYR0WN3TzfHNux05Hpidqj+HcpljKWJ0F0C2yjMaQ2ObWSAujy8r9/7MW9C1IwBoXt0G9Q6z926qDYU7TTA09MezLXeqZVv6C6sP1jYSwuTMU1rSZyC5c6VEbUCrWOkghzZTZ9y2OC5PGxHNvHp+t12/sOHiDxxvzz+k7yEivKxtZ3lXkktVFVc1sdfUXg/b68zJOZEFLq1ibnNvAFNJWP3e+dEZXXn6mI1eKb1wY/QshOXvCNg9E0NrvznaIkR0b/cv35ZM4qIPubfuFXCO6/61U0tgtHLwubcf73FPCN9F5bnv7y72FdTsj1zrL7RixD1hz0DebOS23A7NQO1K456zA3+cunIPadnjJibm5iqMri/lKRwlAPwxqrMst37n9qJpFAg1RGhGY8E2M78guWmb1TWurdRDl3P27w5kfOjXwbZYHOZEPYhVz3YhMfBA91E1sPBeNZfL1TLwAlY9vk7dscKC+Ii8faPJltHpTHl47U4cdPK32y+pDiXgp0U1tHR9WXCBbvRps0dKrLQjx2f+eCk4d5xW7HvlGFShlGW/8WIN3BjNnizQpbNeJcbgD4OHYH0HKcC88eOCkSoFQ34GjhKV4urca2tMDiuhKsummBogxSq2KBIaUPwnynPDbTpmQdozU/mbuqJ87T/L2vPu7qbx5mmRzAkA/peT9ybiQ/8cX0KjaMgd9oLiJz1J6IHFziYBYg6o2/OpQXNcfSSzlTBPx7 X-Forefront-PRVS: 016885DD9B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2477; 23:JCDzglQVVoJHSuJQ3GbGeayL9E/JYip5LmJ4EhawC?= y1wEpJaMRMlSmIDQO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nEo94WLCjb2mT0V5F3C9LZpt3q3Q27bCMTPoukSn/TO8N59dJ3H4h4Wx4mxroM4wCS/UU2x8sBRf7ubYkxeEuDWIF1XccKi/RZ+u2mLqi4w2cHgl0i2hZC0I61/Sh8eXd+FgENtoSDLM+K439JzPHs0cDBnxqZprO83IqfSfok0TXEU+QpzIYKP/Ne+gHWicohw51E1rXDwLvByGotSb3WIHyOJmE90mOVy6FjeOplI6LJDFf7HB9P72lst4uvOKAm1/FtXvkqaaQe1IeUHZOskN2x6sLmcZIOPSvuUBPaQ3nllWEhczBuC9cY8GhCIhXVPdrtGLw6b/kCYqgtoIwhQevXHlJ3uooCtJOZD7fyZXHkGHfxXkG7X0hbxg4cQdtuyNuHU1nWmOqHGw5q/y3Ie266mLN04HGd8/F1eQJ1wMqFnIHa9V/nIrPVRoxK4VK7dFTw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2016 13:21:22.5415 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2477 Subject: [dpdk-dev] [PATCH v5 05/12] eal: add probe and remove support for rte_driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
ci/Intel compilation | success | Compilation OK |
Commit Message
Shreyansh Jain
Dec. 26, 2016, 1:23 p.m. UTC
rte_driver now supports probe and remove. These would be used for generic
device type (PCI, etc) probe and remove.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_dev.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
Comments
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. 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. Please use rte_ prefix in public headers.
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.
2017-01-06 17:14, Shreyansh Jain: > 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--- Yes I'm just having some doubts about the naming "probe" compared to "init". And yes I know I was advocating to unify naming to "probe" recently :) I would like to be sure it is not confusing for anyone. Do you agree that "init" refers to global driver initialization and "probe" refers to instantiating a device? If yes, the comment could be changed from "Probe the device" to "Check and instantiate a device". > > 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. I do not understand clearly what I was saying here :/ > So, > --- > After scanning for devices (bus->scan()): > Bus probe (rte_eal_bus_probe()): > `-> bus->match() > `-> bus->init() - a new fn rte_bus_pci_init() I suggest the naming bus->probe(). It is currently implemented in rte_eal_pci_probe_one_driver(). > -> which calls rte_eal_pci_probe() Not needed here, this function is converted into the PCI match function. > -> and rte_pci_driver->probe() Yes, bus->probe() makes some processing and calls 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? I think we just need to move probe/remove in rte_pci_driver. > 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. Thanks
On Friday 06 January 2017 08:56 PM, Thomas Monjalon wrote: > 2017-01-06 17:14, Shreyansh Jain: >> 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--- > > Yes > I'm just having some doubts about the naming "probe" compared to "init". > And yes I know I was advocating to unify naming to "probe" recently :) > I would like to be sure it is not confusing for anyone. > Do you agree that "init" refers to global driver initialization and > "probe" refers to instantiating a device? Ok. Makes sense as a standardized way of differentiating 'init' from 'probe'. > > If yes, the comment could be changed from "Probe the device" to > "Check and instantiate a device". Now that probe if removed from rte_driver, I think this would no longer be valid. [1] [1] http://dpdk.org/ml/archives/dev/2017-January/054140.html > >>> 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. > > I do not understand clearly what I was saying here :/ :) > >> So, >> --- >> After scanning for devices (bus->scan()): >> Bus probe (rte_eal_bus_probe()): >> `-> bus->match() >> `-> bus->init() - a new fn rte_bus_pci_init() > > I suggest the naming bus->probe(). > It is currently implemented in rte_eal_pci_probe_one_driver(). > >> -> which calls rte_eal_pci_probe() > > Not needed here, this function is converted into the PCI match function. > >> -> and rte_pci_driver->probe() > > Yes, bus->probe() makes some processing and calls rte_pci_driver->probe(). I have made some changes on similar lines. Will share them soon. Then we can discuss again. > > >> 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? > > I think we just need to move probe/remove in rte_pci_driver. > >> 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. > > Thanks >
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 8ac09e0..3a3dc9b 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -145,6 +145,16 @@ void rte_eal_device_insert(struct rte_device *dev); void rte_eal_device_remove(struct rte_device *dev); /** + * Initialisation function for the driver called during probing. + */ +typedef int (driver_probe_t)(struct rte_driver *, struct rte_device *); + +/** + * Uninitialisation function for the driver called during hotplugging. + */ +typedef int (driver_remove_t)(struct rte_device *); + +/** * A structure describing a device driver. */ struct rte_driver { @@ -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 */ }; /**