]> git.droids-corp.org - dpdk.git/commitdiff
eal: replace usage of blacklist/whitelist in enums
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 10 Nov 2020 22:55:38 +0000 (14:55 -0800)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 15 Nov 2020 23:11:22 +0000 (00:11 +0100)
Rename the enum values in the EAL include files.
As a backward compatible temporary migration tool, define
a replacement mapping for old values.

The old names relating to blacklist and whitelist are replaced
by block list and allow list, but applications may be using the
older compatibility macros, marked as deprecated.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Gaetan Rivet <grive@u256.net>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
13 files changed:
doc/guides/rel_notes/deprecation.rst
drivers/bus/dpaa/dpaa_bus.c
drivers/bus/fslmc/fslmc_bus.c
drivers/bus/fslmc/fslmc_vfio.c
drivers/bus/pci/pci_common.c
drivers/bus/vmbus/vmbus_common.c
drivers/crypto/virtio/virtio_pci.c
drivers/net/virtio/virtio_pci.c
lib/librte_eal/common/eal_common_devargs.c
lib/librte_eal/common/eal_common_options.c
lib/librte_eal/include/rte_bus.h
lib/librte_eal/include/rte_dev.h
lib/librte_eal/include/rte_devargs.h

index efb09f0c5e7338cfa251dd3f7077c112cf72d615..8eac0735918943aae5764b6f7c4bf06d67444666 100644 (file)
@@ -30,19 +30,7 @@ Deprecation Notices
 
 * eal: The terms blacklist and whitelist to describe devices used
   by DPDK will be replaced in the 20.11 relase.
-  This will apply to command line arguments as well as macros.
-
-  The macro ``RTE_DEV_BLACKLISTED`` will be replaced with ``RTE_DEV_EXCLUDED``
-  and ``RTE_DEV_WHITELISTED`` will be replaced with ``RTE_DEV_INCLUDED``
-  ``RTE_BUS_SCAN_BLACKLIST`` and ``RTE_BUS_SCAN_WHITELIST`` will be
-  replaced with ``RTE_BUS_SCAN_EXCLUDED`` and ``RTE_BUS_SCAN_INCLUDED``
-  respectively. Likewise ``RTE_DEVTYPE_BLACKLISTED_PCI`` and
-  ``RTE_DEVTYPE_WHITELISTED_PCI`` will be replaced with
-  ``RTE_DEVTYPE_EXCLUDED`` and ``RTE_DEVTYPE_INCLUDED``.
-
-  The old macros will be marked as deprecated in 20.11 and any
-  usage will cause a compile warning. They will be removed in
-  a future release.
+  This will apply to command line arguments.
 
   The command line arguments to ``rte_eal_init`` will change from
   ``-b, --pci-blacklist`` to ``-x, --exclude`` and
index ece6a4c4243a79d7543eba7c8c5b9790194fbcde..3098e230933ceea262730624272785afad7ee168 100644 (file)
@@ -584,7 +584,7 @@ rte_dpaa_bus_probe(void)
        struct rte_dpaa_driver *drv;
        FILE *svr_file = NULL;
        unsigned int svr_ver;
-       int probe_all = rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST;
+       int probe_all = rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
        static int process_once;
 
        /* If DPAA bus is not present nothing needs to be done */
