devargs: introduce insert function
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>
This commit is contained in:
parent
275e70a426
commit
55744d83d5
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user