From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA900A0524; Fri, 8 Jan 2021 16:15:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA12A141020; Fri, 8 Jan 2021 16:15:14 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id CA0E3141015 for ; Fri, 8 Jan 2021 16:15:13 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@nvidia.com) with SMTP; 8 Jan 2021 17:15:09 +0200 Received: from nvidia.com ([172.27.8.145]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 108FF3ZJ000760; Fri, 8 Jan 2021 17:15:08 +0200 From: Xueming Li To: Viacheslav Ovsiienko Cc: dev@dpdk.org, Matan Azrad , Shahaf Shuler , Thomas Monjalon , xuemingl@nvidia.com, Asaf Penso Date: Fri, 8 Jan 2021 23:15:00 +0800 Message-Id: <20210108151500.30308-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <1608304614-13908-2-git-send-email-xuemingl@nvidia.com> References: <1608304614-13908-2-git-send-email-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1 2/2] net/mlx5: support new device global syntax 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" This patch support new device global syntax like: bus=pci,addr=BB:DD.F/class=eth/driver=mlx5,devargs,.. Ignore "driver" key as part of new global device syntax in devargs. The representor devarg is supposed to come from either class section or driver section. Signed-off-by: Xueming Li --- drivers/net/mlx5/linux/mlx5_os.c | 18 ++++++++++++++++-- drivers/net/mlx5/mlx5.c | 6 +++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 6812a1f215..f1ed3505b1 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -699,13 +699,27 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, if (switch_info->representor && dpdk_dev->devargs) { struct rte_eth_devargs eth_da; - err = rte_eth_devargs_parse(dpdk_dev->devargs->args, ð_da); + /* Representer should come from class argument or driver */ + if (dpdk_dev->devargs->cls_str) + err = rte_eth_devargs_parse(dpdk_dev->devargs->cls_str, + ð_da); if (err) { rte_errno = -err; DRV_LOG(ERR, "failed to process device arguments: %s", - strerror(rte_errno)); + dpdk_dev->devargs->cls_str); return NULL; } + if (eth_da.type == RTE_ETH_REPRESENTOR_NONE) { + /* Support legacy device argument */ + err = rte_eth_devargs_parse(dpdk_dev->devargs->args, + ð_da); + if (err) { + rte_errno = -err; + DRV_LOG(ERR, "failed to process device arguments: %s", + dpdk_dev->devargs->args); + return NULL; + } + } for (i = 0; i < eth_da.nb_representor_ports; ++i) if (eth_da.representor_ports[i] == (uint16_t)switch_info->port_name) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 023ef50a77..f2b6cf9fd6 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -41,6 +41,9 @@ #include "mlx5_flow_os.h" #include "rte_pmd_mlx5.h" +/* Driver type key for new device global syntax. */ +#define MLX5_DRIVER_KEY "driver" + /* Device parameter to enable RX completion queue compression. */ #define MLX5_RXQ_CQE_COMP_EN "rxq_cqe_comp_en" @@ -1600,7 +1603,7 @@ mlx5_args_check(const char *key, const char *val, void *opaque) signed long tmp; /* No-op, port representors are processed in mlx5_dev_spawn(). */ - if (!strcmp(MLX5_REPRESENTOR, key)) + if (!strcmp(MLX5_DRIVER_KEY, key) || !strcmp(MLX5_REPRESENTOR, key)) return 0; errno = 0; tmp = strtol(val, NULL, 0); @@ -1754,6 +1757,7 @@ int mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs) { const char **params = (const char *[]){ + MLX5_DRIVER_KEY, MLX5_RXQ_CQE_COMP_EN, MLX5_RXQ_CQE_PAD_EN, MLX5_RXQ_PKT_PAD_EN, -- 2.25.1