@@ -646,13 +646,12 @@ rte_dpaa_bus_probe(void)
 
                        if (!drv->probe ||
                            (dev->device.devargs &&
-                           dev->device.devargs->policy == RTE_DEV_BLACKLISTED))
+                            dev->device.devargs->policy == RTE_DEV_BLOCKED))
                                continue;
 
                        if (probe_all ||
                            (dev->device.devargs &&
-                           dev->device.devargs->policy ==
-                           RTE_DEV_WHITELISTED)) {
+                            dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
                                ret = drv->probe(drv, dev);
                                if (ret) {
                                        DPAA_BUS_ERR("unable to probe:%s",
index db936696282e8ffb3fa9bdafd185c541d8a94267..58435589b21dc0d66641fe5b473a0e3256fbf6f2 100644 (file)
@@ -420,7 +420,7 @@ rte_fslmc_probe(void)
                return 0;
        }
 
-       probe_all = rte_fslmc_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST;
+       probe_all = rte_fslmc_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
 
        /* In case of PA, the FD addresses returned by qbman APIs are physical
         * addresses, which need conversion into equivalent VA address for
@@ -451,16 +451,15 @@ rte_fslmc_probe(void)
                                continue;
 
                        if (dev->device.devargs &&
-                         dev->device.devargs->policy == RTE_DEV_BLACKLISTED) {
-                               DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
+                           dev->device.devargs->policy == RTE_DEV_BLOCKED) {
+                               DPAA2_BUS_LOG(DEBUG, "%s Blocked, skipping",
                                              dev->device.name);
                                continue;
                        }
 
                        if (probe_all ||
                           (dev->device.devargs &&
-                          dev->device.devargs->policy ==
-                          RTE_DEV_WHITELISTED)) {
+                           dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
                                ret = drv->probe(drv, dev);
                                if (ret) {
                                        DPAA2_BUS_ERR("Unable to probe");
index aba55b46d8da28d851ce5ba62299c768a4873887..b52f36c33e4f2d2fae0e4b64b0fb592d63873db8 100644 (file)
@@ -812,13 +812,13 @@ fslmc_vfio_process_group(void)
                if (dev->dev_type == DPAA2_MPORTAL) {
                        dpmcp_count++;
                        if (dev->device.devargs &&
-                           dev->device.devargs->policy == RTE_DEV_BLACKLISTED)
+                           dev->device.devargs->policy == RTE_DEV_BLOCKED)
                                is_dpmcp_in_blocklist = true;
                }
                if (dev->dev_type == DPAA2_IO) {
                        dpio_count++;
                        if (dev->device.devargs &&
-                           dev->device.devargs->policy == RTE_DEV_BLACKLISTED)
+                           dev->device.devargs->policy == RTE_DEV_BLOCKED)
                                is_dpio_in_blocklist = true;
                }
        }
@@ -829,8 +829,8 @@ fslmc_vfio_process_group(void)
                if (dev->dev_type == DPAA2_MPORTAL) {
                        current_device++;
                        if (dev->device.devargs &&
-                           dev->device.devargs->policy == RTE_DEV_BLACKLISTED) {
-                               DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
+                           dev->device.devargs->policy == RTE_DEV_BLOCKED) {
+                               DPAA2_BUS_LOG(DEBUG, "%s Blocked, skipping",
                                              dev->device.name);
                                TAILQ_REMOVE(&rte_fslmc_bus.device_list,
                                                dev, next);
@@ -876,8 +876,8 @@ fslmc_vfio_process_group(void)
                if (dev->dev_type == DPAA2_IO)
                        current_device++;
                if (dev->device.devargs &&
-                   dev->device.devargs->policy == RTE_DEV_BLACKLISTED) {
-                       DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
+                   dev->device.devargs->policy == RTE_DEV_BLOCKED) {
+                       DPAA2_BUS_LOG(DEBUG, "%s Blocked, skipping",
                                      dev->device.name);
                        TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
                        continue;
index 39eea464b4c030061d66ede07e0df62234284cd1..b24c0697130eeb43b1d8c0fadca771b69ca61443 100644 (file)
@@ -67,9 +67,8 @@ pci_name_set(struct rte_pci_device *dev)
                        dev->name, sizeof(dev->name));
        devargs = pci_devargs_lookup(&dev->addr);
        dev->device.devargs = devargs;
-       /* In blacklist mode, if the device is not blacklisted, no
-        * rte_devargs exists for it.
-        */
+
+       /* If the device is blocked, no rte_devargs exists for it. */
        if (devargs != NULL)
                /* If an rte_devargs exists, the generic rte_device uses the
                 * given name as its name.
@@ -172,7 +171,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 
        loc = &dev->addr;
 
-       /* The device is not blacklisted; Check if driver supports it */
+       /* The device is not blocked; Check if driver supports it */
        if (!rte_pci_match(dr, dev))
                /* Match of device and driver failed */
                return 1;
@@ -181,12 +180,10 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
                        loc->domain, loc->bus, loc->devid, loc->function,
                        dev->device.numa_node);
 
-       /* no initialization when blacklisted, return without error */
+       /* no initialization when marked as blocked, return without error */
        if (dev->device.devargs != NULL &&
-               dev->device.devargs->policy ==
-                       RTE_DEV_BLACKLISTED) {
-               RTE_LOG(INFO, EAL, "  Device is blacklisted, not"
-                       " initializing\n");
+               dev->device.devargs->policy == RTE_DEV_BLOCKED) {
+               RTE_LOG(INFO, EAL, "  Device is blocked, not initializing\n");
                return 1;
        }
 
@@ -629,14 +626,13 @@ rte_pci_ignore_device(const struct rte_pci_addr *pci_addr)
        struct rte_devargs *devargs = pci_devargs_lookup(pci_addr);
 
        switch (rte_pci_bus.bus.conf.scan_mode) {
-       case RTE_BUS_SCAN_WHITELIST:
-               if (devargs && devargs->policy == RTE_DEV_WHITELISTED)
+       case RTE_BUS_SCAN_ALLOWLIST:
+               if (devargs && devargs->policy == RTE_DEV_ALLOWED)
                        return false;
                break;
        case RTE_BUS_SCAN_UNDEFINED:
-       case RTE_BUS_SCAN_BLACKLIST:
-               if (devargs == NULL ||
-                   devargs->policy != RTE_DEV_BLACKLISTED)
+       case RTE_BUS_SCAN_BLOCKLIST:
+               if (devargs == NULL || devargs->policy != RTE_DEV_BLOCKED)
                        return false;
                break;
        }
index 4c9ac33ac6e49ade1670c4b9a788b4cc94828a68..b31678ad056482b199ed3a94e47d195873e20bd4 100644 (file)
@@ -101,7 +101,7 @@ vmbus_probe_one_driver(struct rte_vmbus_driver *dr,
        VMBUS_LOG(INFO, "VMBUS device %s on NUMA socket %i",
                  guid, dev->device.numa_node);
 
-       /* TODO add blacklisted */
+       /* TODO add block/allow logic */
 
        /* map resources for device */
        ret = rte_vmbus_map_device(dev);
@@ -177,7 +177,7 @@ rte_vmbus_probe(void)
 
                rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf));
 
