[dpdk-dev] [RFC] eal: simplify parameters of hotplug functions

Thomas Monjalon thomas at monjalon.net
Sat Sep 8 00:27:27 CEST 2018


All informations about a device to probe can be grouped
in a common string, which is what we usually call devargs.
That's why the bus name and device name can be removed from
rte_eal_hotplug_add().

When removing a device, we already know its rte_device handle
which can be directly passed as parameter of rte_eal_hotplug_remove().
If the rte_device is not known, it can be retrieved from the devargs,
thanks to RTE_DEV_FOREACH().

Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
---
This patch contains only the change in the API as RFC.

This idea was presented at Dublin during the "hotplug talk".
---
 lib/librte_eal/common/include/rte_dev.h | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index b80a80598..2f4212d01 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -194,18 +194,12 @@ int rte_eal_dev_detach(struct rte_device *dev);
  *
  * Hotplug add a given device to a specific bus.
  *
- * @param busname
- *   The bus name the device is added to.
- * @param devname
- *   The device name. Based on this device name, eal will identify a driver
- *   capable of handling it and pass it to the driver probing function.
  * @param devargs
- *   Device arguments to be passed to the driver.
+ *   Device arguments including bus, class and driver properties
  * @return
  *   0 on success, negative on error.
  */
-int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devname,
-			const char *devargs);
+int __rte_experimental rte_eal_hotplug_add(const char *devargs);
 
 /**
  * @warning
@@ -213,15 +207,12 @@ int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devn
  *
  * Hotplug remove a given device from a specific bus.
  *
- * @param busname
- *   The bus name the device is removed from.
- * @param devname
- *   The device name being removed.
+ * @param dev
+ *   Data structure of the device to remove
  * @return
  *   0 on success, negative on error.
  */
-int __rte_experimental rte_eal_hotplug_remove(const char *busname,
-					  const char *devname);
+int __rte_experimental rte_eal_hotplug_remove(struct rte_device *dev);
 
 /**
  * Device comparison function.
-- 
2.18.0



More information about the dev mailing list