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 82D32A0A0C; Sun, 13 Jun 2021 14:59:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 061104003F; Sun, 13 Jun 2021 14:59:12 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2067.outbound.protection.outlook.com [40.107.236.67]) by mails.dpdk.org (Postfix) with ESMTP id 2DAF64003E for ; Sun, 13 Jun 2021 14:59:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iG5exGq8zzUK6MRFJiL3b8tlAe1AmMEoWeJyMNmXxow3F8wlgccfTF9+tqs3yUxFO/mho3of4ey/UuNrSmDSmcJKvq59LCFCjJ7KryUeJ8NAafMv3wJl/IplTu9ve9OpbRJzrxpLLlLcZzKD9ZkjM9R48mPQT6U/mkZv7QH9Ti30Epvw2/OUbndKYBpAr6nzt159WDXboZgcH6l3wzchUsa1dsUqYEl3ryL921pPKCc5hv8bN+VT22F7ViijjV4yx2xspMulz6EDabh11jEDRpPL62a2m1y9PvwTYXaOhJ4OZ2/OSImctzqz500TVPTjW/ijcFACfyCsernxcH2O1g== 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=jtFP9RMhQWd3l7CzHicmxPKjcdWbLCRRTkiNU0Knkhc=; b=GUjDcMG8OcRqK0V/OkeLEBNo8/hIlfRJxMMoBQ548n1w2bOcQjzNd8m/h0VlG8IIT1mBOh7d77YcS2HPaQ4zX7RDjlIMBjN7I2vW1lJ1L57vVwPHbX8/woGJTpL3bUUG9Uw++2/oXgSGWw5UdhCUXeI0MYwAcG6RtRKd9xowuAAWPgQRox0ZMZvkjuLawGUf/fQROBhL0b7Qu3BkjDx41i7Ar8xraAA2jcY+OrfFlhPq/uqEVng9+1hVXHSR2tndv6CUThLwHM+SSriumthAfYSzxPERHpMxu6IomLSr5LXBOZigAw2xYLNlxJVYTMq29qPnBJCwqFPmEI38aYu9lw== 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=jtFP9RMhQWd3l7CzHicmxPKjcdWbLCRRTkiNU0Knkhc=; b=GrMkOs+/SD2vXXrzSPSzs1kH8neInY1r5b5VRXHNjXD4DhYbdVLimp9KsjKeKVordx3/GouFSQUuKuSzR2GOOeW/bTuGT4hoXGIHY6E3xK2Z8p0vhCtlJDM5Bsy8HprgSAO4IxDtbvvJdkwz0NhMiFR9Z9BjQDmulZ+GytxT007oiks4tAnLIhctCXixlOncbfmNWMbpDUdf7Xs5OHvrRuSRrJ2Oy/jUaoBluvDasnML3Nqcetz5pnEM3Qgneo5ZdOnD/peKNVns/v427TbpqDmd9ZchhGvckuUUahRPhWLfrJUt9eDkSmDKtJ1aWm4Lwc0Rd+D/Ff+w+B3NV9kHYw== Received: from MWHPR10CA0059.namprd10.prod.outlook.com (2603:10b6:300:2c::21) by BN6PR12MB1937.namprd12.prod.outlook.com (2603:10b6:404:108::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.24; Sun, 13 Jun 2021 12:59:09 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:300:2c:cafe::6b) by MWHPR10CA0059.outlook.office365.com (2603:10b6:300:2c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Sun, 13 Jun 2021 12:59:09 +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 CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4219.21 via Frontend Transport; Sun, 13 Jun 2021 12:59:08 +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; Sun, 13 Jun 2021 12:59:05 +0000 From: Xueming Li To: CC: , , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , Andrew Rybchenko , Chas Williams , "Min Hu (Connor)" , "Beilei Xing" , Jingjing Wu Date: Sun, 13 Jun 2021 20:58:45 +0800 Message-ID: <20210613125846.19852-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510134732.2174-1-xuemingl@nvidia.com> References: <20210510134732.2174-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: 635d7506-9054-472b-1019-08d92e6b086f X-MS-TrafficTypeDiagnostic: BN6PR12MB1937: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:49; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: inO1EJ3BtK8A/pWhngdePHCynDGSv7wZa540RKuqRtf6XpS54FCSe2ZpYdRlaj+NCFoMHJhcjOVmr1S90+e1uNARhCkMR5hyiR13tJHzrrWmOsGrv1e8oSDWTjSdZW+s01iImOgKdwNlQb3xkHdbbNFtxi/IJnCrbMyoFpAZ/8ql85w2hUF6gatOtxNoASNyfvS7odBtKm307Om0nmbKhuFFFcpl45T0LziPZJMW//j7fRomvzSGUpEpeUtZlCuNG4nRtUex6ENBO0k7fAcTilqs/kPUb/cqOqYo5IMAJpPRBYj/1wE8WPtVNthGSLxNRKuqL8Q6+zW8yaVOCG1cmp7vnsTnw1TE3YOy/GnIvTKzD+UuUwgjLQfzsIrLNlq8b/IKUziXYvfioteafZXX6GyyS3wtcWtfHzikZs9Q0S1PXII/6TqRacGnXrPlDnN00n7rkHzpctcZn3/0XwaUmPYYJ6H78++jGwlMtsem1+S/nQxN2HI8y2rsAYC6mlX6+2G2+kGUccy5UXcCqJKmWPArvsiV33d/7lZ+yNW5Y7ISa7UybUoBRysiJwNf3v3cHVXURmTNeDII4GB3TFcDSA3p6MJ53/1wI1R92XbWb/QUi8qvk8N9DY8aszWkGjAFIxlpKQM4JS1Q7CudnzBT7EWJLsqyMiuU3ZaC5MzIgHY= 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)(376002)(39860400002)(396003)(136003)(346002)(36840700001)(46966006)(36860700001)(47076005)(1076003)(26005)(6286002)(8676002)(5660300002)(16526019)(186003)(478600001)(6666004)(109986005)(7696005)(55016002)(54906003)(82740400003)(36906005)(426003)(70206006)(82310400003)(316002)(86362001)(336012)(356005)(2616005)(2906002)(7636003)(4326008)(36756003)(83380400001)(70586007)(8936002)(266003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2021 12:59:08.6501 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 635d7506-9054-472b-1019-08d92e6b086f 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: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1937 Subject: [dpdk-dev] [PATCH v4 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". 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 | 4 ++++ 12 files changed, 23 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 cb898bdb68..1d8ca42a0f 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 d688c31cfb..4e79319017 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2440,7 +2440,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 && @@ -2456,13 +2455,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..14fe7f70b6 100644 --- a/lib/eal/include/rte_devargs.h +++ b/lib/eal/include/rte_devargs.h @@ -25,6 +25,10 @@ extern "C" { #include #include +#define RTE_DEVARGS_KEY_BUS "bus" +#define RTE_DEVARGS_KEY_CLASS "class" +#define RTE_DEVARGS_KEY_DRIVER "driver" + /** * Type of generic device */ -- 2.25.1