-               /* TODO: add whitelist/blacklist */
+               /* TODO: add allowlist/blocklist */
 
                if (vmbus_probe_all_drivers(dev) < 0) {
                        VMBUS_LOG(NOTICE,
index f490f6e28960988dfaa8bbcba386176f0507f1f7..ae069794a683047863fc39d5ee0b849511c86a4d 100644 (file)
@@ -438,7 +438,7 @@ next:
  * Return -1:
  *   if there is error mapping with VFIO/UIO.
  *   if port map error when driver type is KDRV_NONE.
- *   if whitelisted but driver type is KDRV_UNKNOWN.
+ *   if marked as allowed but driver type is KDRV_UNKNOWN.
  * Return 1 if kernel driver is managing the device.
  * Return 0 on success.
  */
index 9915eabf68b009047b1bbf5ae7afec41800b6166..d6b950ee69259225be5c115594b1604ee1afc7ee 100644 (file)
@@ -682,7 +682,7 @@ next:
  * Return -1:
  *   if there is error mapping with VFIO/UIO.
  *   if port map error when driver type is KDRV_NONE.
- *   if whitelisted but driver type is KDRV_UNKNOWN.
+ *   if marked as allowed but driver type is KDRV_UNKNOWN.
  * Return 1 if kernel driver is managing the device.
  * Return 0 on success.
  */
index 2123773ef8403187ddb5baefd0d7107b49f3b21f..fcf3d9a3ccb20a0bce90a67c131540f95ef77066 100644 (file)
@@ -296,7 +296,7 @@ rte_devargs_insert(struct rte_devargs **da)
        return 0;
 }
 
-/* store a whitelist parameter for later parsing */
+/* store in allowed list parameter for later parsing */
 int
 rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
 {
@@ -313,13 +313,13 @@ rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
                goto fail;
        devargs->type = devtype;
        bus = devargs->bus;
-       if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI)
-               devargs->policy = RTE_DEV_BLACKLISTED;
+       if (devargs->type == RTE_DEVTYPE_BLOCKED)
+               devargs->policy = RTE_DEV_BLOCKED;
        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 (devargs->policy == RTE_DEV_BLACKLISTED)
-                       bus->conf.scan_mode = RTE_BUS_SCAN_BLACKLIST;
+               if (devargs->policy == RTE_DEV_ALLOWED)
+                       bus->conf.scan_mode = RTE_BUS_SCAN_ALLOWLIST;
+               else if (devargs->policy == RTE_DEV_BLOCKED)
+                       bus->conf.scan_mode = RTE_BUS_SCAN_BLOCKLIST;
        }
        TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
        return 0;
