This makes the devargs code itself require the rte_devargs type field for properly functioning.
Signed-off-by: Jan Blunck <jblu...@infradead.org> --- lib/librte_eal/common/eal_common_devargs.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 588df1410..38ba64567 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -199,13 +199,28 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) unsigned int rte_eal_devargs_type_count(enum rte_devtype devtype) { + struct rte_bus *pci_bus = rte_bus_find_by_name("pci"); + const char *busname = ""; struct rte_devargs *devargs; unsigned int count = 0; + switch (devtype) { + case RTE_DEVTYPE_WHITELISTED_PCI: + if (pci_bus->conf.scan_mode == RTE_BUS_SCAN_WHITELIST) + busname = "pci"; + break; + case RTE_DEVTYPE_BLACKLISTED_PCI: + if (pci_bus->conf.scan_mode == RTE_BUS_SCAN_BLACKLIST) + busname = "pci"; + break; + case RTE_DEVTYPE_VIRTUAL: + busname = "vdev"; + break; + } + TAILQ_FOREACH(devargs, &devargs_list, next) { - if (devargs->type != devtype) - continue; - count++; + if (strcmp(busname, devargs->busname) == 0) + count++; } return count; } @@ -218,8 +233,7 @@ rte_eal_devargs_dump(FILE *f) fprintf(f, "User device list:\n"); TAILQ_FOREACH(devargs, &devargs_list, next) { - fprintf(f, " [%s]: %s %s\n", - (devargs->bus ? devargs->bus->name : "??"), - devargs->name, devargs->args); + fprintf(f, " [%s]: %s %s\n", devargs->busname, devargs->name, + devargs->args); } } -- 2.13.2