DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@nvidia.com>
Cc: <dev@dpdk.org>, <xuemingl@nvidia.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Matan Azrad <matan@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
	Chas Williams <chas3@att.com>,
	"Min Hu (Connor)" <humin29@huawei.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>
Subject: [dpdk-dev] [PATCH v5 1/2] devargs: add common key definition
Date: Wed, 23 Jun 2021 03:03:48 +0300	[thread overview]
Message-ID: <20210623000349.631468-1-xuemingl@nvidia.com> (raw)
In-Reply-To: <20210613125846.19852-1-xuemingl@nvidia.com>

Adds common devargs key definition for "bus", "class" and "driver".

Cc: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/common/mlx5/mlx5_common.h       |  2 --
 drivers/common/mlx5/mlx5_common_pci.c   |  2 +-
 drivers/common/sfc_efx/sfc_efx.c        |  7 +++----
 drivers/common/sfc_efx/sfc_efx.h        |  2 --
 drivers/net/bonding/rte_eth_bond_args.c |  2 +-
 drivers/net/i40e/i40e_ethdev_vf.c       |  5 ++---
 drivers/net/iavf/iavf_ethdev.c          |  5 ++---
 drivers/net/mlx5/mlx5.c                 |  4 ++--
 drivers/net/sfc/sfc_kvargs.c            |  2 +-
 drivers/vdpa/mlx5/mlx5_vdpa.c           |  2 +-
 lib/eal/common/eal_common_devargs.c     | 12 ++++++------
 lib/eal/include/rte_devargs.h           | 24 ++++++++++++++++++++++++
 12 files changed, 43 insertions(+), 26 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h
index 1fbefe0fa6..306f2f1ab7 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -208,8 +208,6 @@ __rte_internal
 int mlx5_get_ifname_sysfs(const char *ibdev_path, char *ifname);
 
 
