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 66AA7A0A0F; Mon, 5 Jul 2021 07:37:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 078F640686; Mon, 5 Jul 2021 07:37:45 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) by mails.dpdk.org (Postfix) with ESMTP id 06BB740141 for ; Mon, 5 Jul 2021 07:37:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IR4pbYrYmQdJd8SejaZm5vMTAFyt3vFoe8r5psy0xFQefwnZvL7AFBjz5yZjx2td8FU/AUPBP9zi8Qumt59VQP8bxtcmE6obNp3f0Ah9mndCAt/4hva85ak7AXMKFPVqdgnH2pnIczu/RODrl+AI0gKF6+u3FDN5gqoJx3HHGA+9gtwKcId1JWiujhh9rQcuhSNyIXlLu2JDpWu1SlaWxyTkgf0AWMj1QM1Wy5x1Sg9LZ4NB8s5iFHIVm1CB/JMLL7hRr+hwVdL2J3SG+BLHBr1zt5TU3JpYbJdPnsCmevj4tRd9gDrRlfSJHYDWz/TEcXEH7HvnuFUKi5COSkWGcQ== 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=Ftg4NhzUTxQIMPmoqgrg+ti/SWEBW5u8Og/EWeyyMBV4PP67yex0u9WgRLiaJR6h+uc65ekuf8vcqhcKjVzgwF9589mDEAgjLp85bKEkkpNtorfOB0pVjkiftggRREjYD7O6WDQB6p2z7jhyZI5QXwWtcFTblCPR6+uMIlIkkH/buTuFEY8MfWf59fgnvi2rwW2VoM4or3LmQIlZYRQaW8P+PCD7Sg9v+tsKxjMpFvkDkDuyI1EIhZCLau3AzBTUXDWQAig0Y6p413YUlfHXfDK3Y/Fpbkfbb6m23YTtDhhkCcIn1ev0FtnTf91X1aZDATinjoK9yBjVi1fNfwuXtg== 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=EiV1qVuBDBPlAVljEzPh/iA2yYTcPsRWKbQ258JfnLqN3uWK+vky+s9Kb5+1ABfzWCjFXt7WR0ER/zxE3A5fNBi5ilRJvpc7CMx33kU4ztXQn+NUllkgJopDpGkVuvWVDui4UsQqxI98eRzL6VgQAFWx3UV+fniD8E0hmKs4ZqPQKsk2g40moesCe7fmqIVM9tH99cDtyoKxlbOVS+bQGqkRuysBqhRYJxa7OtW8u5ZLXSN1ec+xPFK7koUwqmcULSXjl6/AfoMjGBXsrtffbuAH7hot/frtInXCJSxYY2j4s9Bx1VPBQ3UFRCpFKQOq1nASWw69TEUDiZDVVofWOQ== Received: from MW4PR04CA0109.namprd04.prod.outlook.com (2603:10b6:303:83::24) by BN8PR12MB2897.namprd12.prod.outlook.com (2603:10b6:408:99::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.26; Mon, 5 Jul 2021 05:37:37 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:303:83:cafe::86) by MW4PR04CA0109.outlook.office365.com (2603:10b6:303:83::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23 via Frontend Transport; Mon, 5 Jul 2021 05:37:36 +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 CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4287.22 via Frontend Transport; Mon, 5 Jul 2021 05:37:35 +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; Mon, 5 Jul 2021 05:37:31 +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: Mon, 5 Jul 2021 13:36:57 +0800 Message-ID: <20210705053659.12350-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210625114726.776425-1-xuemingl@nvidia.com> References: <20210625114726.776425-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: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 51eca669-f4ce-4575-4c3b-08d93f76fea4 X-MS-TrafficTypeDiagnostic: BN8PR12MB2897: 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: mGFTTN9ej9vu5NbnyMDfML+nagm5sSTLOy4Ef+Cjz2p8amXIl56x8vMUp8yNLS1EtOALNUJXY8hhS5INowLb4TRkbV5KNmwsFf4hWShCgPIXNgGtLLHWINBK2a8VSAfrYprvjRoQx3WSPw2eXUHokqHhzOBkALaremQFbeuPDY9Ft/PtBLjb42L8voPXqg+p2k1Hc8Bfmm3IzSPtiSLeXC1k/D2bKDTdd0zrHC65j6UeLQvPxs+vPD7HSDI7K1pnbhUvvNa+YxfEikEwnhXZwCzWdPJDUTUVzZAskviGe6iha/9ds3xFmh9CyjAs8bwV0sl/u94o28lb9W/UH4g1vCsEL6pj2MPU8aUAUby58o24NQmuk3Xp0qcCvsXZimeqTqHfoGilUKCmHXkCT+rq1Bk1Jg50xhkOD2uL0R7U4oTZg3xNTtc9KRBste/0G2M5DuWFYVh3IjIkreM1xOUehEbAgqADO+a8H4+zKdCUn6yz5+5fr3bI0WCnype/2LkZAaM8TxySCGGoG9Vr/xbEhisM7dvJqIa5FO6BpMen1dFDyK16DVL1SBHhA2yinSzAixS8gCLQrvP7pIqm9qQcZjaMMXDM8GOKxhe4lP6nh4fkNbqe14vOFoAbPyrggFCDsuYFwqTvtGZRK0OaK6jbZBeoIKYQkMiNtPSA7LF+A00EO9BKNDGvP9DwVjtLA7+9W37BwLIKPe+I/Z6Y40m8aqrU7yHCaoQ65OpqfbgkatY= 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)(396003)(39860400002)(376002)(136003)(346002)(46966006)(36840700001)(8676002)(5660300002)(186003)(426003)(7636003)(16526019)(109986005)(47076005)(336012)(2906002)(82310400003)(86362001)(1076003)(36860700001)(7696005)(36756003)(356005)(6666004)(6286002)(70586007)(82740400003)(70206006)(36906005)(478600001)(316002)(54906003)(83380400001)(2616005)(4326008)(8936002)(55016002)(26005)(266003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2021 05:37:35.8707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51eca669-f4ce-4575-4c3b-08d93f76fea4 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: CO1NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2897 Subject: [dpdk-dev] [PATCH v7 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