From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5A047A0548; Wed, 23 Jun 2021 02:04:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF2854003F; Wed, 23 Jun 2021 02:04:37 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2042.outbound.protection.outlook.com [40.107.94.42]) by mails.dpdk.org (Postfix) with ESMTP id 93D934003E for ; Wed, 23 Jun 2021 02:04:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FQuPTed4tjntLHiULx0tKmgGTEA5ogPIsxsvMcPmy7hv4jEbEwS8xBy508GIr17jzVdLpjUcYlqpBSkk+W0e1quLCWKTcEePF/3VRkcKDktatXaHow9/w9kJZ6mB+k0joeHGBOgDk783sLWBtfiw37iyJVpqMih+HS+6oNwto9e2vAuPkU8E2qdYrGqysYEzNNOBnQDK1XvE2i55jzJq9muQXEqnInidFtS+Q9ChLIF8YAEO/UfpMZ8z8OfvLV3sbfywofoKtU1GXEPcCUYBZ+oonFbWK4Reo9+w8jVC97HErgIcs+egYCx/ER7h4dU0dg4SeL5CS2feueN/Fc89ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nCEbo6a0YAmElU7bbKbLDHlwOwhQ1tmxYkTEQAr1pXQ=; b=cUvHu9SjqgAXFav6OW9CQ1n2I/9+7m6c+dn3XlK5DP+z6VI99MdwASNCCbDlWIciRlAe9LnFs4Lut3QOf3AHPYW0lKFGeBD9pyvmDN046zHv6NUN+lZ50L0JDXZW/rPEfuhHwTPOEUtbjPPvM7641PhnzIUnz1ms2SG9C8WYgADhe+Al2TaMm7R8xhIkUKf1XKm8ObHSlV2tAhvh6gGCi8JsHv67B96i7HPCdO569V2nkF2cVgP8MNVtG8v3tsIw57NJFGdehTnItn1kPGUVCVXxlkvtcah6ekCXIuhvnf4B34fyry8Go+4weFRjpLFCo3lLUuSiwqjlvBJmzFd3Sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nCEbo6a0YAmElU7bbKbLDHlwOwhQ1tmxYkTEQAr1pXQ=; b=OeAvDT6PPNWbxiVh+nqL6T62llkVhwTYE0S/EDqXEiBo8++ZzNca4br0ZUfc9vdYjQvaxAIwq7jnbA7ymLH36XDuzkC8zu8IG7nYQKvATnE/1Z4ipCYurmZceHrJstkUHFRcLooCYQe6vgoBNPa3TgHOq+ZwG37/9rxYEZcXWDXjOMKkFHdmc9y/pFtKhMXLn9A/I8kCe6suyEHBfKIamzQ3gO5VBHkDa4l5b8ctdurd6mCCwCRJbispYq8vukvcXKJ1N/kvLM/JQcW4LDpyAEd5jXAb5m5J0KJuUTUQB5FLEJ1wOwYPQ4NcLrfDqeNleA9Kq1Yt2EHkmpmmcXtLEg== Received: from MWHPR22CA0029.namprd22.prod.outlook.com (2603:10b6:300:69::15) by MN2PR12MB3296.namprd12.prod.outlook.com (2603:10b6:208:aa::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Wed, 23 Jun 2021 00:04:34 +0000 Received: from CO1NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:300:69:cafe::9a) by MWHPR22CA0029.outlook.office365.com (2603:10b6:300:69::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Wed, 23 Jun 2021 00:04:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT066.mail.protection.outlook.com (10.13.175.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4242.16 via Frontend Transport; Wed, 23 Jun 2021 00:04:33 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 23 Jun 2021 00:04:30 +0000 From: Xueming Li To: CC: , , Thomas Monjalon , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , "Andrew Rybchenko" , Chas Williams , "Min Hu (Connor)" , Beilei Xing , Jingjing Wu Date: Wed, 23 Jun 2021 03:03:48 +0300 Message-ID: <20210623000349.631468-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210613125846.19852-1-xuemingl@nvidia.com> References: <20210613125846.19852-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d4659301-ea5c-45d0-f436-08d935da7b68 X-MS-TrafficTypeDiagnostic: MN2PR12MB3296: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:85; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jF4NDeASMs5SPZgpLnTyFkYm1A5YAD9JtxPCsnRvtcYAPiWtHPRn8E9CU3DYDyftGxB3xz/THK24CL+SF9184cDLZP59RoGLX5KOWgyPSQtMa0FbMrztMpdEy3PtyH66PliTBh+29sYtCcpbX4c9Azu6gXjMP/j64gqK2Q5L+aa/omzvNXjApqT/ux/PR0+1ml6ypQPrbEONuvm9CDgII8CLL+z/lqnnf08/n471mdIJ9WpdLtfP3Xik6a1N6ck/PDOcg+BgDb+NLIyFoyKJ7EOndct0XRQl0+dpcrNJ1jMv9TjMSl7N86OlYXteBapsaS20GvX+j42xurSZwhv4QUuLFuHvqHRE6Sv/LVBLCrAg8Q9pZX1FbATxH7SCAtncbH90SYtLCITAuYm9tfzXCs9Ff7L/DIFMldET/3t4RQzBu2K3QyH2HzS/kcqvQgSm5azUjOmAYWnnklyvskWSWYcNxyyDFnIJZdo0TogXF4CMSE5AfAImxajj9uNPEpuFIImn1KBTeWE460JyL2wb47h/qfxTS9OWthTG4XEgL4qxf5cLnAa5ULHI+VZgCLnVQoDnvMnz/4n4Iy2+McD2VPSCmrrYhtehTaT9ZVkxpZgr/cqKI0Zb+wgQZinqnGH+2KcdrxBEa3hmnjhRb0JOXiaf9ra0ZVdbTrSJO+OZ3zk= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(346002)(396003)(376002)(136003)(36840700001)(46966006)(2616005)(55016002)(2906002)(478600001)(82310400003)(5660300002)(426003)(36756003)(47076005)(336012)(6286002)(4326008)(1076003)(36860700001)(109986005)(8676002)(6666004)(86362001)(356005)(70206006)(186003)(70586007)(83380400001)(16526019)(82740400003)(7696005)(26005)(7636003)(36906005)(54906003)(8936002)(316002)(266003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2021 00:04:33.8164 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4659301-ea5c-45d0-f436-08d935da7b68 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3296 Subject: [dpdk-dev] [PATCH v5 1/2] devargs: add common key definition X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adds common devargs key definition for "bus", "class" and "driver". Cc: Thomas Monjalon Signed-off-by: Xueming Li --- 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 #include +/** + * 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