-#define MLX5_CLASS_ARG_NAME "class"
-
 enum mlx5_class {
 	MLX5_CLASS_INVALID,
 	MLX5_CLASS_NET = RTE_BIT64(0),
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 3f16cd21cf..34747c4e07 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -118,7 +118,7 @@ bus_cmdline_options_handler(__rte_unused const char *key,
 static int
 parse_class_options(const struct rte_devargs *devargs)
 {
-	const char *key = MLX5_CLASS_ARG_NAME;
+	const char *key = RTE_DEVARGS_KEY_CLASS;
 	struct rte_kvargs *kvlist;
 	int ret = 0;
 
diff --git a/drivers/common/sfc_efx/sfc_efx.c b/drivers/common/sfc_efx/sfc_efx.c
index 0b78933d9f..2dc5545760 100644
--- a/drivers/common/sfc_efx/sfc_efx.c
+++ b/drivers/common/sfc_efx/sfc_efx.c
@@ -42,7 +42,6 @@ enum sfc_efx_dev_class
 sfc_efx_dev_class_get(struct rte_devargs *devargs)
 {
 	struct rte_kvargs *kvargs;
-	const char *key = SFC_EFX_KVARG_DEV_CLASS;
 	enum sfc_efx_dev_class dev_class = SFC_EFX_DEV_CLASS_NET;
 
 	if (devargs == NULL)
@@ -52,9 +51,9 @@ sfc_efx_dev_class_get(struct rte_devargs *devargs)
 	if (kvargs == NULL)
 		return dev_class;
 
-	if (rte_kvargs_count(kvargs, key) != 0) {
-		rte_kvargs_process(kvargs, key, sfc_efx_kvarg_dev_class_handler,
-				   &dev_class);
+	if (rte_kvargs_count(kvargs, RTE_DEVARGS_KEY_CLASS) != 0) {
+		rte_kvargs_process(kvargs, RTE_DEVARGS_KEY_CLASS,
+				   sfc_efx_kvarg_dev_class_handler, &dev_class);
 	}
 
 	rte_kvargs_free(kvargs);
diff --git a/drivers/common/sfc_efx/sfc_efx.h b/drivers/common/sfc_efx/sfc_efx.h
index 6b6164cb1f..c16eca60f3 100644
--- a/drivers/common/sfc_efx/sfc_efx.h
+++ b/drivers/common/sfc_efx/sfc_efx.h
@@ -19,8 +19,6 @@
 extern "C" {
 #endif
 
-#define SFC_EFX_KVARG_DEV_CLASS	"class"
-
 enum sfc_efx_dev_class {
 	SFC_EFX_DEV_CLASS_INVALID = 0,
 	SFC_EFX_DEV_CLASS_NET,
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 764b1b8c8e..5406e1c934 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -18,7 +18,7 @@ const char *pmd_bond_init_valid_arguments[] = {
 	PMD_BOND_SOCKET_ID_KVARG,
 	PMD_BOND_MAC_ADDR_KVARG,
 	PMD_BOND_AGG_MODE_KVARG,
-	"driver",
+	RTE_DEVARGS_KEY_DRIVER,
 	NULL
 };
 
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 385ebedcd3..0cfe13b7b2 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1660,7 +1660,6 @@ static int
 i40evf_driver_selected(struct rte_devargs *devargs)
 {
 	struct rte_kvargs *kvlist;
-	const char *key = "driver";
 	int ret = 0;
 
 	if (devargs == NULL)
@@ -1670,13 +1669,13 @@ i40evf_driver_selected(struct rte_devargs *devargs)
 	if (kvlist == NULL)
 		return 0;
 
-	if (!rte_kvargs_count(kvlist, key))
+	if (!rte_kvargs_count(kvlist, RTE_DEVARGS_KEY_DRIVER))
 		goto exit;
 
 	/* i40evf driver selected when there's a key-value pair:
 	 * driver=i40evf
 	 */
-	if (rte_kvargs_process(kvlist, key,
+	if (rte_kvargs_process(kvlist, RTE_DEVARGS_KEY_DRIVER,
 			       i40evf_check_driver_handler, NULL) < 0)
 		goto exit;
 
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index a7ef7a6d4d..6793bcef08 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -2448,7 +2448,6 @@ static int
 iavf_drv_i40evf_selected(struct rte_devargs *devargs, uint16_t device_id)
 {
 	struct rte_kvargs *kvlist;
-	const char *key = "driver";
 	int ret = 0;
 
 	if (device_id != IAVF_DEV_ID_VF &&
@@ -2464,13 +2463,13 @@ iavf_drv_i40evf_selected(struct rte_devargs *devargs, uint16_t device_id)
 	if (kvlist == NULL)
 		return 0;
 
-	if (!rte_kvargs_count(kvlist, key))
+	if (!rte_kvargs_count(kvlist, RTE_DEVARGS_KEY_DRIVER))
 		goto exit;
 
 	/* i40evf driver selected when there's a key-value pair:
 	 * driver=i40evf
 	 */
-	if (rte_kvargs_process(kvlist, key,
+	if (rte_kvargs_process(kvlist, RTE_DEVARGS_KEY_DRIVER,
 			       iavf_drv_i40evf_check_handler, NULL) < 0)
 		goto exit;
 
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index cf1815cb74..d0faa45944 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1931,7 +1931,7 @@ mlx5_args_check(const char *key, const char *val, void *opaque)
 		config->max_dump_files_num = tmp;
 	} else if (strcmp(MLX5_LRO_TIMEOUT_USEC, key) == 0) {
 		config->lro.timeout = tmp;
-	} else if (strcmp(MLX5_CLASS_ARG_NAME, key) == 0) {
+	} else if (strcmp(RTE_DEVARGS_KEY_CLASS, key) == 0) {
 		DRV_LOG(DEBUG, "class argument is %s.", val);
 	} else if (strcmp(MLX5_HP_BUF_SIZE, key) == 0) {
 		config->log_hp_size = tmp;
@@ -2002,7 +2002,7 @@ mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs)
 		MLX5_REPRESENTOR,
 		MLX5_MAX_DUMP_FILES_NUM,
 		MLX5_LRO_TIMEOUT_USEC,
-		MLX5_CLASS_ARG_NAME,
+		RTE_DEVARGS_KEY_CLASS,
 		MLX5_HP_BUF_SIZE,
 		MLX5_RECLAIM_MEM,
 		MLX5_SYS_MEM_EN,
diff --git a/drivers/net/sfc/sfc_kvargs.c b/drivers/net/sfc/sfc_kvargs.c
index 0efa92ed28..974c05e68e 100644
--- a/drivers/net/sfc/sfc_kvargs.c
+++ b/drivers/net/sfc/sfc_kvargs.c
@@ -28,7 +28,7 @@ sfc_kvargs_parse(struct sfc_adapter *sa)
 		SFC_KVARG_TX_DATAPATH,
 		SFC_KVARG_FW_VARIANT,
 		SFC_KVARG_RXD_WAIT_TIMEOUT_NS,
-		SFC_EFX_KVARG_DEV_CLASS,
+		RTE_DEVARGS_KEY_CLASS,
 		NULL,
 	};
 
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index e5e03e6582..8b5bfd8c3d 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -588,7 +588,7 @@ mlx5_vdpa_args_check_handler(const char *key, const char *val, void *opaque)
 	unsigned long tmp;
 	int n_cores = sysconf(_SC_NPROCESSORS_ONLN);
 
-	if (strcmp(key, "class") == 0)
+	if (strcmp(key, RTE_DEVARGS_KEY_CLASS) == 0)
 		return 0;
 	errno = 0;
 	tmp = strtoul(val, NULL, 0);
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index b31ac879a9..23aaf8b7e4 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -49,9 +49,9 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 		const char *str;
 		struct rte_kvargs *kvlist;
 	} layers[] = {
-		{ "bus=",    NULL, NULL, },
-		{ "class=",  NULL, NULL, },
-		{ "driver=", NULL, NULL, },
+		{ RTE_DEVARGS_KEY_BUS "=",    NULL, NULL, },
+		{ RTE_DEVARGS_KEY_CLASS "=",  NULL, NULL, },
+		{ RTE_DEVARGS_KEY_DRIVER "=", NULL, NULL, },
 	};
 	struct rte_kvargs_pair *kv = NULL;
 	struct rte_class *cls = NULL;
@@ -118,7 +118,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 		if (layers[i].kvlist == NULL)
 			continue;
 		kv = &layers[i].kvlist->pairs[0];
-		if (strcmp(kv->key, "bus") == 0) {
+		if (strcmp(kv->key, RTE_DEVARGS_KEY_BUS) == 0) {
 			bus = rte_bus_find_by_name(kv->value);
 			if (bus == NULL) {
 				RTE_LOG(ERR, EAL, "Could not find bus \"%s\"\n",
@@ -126,7 +126,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 				ret = -EFAULT;
 				goto get_out;
 			}
-		} else if (strcmp(kv->key, "class") == 0) {
+		} else if (strcmp(kv->key, RTE_DEVARGS_KEY_CLASS) == 0) {
 			cls = rte_class_find_by_name(kv->value);
 			if (cls == NULL) {
 				RTE_LOG(ERR, EAL, "Could not find class \"%s\"\n",
@@ -134,7 +134,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 				ret = -EFAULT;
 				goto get_out;
 			}
-		} else if (strcmp(kv->key, "driver") == 0) {
+		} else if (strcmp(kv->key, RTE_DEVARGS_KEY_DRIVER) == 0) {
 			/* Ignore */
 			continue;
 		}
diff --git a/lib/eal/include/rte_devargs.h b/lib/eal/include/rte_devargs.h
index 1e595b3c51..cd90944fe8 100644
--- a/lib/eal/include/rte_devargs.h
+++ b/lib/eal/include/rte_devargs.h
@@ -25,6 +25,30 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_bus.h>
 
+/**
+ * Bus type key in global devargs syntax.
+ *
+ * Legacy devargs parser doesn't use this key as bus type
+ * is resolved as first optional value separated by ":".
+ */
+#define RTE_DEVARGS_KEY_BUS "bus"
+
+/**
+ * Class type key in global devargs syntax.
+ *
+ * Legacy devargs parser doesn't parse class type. PMD driver is
+ * encouraged to use this key to resolve class type.
+ */
+#define RTE_DEVARGS_KEY_CLASS "class"
+
+/**
+ * Driver type key in global devargs syntax.
+ *
+ * Legacy devargs parser doesn't parse driver type. PMD driver is
+ * encouraged to use this key to resolve driver type.
+ */
+#define RTE_DEVARGS_KEY_DRIVER "driver"
+
 /**
  * Type of generic device
  */
-- 
2.25.1


  parent reply	other threads:[~2021-06-23  0:04 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 13:01 [dpdk-dev] [RFC] bus/auxiliary: introduce auxiliary bus Xueming Li
2021-04-12  8:29 ` Xueming(Steven) Li
2021-04-13  3:23 ` [dpdk-dev] [PATCH v1] " Xueming Li
2021-04-13  8:49   ` Thomas Monjalon
2021-04-14  2:59   ` Wang, Haiyue
2021-04-14  8:17     ` Thomas Monjalon
2021-04-14  8:30       ` Wang, Haiyue
2021-04-14 15:49       ` Xueming(Steven) Li
2021-04-14 15:39     ` Xueming(Steven) Li
2021-04-14 16:13       ` Wang, Haiyue
2021-04-15  7:35   ` Wang, Haiyue
2021-04-15  7:46     ` Xueming(Steven) Li
2021-04-15  7:51       ` Wang, Haiyue
2021-04-15  7:55         ` Xueming(Steven) Li
2021-04-15  7:59           ` Thomas Monjalon
2021-04-15  8:06             ` Wang, Haiyue
2021-05-10 13:47   ` [dpdk-dev] [RFC v2] " Xueming Li
2021-05-11  9:47     ` Kinsella, Ray
2021-06-10  3:30       ` Xueming(Steven) Li
2021-06-08  7:53     ` Thomas Monjalon
2021-06-08  8:41       ` Wang, Haiyue
2021-06-10  6:29         ` Xueming(Steven) Li
2021-06-10 15:16           ` Wang, Haiyue
2021-06-10  6:30       ` Xueming(Steven) Li
2021-06-13  8:19     ` [dpdk-dev] [PATCH v3 1/2] devargs: add common key definition Xueming Li
2021-06-13  8:19     ` [dpdk-dev] [PATCH v3 2/2] bus/auxiliary: introduce auxiliary bus Xueming Li
2021-06-13 12:58     ` [dpdk-dev] [PATCH v4 1/2] devargs: add common key definition Xueming Li
2021-06-21  8:08       ` Thomas Monjalon
2021-06-23  0:03       ` Xueming Li [this message]
2021-06-24 10:05         ` [dpdk-dev] [PATCH v5 " Thomas Monjalon
2021-06-23  0:03       ` [dpdk-dev] [PATCH v5 2/2] bus/auxiliary: introduce auxiliary bus Xueming Li
2021-06-24 16:18         ` Thomas Monjalon
2021-06-25  3:26           ` Xueming(Steven) Li
2021-06-25 12:03             ` Thomas Monjalon
2021-06-25 11:47         ` [dpdk-dev] [PATCH v6 1/2] devargs: add common key definition Xueming Li
2021-07-04 15:51           ` Andrew Rybchenko
2021-07-05  5:36           ` [dpdk-dev] [PATCH v7 " Xueming Li
2021-07-05  5:36           ` [dpdk-dev] [PATCH v7 2/2] bus/auxiliary: introduce auxiliary bus Xueming Li
2021-07-05  6:47             ` Xueming(Steven) Li
2021-07-05  6:45           ` [dpdk-dev] [PATCH v8 1/2] devargs: add common key definition Xueming Li
2021-07-05  9:26             ` Xueming(Steven) Li
2021-07-05  6:45           ` [dpdk-dev] [PATCH v8 2/2] bus/auxiliary: introduce auxiliary bus Xueming Li
2021-07-05  9:19             ` Andrew Rybchenko
2021-07-05  9:30               ` Xueming(Steven) Li
2021-07-05  9:35                 ` Andrew Rybchenko
2021-07-05 14:57                   ` Thomas Monjalon
2021-07-05 15:06                     ` Andrew Rybchenko
2021-07-05 16:47             ` Thomas Monjalon
2021-06-25 11:47         ` [dpdk-dev] [PATCH v6 " Xueming Li
2021-07-04 16:13           ` Andrew Rybchenko
2021-07-05  5:47             ` Xueming(Steven) Li
2021-08-04  9:50           ` Kinsella, Ray
2021-08-04  9:56             ` Xueming(Steven) Li
2021-08-04 10:00           ` Kinsella, Ray
     [not found]             ` <DM4PR12MB5373DBD9E73E5E0E8505C129A1F19@DM4PR12MB5373.namprd12.prod.outlook.com>
     [not found]               ` <97d5d1b3-40c3-09ac-2978-83c984b30af0@ashroe.eu>
     [not found]                 ` <DM4PR12MB53736410D2C07101F872363EA1F19@DM4PR12MB5373.namprd12.prod.outlook.com>
2021-08-04 12:14                   ` Kinsella, Ray
2021-08-04 13:00                     ` Xueming(Steven) Li
2021-08-04 13:12                       ` Thomas Monjalon
2021-08-04 13:53                         ` Kinsella, Ray
2021-08-04 14:13                           ` Thomas Monjalon
2021-06-13 12:58     ` [dpdk-dev] [PATCH v4 " Xueming Li
2021-06-21 16:11       ` Thomas Monjalon
2021-06-22 23:50         ` Xueming(Steven) Li
2021-06-23  8:15           ` Thomas Monjalon
2021-06-23 14:52             ` Xueming(Steven) Li
2021-06-24  6:37               ` Thomas Monjalon
2021-06-24  8:42                 ` Xueming(Steven) Li
2021-06-23  8:21           ` Thomas Monjalon
2021-06-23 13:54             ` Xueming(Steven) Li
2021-06-25  4:34 ` [dpdk-dev] [RFC] " Stephen Hemminger
2021-06-25 11:24   ` Xueming(Steven) Li

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=20210623000349.631468-1-xuemingl@nvidia.com \
    --to=xuemingl@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=beilei.xing@intel.com \
    --cc=chas3@att.com \
    --cc=dev@dpdk.org \
    --cc=humin29@huawei.com \
    --cc=jingjing.wu@intel.com \
    --cc=matan@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    /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).