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 04170A0547; Fri, 25 Jun 2021 13:48:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 883F040698; Fri, 25 Jun 2021 13:48:00 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2049.outbound.protection.outlook.com [40.107.220.49]) by mails.dpdk.org (Postfix) with ESMTP id BE27E4068A for ; Fri, 25 Jun 2021 13:47:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CdWzAF3tPXLZivdjOFfPQu0TpacAFICFylf3T8i12x41F3qqC2IKDvN8OMx/QdJRkYzwbNQkNS0oJO4y0yZV19CwzlrYP8PFD7wnVKBjC9GceLoII4gixZ9o04cUXwtilawZA7a9kkJqRwmu+MnVk5YZ7U0UMLzq6ej3DlXThS7aTVwK0bdOSaM1Y2gxWgH93PJxLb3y2cZCpHGwqKHV77BsYvzgmXKAbUMd9LN4BNhYagYhW42mkFTW/YFB1JA+0YLMu4yhTWIqciIrnR4mCJRxX3r77ZB79/r5uNly5qdc40bJIRhAyAaHaT4tmiDb/ImXzIpJ35p0+qkpPvmQaw== 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=lgofwfR+I2p5mM2niAUugfp6Up6C7Sr+QYp6lvAb53k=; b=Qa/jx1wFsvPX8lccqKgc6oAmPBY9QBepk+AQ6YxLotlMm2JjH5B4148I+ssZ4sfs8ED5ZQWATTG57s/W9YO14F4kZoNd491yb8wr9vO09Es/JwaPfxVev70SmlfbG4d3YIrgka24his+SzfG/vZ7EzL5CU00qp/HjiyQTPPWnykRUYjhgRj+aQLPe/ha2EK5F8FXcOvYIj+VicN4MHa4EgmY3HEQYU8LjDjNh03FfoXZ6bte8H76ha6AWYJlolvjKbpW/7PVDxveiReZQrw3GqXr/+1QhFEAKKIwjrFd112FOLkjiamp0A1PrWqcyI7wWZ1obClCU3hCmWGikFGUJw== 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=lgofwfR+I2p5mM2niAUugfp6Up6C7Sr+QYp6lvAb53k=; b=eUjGoezv82RtWoVOKJ7YbuI85XPdVZfhFvKWNWIfyLf7gD9r5Hy5wzxB77i+1xu/tZZPidc8p+eAgn7lnWoj4e6lB2s6E9nZcy8tA5V1QftS1uFrYP8YMx3NnPT2JHa3hZXJGqkhSkJr9pd0m8Z/n+PkjlMymGfC7MBGMyG+utTh2S8YVIcv1W9V/yY1FQHGR6noz/Xn5FnA55UapZvLFaDl//LFlsijDAgGjrJp9eWNE5JCzdVD3o2XAu/HSKeZ+ntuSlSK47KKsCn1+Wz+iSX5nUCyKW8lxkJvH2fpoCiKHIUJPomM9wW+NeJtdnfauPG3f82+17Yfjbrjwicgzw== Received: from BN6PR16CA0048.namprd16.prod.outlook.com (2603:10b6:405:14::34) by DM5PR12MB1674.namprd12.prod.outlook.com (2603:10b6:4:11::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.20; Fri, 25 Jun 2021 11:47:56 +0000 Received: from BN8NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:405:14:cafe::4a) by BN6PR16CA0048.outlook.office365.com (2603:10b6:405:14::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Fri, 25 Jun 2021 11:47:56 +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 BN8NAM11FT050.mail.protection.outlook.com (10.13.177.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4264.18 via Frontend Transport; Fri, 25 Jun 2021 11:47:56 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 25 Jun 2021 11:47:52 +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: Fri, 25 Jun 2021 14:47:24 +0300 Message-ID: <20210625114726.776425-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210623000349.631468-2-xuemingl@nvidia.com> References: <20210623000349.631468-2-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f22fb40-c466-4a72-8fbb-08d937cf12d2 X-MS-TrafficTypeDiagnostic: DM5PR12MB1674: 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: NulqC8Kw75FsBulKqzrrTNhexcseqmS979P2OqsX848yG2G3kDf/b44BVkWAH7kH02ki5CC6F4ShP9Tsf0LGkuCDcFvEXEsz2wRaeSXNP3gyOgNdDfUBYl9206OZnJIJrDiVixPA61wYB4vVBzVNdgX9Tw0zt64Mbk6vIzemtkxPG3Q3YabAMxU0s0FvMv1LJdR/y3I0gFNk45edaO+mJZb07XslHSAEE/leuBzmL1nbjsd9AbbehfGY6ZjN0iNBc4YNjSiBHMzXqgv+4mWlg8nLdByNTounHMIOFxLTqT57IgOauBxYBrzKN9+wubHBVzvGuB3/WnIa3hd648P0YpAX7qG6C/fJmiW/oxYDupq/nmgYhnxg4MceIgC95S+Jbkg3R7MM9z24/duoq0BDGVCDARY0rAasjk3wT7S2DWvoXxZxjFVsD6K4fgy/k0iGX1fJF1K9ugDfunEy2voZ6m8WNY1RMhe5s//vQVSzWbafbnwmFGu4HGM8PSixrZQoRNK988w2zi5/KAWb1t6+YMM5MFZoraLHrrp5Jd+Gp7KEd9mbEFiQs1OJ9fnghtbhegLuZpNOMkDu9+cPYhFOKWYy0+5k3ivK3Jy0LZIyKDAl42rGxR4ykGBr6cdgywYXfL2qi1vXJ9I0sqh9dJmfP8kfz5RXvbJMmwVg6/mOvLo= 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)(376002)(136003)(346002)(396003)(36840700001)(46966006)(16526019)(336012)(186003)(70586007)(4326008)(82310400003)(1076003)(26005)(356005)(36756003)(86362001)(6666004)(8676002)(2616005)(316002)(70206006)(426003)(8936002)(109986005)(47076005)(7636003)(54906003)(478600001)(7696005)(5660300002)(83380400001)(55016002)(2906002)(36860700001)(82740400003)(6286002)(266003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2021 11:47:56.0624 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f22fb40-c466-4a72-8fbb-08d937cf12d2 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: BN8NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1674 Subject: [dpdk-dev] [PATCH v6 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". Acked-by: 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 5290588b17..472538181e 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