#include <stdio.h>
#include <string.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_tailq.h>
#include "eal_private.h"
goto fail;
devargs->type = devtype;
bus = devargs->bus;
- if (devargs->type == RTE_DEVTYPE_WHITELISTED) {
+ 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) {
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");
+ fprintf(stderr, "ERROR: incompatible device policy and bus scan mode\n");
goto fail;
}
- } else if (devargs->type == RTE_DEVTYPE_BLACKLISTED) {
+ } else if (devargs->policy == RTE_DEV_BLACKLISTED) {
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");
+ fprintf(stderr, "ERROR: incompatible device policy and bus scan mode\n");
goto fail;
}
}
switch (opt) {
/* blacklist */
case 'b':
- if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED,
+ if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI,
optarg) < 0) {
return -1;
}
break;
/* whitelist */
case 'w':
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED,
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI,
optarg) < 0) {
return -1;
}
break;
case OPT_VDEV_NUM:
- if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED,
+ if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL,
optarg) < 0) {
return -1;
}
return -1;
}
+ if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 0 &&
+ rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 0) {
+ RTE_LOG(ERR, EAL, "Options blacklist (-b) and whitelist (-w) "
+ "cannot be used at the same time\n");
+ return -1;
+ }
+
return 0;
}
/* no initialization when blacklisted, return without error */
if (dev->device.devargs != NULL &&
- dev->device.devargs->type ==
- RTE_DEVTYPE_BLACKLISTED) {
+ dev->device.devargs->policy ==
+ RTE_DEV_BLACKLISTED) {
RTE_LOG(INFO, EAL, " Device is blacklisted, not"
" initializing\n");
return 1;
if (probe_all)
ret = pci_probe_all_drivers(dev);
else if (devargs != NULL &&
- devargs->type == RTE_DEVTYPE_WHITELISTED)
+ devargs->policy == RTE_DEV_WHITELISTED)
ret = pci_probe_all_drivers(dev);
if (ret < 0) {
RTE_LOG(ERR, EAL, "Requested device " PCI_PRI_FMT
TAILQ_INIT(&devargs_list);
/* test valid cases */
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "08:00.1") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "08:00.1") < 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "0000:5:00.0") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "0000:5:00.0") < 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "04:00.0,arg=val") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "04:00.0,arg=val") < 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "0000:01:00.1") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "0000:01:00.1") < 0)
goto fail;
- if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED) != 4)
+ if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 2)
goto fail;
- if (rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED) != 0)
+ if (rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 2)
goto fail;
- if (rte_eal_devargs_type_count(RTE_DEVTYPE_UNDEFINED) != 0)
+ if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED, "net_ring0") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring0") < 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED,
- "net_ring1,key=val,k2=val2") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring1,key=val,k2=val2") < 0)
goto fail;
- if (rte_eal_devargs_type_count(RTE_DEVTYPE_UNDEFINED) != 2)
+ if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 2)
goto fail;
free_devargs_list();
/* check virtual device with argument parsing */
- if (rte_eal_devargs_add(RTE_DEVTYPE_UNDEFINED,
- "net_ring1,k1=val,k2=val2") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring1,k1=val,k2=val2") < 0)
goto fail;
devargs = TAILQ_FIRST(&devargs_list);
if (strncmp(devargs->name, "net_ring1",
free_devargs_list();
/* check PCI device with empty argument parsing */
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "04:00.1") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "04:00.1") < 0)
goto fail;
devargs = TAILQ_FIRST(&devargs_list);
if (strcmp(devargs->name, "04:00.1") != 0)
free_devargs_list();
/* test error case: bad PCI address */
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "08:1") == 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "08:1") == 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "00.1") == 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "00.1") == 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "foo") == 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "foo") == 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, ",") == 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, ",") == 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED, "000f:0:0") == 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "000f:0:0") == 0)
goto fail;
devargs_list = save_devargs_list;