index 7b3341683662dc906c4e2137ac5fb34d21b774c6..47b3eb1ccb9a575e09f4db60d886c7863569bd65 100644 (file)
@@ -1455,7 +1455,7 @@ eal_parse_common_option(int opt, const char *optarg,
        case 'b':
                if (w_used)
                        goto bw_used;
-               if (eal_option_device_add(RTE_DEVTYPE_BLACKLISTED_PCI,
+               if (eal_option_device_add(RTE_DEVTYPE_BLOCKED,
                                optarg) < 0) {
                        return -1;
                }
@@ -1465,7 +1465,7 @@ eal_parse_common_option(int opt, const char *optarg,
        case 'w':
                if (b_used)
                        goto bw_used;
-               if (eal_option_device_add(RTE_DEVTYPE_WHITELISTED_PCI,
+               if (eal_option_device_add(RTE_DEVTYPE_ALLOWED,
                                optarg) < 0) {
                        return -1;
                }
index d3034d0edf774570959b4e527bfa70536c37825f..80b154fb982c13072544f4342cbcff265ae4ac69 100644 (file)
@@ -215,10 +215,16 @@ typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
  */
 enum rte_bus_scan_mode {
        RTE_BUS_SCAN_UNDEFINED,
-       RTE_BUS_SCAN_WHITELIST,
-       RTE_BUS_SCAN_BLACKLIST,
+       RTE_BUS_SCAN_ALLOWLIST,
+       RTE_BUS_SCAN_BLOCKLIST,
 };
 
+/* Backwards compatibility will be removed */
+#define RTE_BUS_SCAN_WHITELIST \
+       RTE_DEPRECATED(RTE_BUS_SCAN_WHITELIST) RTE_BUS_SCAN_ALLOWLIST
+#define RTE_BUS_SCAN_BLACKLIST \
+       RTE_DEPRECATED(RTE_BUS_SCAN_BLACKLIST) RTE_BUS_SCAN_BLOCKLIST
+
 /**
  * A structure used to configure bus operations.
  */
index 81905b3ae35f0ec079d420aa09cfb0f18d313a0c..6dd72c11a14a0877ce2948e4064d993a8e8d1370 100644 (file)
@@ -52,10 +52,16 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
  * Device policies.
  */
 enum rte_dev_policy {
-       RTE_DEV_WHITELISTED,
-       RTE_DEV_BLACKLISTED,
+       RTE_DEV_ALLOWED,
+       RTE_DEV_BLOCKED,
 };
 
+/* Backwards compatibility will be removed */
+#define RTE_DEV_WHITELISTED \
+       RTE_DEPRECATED(RTE_DEV_WHITELISTED) RTE_DEV_ALLOWED
+#define RTE_DEV_BLACKLISTED \
+       RTE_DEPRECATED(RTE_DEV_BLACKLISTED) RTE_DEV_BLOCKED
+
 /**
  * A generic memory resource representation.
  */
index 898efa0d667bdcf845eda3b022dd2f5131411b1e..296f19324fae29a4879c2975e2d6c0f9c2333c8c 100644 (file)
@@ -29,11 +29,17 @@ extern "C" {
  * Type of generic device
  */
 enum rte_devtype {
-       RTE_DEVTYPE_WHITELISTED_PCI,
-       RTE_DEVTYPE_BLACKLISTED_PCI,
+       RTE_DEVTYPE_ALLOWED,
+       RTE_DEVTYPE_BLOCKED,
        RTE_DEVTYPE_VIRTUAL,
 };
 
+/* Backwards compatibility will be removed later */
+#define RTE_DEVTYPE_WHITELISTED_PCI \
+       RTE_DEPRECATED(RTE_DEVTYPE_WHITELISTED_PCI) RTE_DEVTYPE_ALLOWED
+#define RTE_DEVTYPE_BLACKLISTED_PCI \
+       RTE_DEPRECATED(RTE_DEVTYPE_BLACKLISTED_PCI) RTE_DEVTYPE_BLOCKED
+
 /**
  * Structure that stores a device given by the user with its arguments
  *