[dpdk-dev] [PATCH] eal: fix whitelists for hot plug devices
Tomasz Kulasek
tomaszx.kulasek at intel.com
Fri Aug 31 20:42:59 CEST 2018
Currently white/blacklists doesn't work for hotplugged devices.
This patch checks if device is on the blacklist before attempting
to attach it.
Fixes: a3ee360f4440 ("eal: add hotplug add/remove device")
Cc: jblunck at infradead.org
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek at intel.com>
---
lib/librte_eal/common/eal_common_dev.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 678dbca..5f4b600 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -147,6 +147,30 @@ int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devn
return -ENOTSUP;
}
+ /* Check if device is blacklisted */
+ if (bus->conf.scan_mode == RTE_BUS_SCAN_WHITELIST)
+ ret = -EINVAL;
+ else
+ ret = 0;
+
+ da = NULL;
+ do {
+ da = rte_devargs_next(busname, da);
+ if (da != NULL && strcmp(da->name, devname) == 0) {
+ if (da->policy == RTE_DEV_BLACKLISTED)
+ ret = -EINVAL;
+ else
+ ret = 0;
+ break;
+ }
+ } while (da != NULL);
+
+ if (ret) {
+ RTE_LOG(INFO, EAL, " Device is blacklisted (%s)\n",
+ devname);
+ return ret;
+ }
+
da = calloc(1, sizeof(*da));
if (da == NULL)
return -ENOMEM;
--
2.7.4
More information about the dev
mailing list