]> git.droids-corp.org - dpdk.git/commitdiff
devargs: introduce insert function
authorGaetan Rivet <gaetan.rivet@6wind.com>
Sat, 15 Jul 2017 17:56:37 +0000 (19:56 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 19 Jul 2017 21:40:28 +0000 (00:40 +0300)
Some buses will operate either in whitelist or blacklist mode.
This mode is currently passed down by the rte_eal_devargs_add function
with the devtype argument.

When inserting devices using the hotplug API, the implicit assumption is
that this device is being whitelisted, meaning that it is explicitly
requested by the application to be used. This can conflict with the
initial bus configuration.

While the rte_eal_devargs_add API is being deprecated soon, it cannot
be modified at the moment to accommodate this situation.
As such, this new experimental API offers a bare interface for inserting
rte_devargs without directly manipulating the global rte_devargs list.

This new function expects a fully-formed rte_devargs, previously parsed
and allocated.

It does not check whether the new rte_devargs is compatible with current
bus configuration, but will replace any eventual existing one for the same
device, allowing the hotplug operation to proceed. i.e. a previously
blacklisted device can be redefined as being whitelisted.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
lib/librte_eal/bsdapp/eal/rte_eal_version.map
lib/librte_eal/common/eal_common_devargs.c
lib/librte_eal/common/include/rte_devargs.h
lib/librte_eal/linuxapp/eal/rte_eal_version.map

index 8a4f8588a9923d25b2f367f9b5e31fd2b634086f..f689f0c8fc137f5a88df77c6c65a9c31dfb5471d 100644 (file)
@@ -206,6 +206,7 @@ DPDK_17.08 {
 EXPERIMENTAL {
        global:
 
+       rte_eal_devargs_insert;
        rte_eal_devargs_parse;
        rte_eal_devargs_remove;
        rte_eal_hotplug_add;
index bcdee131e709e2fc6b931b3e8db748be28a0e7f7..ff6c2a87a9942ce0c05c6a10f455a36bfc30a8db 100644 (file)
@@ -138,6 +138,18 @@ rte_eal_devargs_parse(const char *dev, struct rte_devargs *da)
        return 0;
 }
 
+int
+rte_eal_devargs_insert(struct rte_devargs *da)
+{
+       int ret;
+
+       ret = rte_eal_devargs_remove(da->bus->name, da->name);
+       if (ret < 0)
+               return ret;
+       TAILQ_INSERT_TAIL(&devargs_list, da, next);
+       return 0;
+}
+
 /* store a whitelist parameter for later parsing */
 int
 rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
index 36453b6de8827b1f57afa4d3f175922db976a70b..7b63fa3ad3ffe6c6a14913e11dd7d7fc30b1a293 100644 (file)
@@ -138,6 +138,19 @@ int
 rte_eal_devargs_parse(const char *dev,
                      struct rte_devargs *da);
 
+/**
+ * Insert an rte_devargs in the global list.
+ *
+ * @param da
+ *  The devargs structure to insert.
+ *
+ * @return
+ *   - 0 on success
+ *   - Negative on error.
+ */
+int
+rte_eal_devargs_insert(struct rte_devargs *da);
+
 /**
  * Add a device to the user device list
  *
index 9537be25c8b3a4fadaeb355e51496fa18e75ecec..20207218967e033008efaee14deaeaa8c84d32af 100644 (file)
@@ -211,6 +211,7 @@ DPDK_17.08 {
 EXPERIMENTAL {
        global:
 
+       rte_eal_devargs_insert;
        rte_eal_devargs_parse;
        rte_eal_devargs_remove;
        rte_eal_hotplug_add;