devargs: parse bus policies
authorGaetan Rivet <gaetan.rivet@6wind.com>
Fri, 7 Jul 2017 00:04:29 +0000 (02:04 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Sat, 8 Jul 2017 22:08:58 +0000 (00:08 +0200)
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
lib/librte_eal/common/eal_common_devargs.c

index 2e97d79..0465cf6 100644 (file)
@@ -140,6 +140,21 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
 
                break;
        }
+       if (devargs->type == RTE_DEVTYPE_WHITELISTED_PCI) {
+               if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+                       bus->conf.scan_mode = RTE_BUS_SCAN_WHITELIST;
+               } else if (bus->conf.scan_mode == RTE_BUS_SCAN_BLACKLIST) {
+                       fprintf(stderr, "ERROR: incompatible device type and bus scan mode\n");
+                       goto fail;
+               }
+       } else if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) {
+               if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+                       bus->conf.scan_mode = RTE_BUS_SCAN_BLACKLIST;
+               } else if (bus->conf.scan_mode == RTE_BUS_SCAN_WHITELIST) {
+                       fprintf(stderr, "ERROR: incompatible device type and bus scan mode\n");
+                       goto fail;
+               }
+       }
 
        free(dev);
        TAILQ_INSERT_TAIL(&devargs_list, devargs, next);