DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Gaëtan Rivet" <grive@u256.net>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 4/9] eal: replace usage of blacklist/whitelist in enum
Date: Mon, 8 Jun 2020 00:48:40 +0200	[thread overview]
Message-ID: <20200607224840.ffek2eqqr75yblea@u256.net> (raw)
In-Reply-To: <20200607170127.15694-5-stephen@networkplumber.org>

Hi,

On 07/06/20 10:01 -0700, Stephen Hemminger wrote:
> This patch renames the enum values in the EAL include files.
> As a backward compatiable temporary migration tool, define
> a replacement mapping for old values.
> 
> The old names relating to blacklist and whitelist are replaced
> by blocklist and allowlist, but applications may be using the
> older compatiablity macros. To help with conversion to new names
> cause a message when the compatabilty names are used.
> 
> This will be upgraded to a warning in the future.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/librte_eal/common/eal_common_devargs.c | 14 +++++++-------
>  lib/librte_eal/include/rte_bus.h           | 12 ++++++++++--
>  lib/librte_eal/include/rte_dev.h           | 12 ++++++++++--
>  lib/librte_eal/include/rte_devargs.h       | 12 ++++++++++--
>  4 files changed, 37 insertions(+), 13 deletions(-)
> 
> diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
> index 2123773ef840..f5e09df267f2 100644
> --- a/lib/librte_eal/common/eal_common_devargs.c
> +++ b/lib/librte_eal/common/eal_common_devargs.c
> @@ -296,7 +296,7 @@ rte_devargs_insert(struct rte_devargs **da)
>  	return 0;
>  }
>  
> -/* store a whitelist parameter for later parsing */
> +/* store a allowlist parameter for later parsing */

a -> an

