From b631f3b0f24276855c2e6e9ef9dc7c2292a1ccd8 Mon Sep 17 00:00:00 2001 From: Gaetan Rivet Date: Wed, 2 Aug 2017 19:12:07 +0200 Subject: [PATCH] devargs: fix policy check when adding arguments Do not fail upon detecting a set bus configuration when adding an rte_devargs. i.e. adding a blacklisted PCI device while the bus is configured in whitelist mode. This failure condition has been introduced when the bus policies were implemented. This implementation however was meant to strictly follow the existing API. This check was not and should not be performed until the current API has been properly deprecated. The same kind of check is already done when parsing EAL options. Fixes: 02823c1db0bc ("devargs: parse bus policies") Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_devargs.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 33e9f0a935..6ac88d6ab7 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -170,22 +170,12 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) bus = devargs->bus; if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) devargs->policy = RTE_DEV_BLACKLISTED; - if (devargs->policy == RTE_DEV_WHITELISTED) { - if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) { + if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) { + if (devargs->policy == RTE_DEV_WHITELISTED) bus->conf.scan_mode = RTE_BUS_SCAN_WHITELIST; - } else if (bus->conf.scan_mode == RTE_BUS_SCAN_BLACKLIST) { - fprintf(stderr, "ERROR: incompatible device policy and bus scan mode\n"); - goto fail; - } - } else if (devargs->policy == RTE_DEV_BLACKLISTED) { - if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) { + else if (devargs->policy == RTE_DEV_BLACKLISTED) bus->conf.scan_mode = RTE_BUS_SCAN_BLACKLIST; - } else if (bus->conf.scan_mode == RTE_BUS_SCAN_WHITELIST) { - fprintf(stderr, "ERROR: incompatible device policy and bus scan mode\n"); - goto fail; - } } - TAILQ_INSERT_TAIL(&devargs_list, devargs, next); return 0; -- 2.20.1