From patchwork Thu Jan 11 06:44:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harman Kalra X-Patchwork-Id: 135836 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BC0A4388D; Thu, 11 Jan 2024 07:44:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B71940648; Thu, 11 Jan 2024 07:44:55 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 691ED40648 for ; Thu, 11 Jan 2024 07:44:53 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40B3TJ3m021793; Wed, 10 Jan 2024 22:44:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=pfpt0220; bh=iYNlSrid2UpczfBigi3qy wr3MnO1QONZCErmT5g5iWM=; b=BQ4fSpfD+e2LmevfYwg+N+97Z42D8zkhfZgks DXasMfq3+oNr+nKegOq1sneX6o6bjEh/WYN9rp3XF0ykmukVBVkZSQolkgf3STAx Y9ruB19q7KAWnHDtaHunNonC1YzJfAbt63emCNY9xFfYryVQLUFvGBzHY82etXzT 90dG6L3+1p6Z6VJLqBU+LsO8ssjpiOUmjgFjHBd4WfmIlPLvj+DCzUsJ5q+u4uTh X/82c1jpy3yp1qixVI2iLsvfhf0yzQ5UC78VBdstzEE6Xmf2RxEWpRp2y7Tz2G0a xoG6QxAMcxUpKnmAxW4FyYFB8FsYBSXsyQbiphWGuoxDUy5gg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vj8fk0fdm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 10 Jan 2024 22:44:48 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 10 Jan 2024 22:44:46 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 10 Jan 2024 22:44:46 -0800 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id 9382F3F705A; Wed, 10 Jan 2024 22:44:40 -0800 (PST) From: Harman Kalra To: Ajit Khaparde , Somnath Kotur , John Daley , Hyong Youb Kim , Yuying Zhang , Beilei Xing , Qiming Yang , Qi Zhang , Wenjun Wu , Dariusz Sosnowski , Viacheslav Ovsiienko , "Ori Kam" , Suanming Mou , Matan Azrad , Chaoyong He , Andrew Rybchenko , Thomas Monjalon , Ferruh Yigit CC: , Harman Kalra Subject: [PATCH 1/2] ethdev: parsing multiple representor devargs string Date: Thu, 11 Jan 2024 12:14:31 +0530 Message-ID: <20240111064432.193119-2-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240111064432.193119-1-hkalra@marvell.com> References: <20240111064432.193119-1-hkalra@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: Lv5IqAcg7Dsjjw6zNCmdm3nWqETGepSX X-Proofpoint-ORIG-GUID: Lv5IqAcg7Dsjjw6zNCmdm3nWqETGepSX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 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 Adding support for parsing multiple representor devargs strings passed to a PCI BDF. There may be scenario where port representors for various PFs or VFs under PFs are required and all these are representor ports shall be backed by single pci device. In such case port representors can be created using devargs string: ,representor=pf[0-1],representor=pf2vf[1,2-3],representor=[4-5] Signed-off-by: Harman Kalra --- drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/enic/enic_ethdev.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/ice/ice_dcf_ethdev.c | 2 +- drivers/net/ixgbe/ixgbe_ethdev.c | 2 +- drivers/net/mlx5/linux/mlx5_os.c | 4 ++-- .../net/nfp/flower/nfp_flower_representor.c | 2 +- drivers/net/sfc/sfc_ethdev.c | 2 +- lib/ethdev/ethdev_driver.c | 19 ++++++++----------- lib/ethdev/ethdev_driver.h | 4 ++-- 10 files changed, 19 insertions(+), 22 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index acf7e6e46e..bc2fcbc9c6 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -6384,7 +6384,7 @@ static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (pci_dev->device.devargs) { ret = rte_eth_devargs_parse(pci_dev->device.devargs->args, ð_da); - if (ret) + if (ret < 0) return ret; } diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index b04b6c9aa1..62505fe810 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -1318,7 +1318,7 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (pci_dev->device.devargs) { retval = rte_eth_devargs_parse(pci_dev->device.devargs->args, ð_da); - if (retval) + if (retval < 0) return retval; } if (eth_da.nb_representor_ports > 0 && diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 3ca226156b..7dad62313b 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -647,7 +647,7 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (pci_dev->device.devargs) { retval = rte_eth_devargs_parse(pci_dev->device.devargs->args, ð_da); - if (retval) + if (retval < 0) return retval; } diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 5d845bba31..f908190226 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -2042,7 +2042,7 @@ eth_ice_dcf_pci_probe(__rte_unused struct rte_pci_driver *pci_drv, return 1; ret = rte_eth_devargs_parse(pci_dev->device.devargs->args, ð_da); - if (ret) + if (ret < 0) return ret; ret = rte_eth_dev_pci_generic_probe(pci_dev, diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index d6cf00317e..4650cdb369 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1766,7 +1766,7 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (pci_dev->device.devargs) { retval = rte_eth_devargs_parse(pci_dev->device.devargs->args, ð_da); - if (retval) + if (retval < 0) return retval; } else memset(ð_da, 0, sizeof(eth_da)); diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index ae82e1e5d8..263ba471f1 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -2734,7 +2734,7 @@ mlx5_os_parse_eth_devargs(struct rte_device *dev, /* Parse representor information first from class argument. */ if (dev->devargs->cls_str) ret = rte_eth_devargs_parse(dev->devargs->cls_str, eth_da); - if (ret != 0) { + if (ret < 0) { DRV_LOG(ERR, "failed to parse device arguments: %s", dev->devargs->cls_str); return -rte_errno; @@ -2742,7 +2742,7 @@ mlx5_os_parse_eth_devargs(struct rte_device *dev, if (eth_da->type == RTE_ETH_REPRESENTOR_NONE && dev->devargs->args) { /* Parse legacy device argument */ ret = rte_eth_devargs_parse(dev->devargs->args, eth_da); - if (ret) { + if (ret < 0) { DRV_LOG(ERR, "failed to parse device arguments: %s", dev->devargs->args); return -rte_errno; diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 7d8c055b80..8fc36eb426 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -780,7 +780,7 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower) /* Now parse PCI device args passed for representor info */ if (pci_dev->device.devargs != NULL) { ret = rte_eth_devargs_parse(pci_dev->device.devargs->args, ð_da); - if (ret != 0) { + if (ret < 0) { PMD_INIT_LOG(ERR, "devarg parse failed"); return -EINVAL; } diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 6d57b2ba26..6daf542160 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -3306,7 +3306,7 @@ sfc_parse_rte_devargs(const char *args, struct rte_eth_devargs *devargs) if (args != NULL) { rc = rte_eth_devargs_parse(args, ð_da); - if (rc != 0) { + if (rc < 0) { SFC_GENERIC_LOG(ERR, "Failed to parse generic devargs '%s'", args); diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c index bd917a15fc..62a06b75a2 100644 --- a/lib/ethdev/ethdev_driver.c +++ b/lib/ethdev/ethdev_driver.c @@ -470,15 +470,14 @@ eth_dev_devargs_tokenise(struct rte_kvargs *arglist, const char *str_in) } int -rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) +rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_devargs) { - struct rte_kvargs args; + struct rte_eth_devargs *eth_da; struct rte_kvargs_pair *pair; - unsigned int i; + struct rte_kvargs args; + unsigned int i, j = 0; int result = 0; - memset(eth_da, 0, sizeof(*eth_da)); - result = eth_dev_devargs_tokenise(&args, dargs); if (result < 0) goto parse_cleanup; @@ -486,18 +485,16 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) for (i = 0; i < args.count; i++) { pair = &args.pairs[i]; if (strcmp("representor", pair->key) == 0) { - if (eth_da->type != RTE_ETH_REPRESENTOR_NONE) { - RTE_ETHDEV_LOG_LINE(ERR, "duplicated representor key: %s", - dargs); - result = -1; - goto parse_cleanup; - } + eth_da = ð_devargs[j]; + memset(eth_da, 0, sizeof(*eth_da)); result = rte_eth_devargs_parse_representor_ports( pair->value, eth_da); if (result < 0) goto parse_cleanup; + j++; } } + result = (int)j; parse_cleanup: free(args.str); diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index b482cd12bb..6f4f1a1606 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -1800,10 +1800,10 @@ rte_eth_representor_id_get(uint16_t port_id, * @param devargs * device arguments * @param eth_devargs - * parsed ethdev specific arguments. + * contiguous memory populated with parsed ethdev specific arguments. * * @return - * Negative errno value on error, 0 on success. + * Negative errno value on error, no of devargs parsed on success. */ __rte_internal int From patchwork Thu Jan 11 06:44:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harman Kalra X-Patchwork-Id: 135837 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 826524388D; Thu, 11 Jan 2024 07:45:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CC7E40685; Thu, 11 Jan 2024 07:45:02 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 7176540042 for ; Thu, 11 Jan 2024 07:45:00 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40B6CDBa012117; Wed, 10 Jan 2024 22:44:57 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=pfpt0220; bh=atMatWB+RXCEjXapD5cjv 565eTbOiD27d1mudjJf2nw=; b=VloZyfEjIsa0S8i+35MlEZDWHEqqos9MpVGQB dSgzsA5tKRez4AvfV+q6MsXAp7Ixpmb8bFKlItG+a5NDdYxn5HRt8u+Ff9LM+EXT HzZ4/QQLPgrk1KUL0H2OcN44TgvwWHyzGBQ7RCK6Dgbv0wRLC9dGeBqX9pZNK0C3 XlgCMzPAEAvp/vcfjIvCEhn7yTQAkbu9lkXsIjXw4e5pRxSjSlb5c2Tikp3FQXwF BFLB3vfkOWG33ESc6ARuYiL9ZucD/iXNFjHHxfSYHaO409NofauS784gvBKYQREb DbUJ3OIj+c1oHLQ1OYFeJqTK/Vo1LjL3L4j0Daxd3R8Pvrh9Q== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vjaux835t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 10 Jan 2024 22:44:57 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 10 Jan 2024 22:44:55 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 10 Jan 2024 22:44:55 -0800 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id D26793F7043; Wed, 10 Jan 2024 22:44:53 -0800 (PST) From: Harman Kalra To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , Harman Kalra Subject: [PATCH 2/2] doc: multiple representors in one device Date: Thu, 11 Jan 2024 12:14:32 +0530 Message-ID: <20240111064432.193119-3-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240111064432.193119-1-hkalra@marvell.com> References: <20240111064432.193119-1-hkalra@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: ktxqP5fvtM4odkZKQ0ZxtsznTMfX9il9 X-Proofpoint-GUID: ktxqP5fvtM4odkZKQ0ZxtsznTMfX9il9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 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 Updating the documentation with the pattern format for enabling multiple representors in one device Signed-off-by: Harman Kalra --- doc/guides/prog_guide/poll_mode_drv.rst | 4 +++- doc/guides/prog_guide/switch_representation.rst | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst index c145a9066c..76285e71e2 100644 --- a/doc/guides/prog_guide/poll_mode_drv.rst +++ b/doc/guides/prog_guide/poll_mode_drv.rst @@ -376,7 +376,7 @@ parameters to those ports. * ``representor`` for a device which supports the creation of representor ports this argument allows user to specify which switch ports to enable port - representors for. Multiple representors in one device argument is invalid:: + representors for:: -a DBDF,representor=vf0 -a DBDF,representor=vf[0,4,6,9] @@ -389,6 +389,8 @@ parameters to those ports. -a DBDF,representor=pf1vf0 -a DBDF,representor=pf[0-1]sf[0-127] -a DBDF,representor=pf1 + -a DBDF,representor=pf[0-1],representor=pf2vf[0-2],representor=pf3[3,5-8] + (Enabling creation of multiple representors in one device argument) Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs. diff --git a/doc/guides/prog_guide/switch_representation.rst b/doc/guides/prog_guide/switch_representation.rst index 6fd7b98bdc..fde8c790ba 100644 --- a/doc/guides/prog_guide/switch_representation.rst +++ b/doc/guides/prog_guide/switch_representation.rst @@ -77,6 +77,7 @@ thought as a software "patch panel" front-end for applications. -a pci:dbdf,representor=sf1 -a pci:dbdf,representor=sf[0-1023] -a pci:dbdf,representor=sf[0,2-1023] + -a pci:dbdf,representor=pf[0-1],representor=pf2vf[0-2],representor=pf3[3,5] - As virtual devices, they may be more limited than their physical counterparts, for instance by exposing only a subset of device