>  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_BLOCKLIST_PCI)
> +		devargs->policy = RTE_DEV_BLOCKLIST;
>  	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_ALLOWLIST)
> +			bus->conf.scan_mode = RTE_BUS_SCAN_ALLOWLIST;
> +		else if (devargs->policy == RTE_DEV_BLOCKLIST)
> +			bus->conf.scan_mode = RTE_BUS_SCAN_BLOCKLIST;
>  	}
>  	TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
>  	return 0;
> diff --git a/lib/librte_eal/include/rte_bus.h b/lib/librte_eal/include/rte_bus.h
> index d3034d0edf77..fcc18a118f44 100644
> --- a/lib/librte_eal/include/rte_bus.h
> +++ b/lib/librte_eal/include/rte_bus.h
> @@ -215,10 +215,18 @@ 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,
>  };
>  
> +#define RTE_BUS_SCAN_WHITELIST  \
> +	_Pragma("GCC message \"RTE_BUS_SCAN_WHITELIST\" is deprecated\"") \
> +	RTE_BUS_SCAN_ALLOWLIST
> +
> +#define RTE_BUS_SCAN_BLACKLIST	\
> +	_Pragma("GCC message \"RTE_BUS_SCAN_BLACKLIST\" is deprecated\"") \
> +	RTE_BUS_SCAN_BLOCKLIST
> +
>  /**
>   * A structure used to configure bus operations.
>   */
> diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
> index c8d985fb5cf9..e9184c4a98c1 100644
> --- a/lib/librte_eal/include/rte_dev.h
> +++ b/lib/librte_eal/include/rte_dev.h
> @@ -70,10 +70,18 @@ enum rte_kernel_driver {
>   * Device policies.
>   */
>  enum rte_dev_policy {
> -	RTE_DEV_WHITELISTED,
> -	RTE_DEV_BLACKLISTED,
> +	RTE_DEV_ALLOWLIST,
> +	RTE_DEV_BLOCKLIST,

BLACKLISTED and WHITELISTED were a little contrived to begin with.
The enum was intended to describe the device status.

I think it would be more readable to use RTE_DEV_{BLOCKED,ALLOWED}.

RTE_BUS_SCAN_{BLOCKLIST,ALLOWLIST} is fine.

>  };
>  
> +#define RTE_DEV_WHITELISTED \
> +	_Pragma("GCC message \"'RTE_DEV_WHITELISTED' is deprecated\"") \
> +	RTE_DEV_ALLOWLIST
> +
> +#define RTE_DEV_BLACKLISTED \
> +	_Pragma("GCC message \"'RTE_DEV_BLACKLISTED' is deprecated\"") \
> +	RTE_DEV_BLOCKLIST
> +
>  /**
>   * A generic memory resource representation.
>   */
> diff --git a/lib/librte_eal/include/rte_devargs.h b/lib/librte_eal/include/rte_devargs.h
> index 898efa0d667b..a7c7e1e7962f 100644
> --- a/lib/librte_eal/include/rte_devargs.h
> +++ b/lib/librte_eal/include/rte_devargs.h
> @@ -29,11 +29,19 @@ extern "C" {
>   * Type of generic device
>   */
>  enum rte_devtype {
> -	RTE_DEVTYPE_WHITELISTED_PCI,
> -	RTE_DEVTYPE_BLACKLISTED_PCI,
> +	RTE_DEVTYPE_ALLOWLIST_PCI,
> +	RTE_DEVTYPE_BLOCKLIST_PCI,
>  	RTE_DEVTYPE_VIRTUAL,

I'm ignoring this part, naming will not be aligned on the dev policy,
but this enum is meant to disappear anyway.

>  };
>  
> +#define RTE_DEVTYPE_WHITELISTED_PCI \
> +	_Pragma("GCC message \"'RTE_DEVTYPE_WHITELISTED' is deprecated\"") \
> +	RTE_DEVTYPE_ALLOWLIST_PCI
> +
> +#define RTE_DEVTYPE_BLACKLISTED_PCI \
> +	_Pragma("GCC message \"'RTE_DEVTYPE_BLACKLISTED' is deprecated\"") \
> +	RTE_DEVTYPE_BLOCKLIST_PCI
> +
>  /**
>   * Structure that stores a device given by the user with its arguments
>   *
> -- 
> 2.26.2
> 

-- 
Gaëtan

  reply	other threads:[~2020-06-07 22:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-07 17:01 [dpdk-dev] [PATCH 0/9] Rename blacklist/whitelist to blocklist/allowlist Stephen Hemminger
2020-06-07 17:01 ` [dpdk-dev] [PATCH 1/9] rte_ethdev: change comment to rte_dev_eth_mac_addr_add Stephen Hemminger
2020-06-07 17:01 ` [dpdk-dev] [PATCH 2/9] mk: replace reference to blacklist/whitelist Stephen Hemminger
2020-06-07 17:01 ` [dpdk-dev] [PATCH 3/9] check_maintainers: change variable names Stephen Hemminger
2020-06-07 17:01 ` [dpdk-dev] [PATCH 4/9] eal: replace usage of blacklist/whitelist in enum Stephen Hemminger
2020-06-07 22:48   ` Gaëtan Rivet [this message]
2020-06-07 17:01 ` [dpdk-dev] [PATCH 5/9] drivers: replace references to blacklist Stephen Hemminger
2020-06-07 17:01 ` [dpdk-dev] [PATCH 6/9] eal: replace pci-whitelist/pci-blacklist options Stephen Hemminger
2020-06-08  9:30   ` Bruce Richardson
2020-06-07 17:01 ` [dpdk-dev] [PATCH 7/9] doc: replace references to blacklist/whitelist Stephen Hemminger
2020-06-07 17:01 ` [dpdk-dev] [PATCH 8/9] app/test: use new allowlist and blocklist Stephen Hemminger
2020-06-07 17:01 ` [dpdk-dev] [PATCH 9/9] doc: add note about blacklist/whitelist changes Stephen Hemminger
2020-06-08  8:35 ` [dpdk-dev] [PATCH 0/9] Rename blacklist/whitelist to blocklist/allowlist Luca Boccassi
2020-06-08 19:25 ` [dpdk-dev] [PATCH v2 00/10] Rename blacklist/whitelist to Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 01/10] rte_ethdev: change comment to rte_dev_eth_mac_addr_add Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 02/10] mk: replace reference to blacklist/whitelist Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 03/10] check_maintainers: change variable names Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 04/10] eal: replace usage of blacklist/whitelist in enum Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 05/10] drivers: replace references to blacklist Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 06/10] eal: replace pci-whitelist/pci-blacklist options Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 07/10] doc: replace references to blacklist/whitelist Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 08/10] app/test: use new allowlist and blocklist Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 09/10] doc: add note about blacklist/whitelist changes Stephen Hemminger
2020-06-08 19:25   ` [dpdk-dev] [PATCH v2 10/10] eal: mark old macros for blacklist/whitelist as deprecated Stephen Hemminger
2020-06-09  9:37   ` [dpdk-dev] [PATCH v2 00/10] Rename blacklist/whitelist to Luca Boccassi
2020-07-15 23:02 ` [dpdk-dev] [PATCH v5 0/9] rename blacklist/whitelist to exclude/include Stephen Hemminger
2020-07-15 23:02   ` [dpdk-dev] [PATCH v5 1/9] rte_ethdev: change comment to rte_dev_eth_mac_addr_add Stephen Hemminger
2020-07-15 23:02   ` [dpdk-dev] [PATCH v5 2/9] mk: replace reference to blacklist/whitelist Stephen Hemminger
2020-07-15 23:02   ` [dpdk-dev] [PATCH v5 3/9] check_maintainers: change variable names Stephen Hemminger
2020-07-15 23:02   ` [dpdk-dev] [PATCH v5 4/9] eal: replace usage of blacklist/whitelist in enum Stephen Hemminger
2020-07-15 23:02   ` [dpdk-dev] [PATCH v5 5/9] drivers: replace references to blacklist Stephen Hemminger
2020-07-15 23:02   ` [dpdk-dev] [PATCH v5 6/9] eal: replace pci-whitelist/pci-blacklist options Stephen Hemminger
2020-07-15 23:02   ` [dpdk-dev] [PATCH v5 7/9] app/test: use new allowlist and blocklist Stephen Hemminger
2020-07-15 23:02   ` [dpdk-dev] [PATCH v5 8/9] eal: mark old macros for blacklist/whitelist as deprecated Stephen Hemminger
2020-07-15 23:02   ` [dpdk-dev] [PATCH v5 9/9] doc: replace references to blacklist/whitelist Stephen Hemminger
2020-07-15 23:49     ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200607224840.ffek2eqqr75yblea@u256.net \
    --to=grive@u256.net \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).