> -----Original Message-----
> From: Harman Kalra <hka...@marvell.com>
> Sent: Monday, January 22, 2024 3:19 AM
> To: dev@dpdk.org; Thomas Monjalon <tho...@monjalon.net>; Ferruh Yigit
> <ferruh.yi...@amd.com>; Andrew Rybchenko
> <andrew.rybche...@oktetlabs.ru>; Ajit Khaparde
> <ajit.khapa...@broadcom.com>; Somnath Kotur
> <somnath.ko...@broadcom.com>; John Daley <johnd...@cisco.com>; Hyong
> Youb Kim <hyon...@cisco.com>; Yuying Zhang <yuying.zh...@intel.com>;
> Beilei Xing <beilei.x...@intel.com>; Qiming Yang <qiming.y...@intel.com>; Qi
> Zhang <qi.z.zh...@intel.com>; Wenjun Wu <wenjun1...@intel.com>;
> Dariusz Sosnowski <dsosnow...@nvidia.com>; Viacheslav Ovsiienko
> <viachesl...@nvidia.com>; Ori Kam <or...@nvidia.com>; Suanming Mou
> <suanmi...@nvidia.com>; Matan Azrad <ma...@nvidia.com>; Chaoyong
> He <chaoyong...@corigine.com>
> Cc: Harman Kalra <hka...@marvell.com>
> Subject: [PATCH v4 1/1] ethdev: parsing multiple representor devargs string
>
> [You don't often get email from hka...@marvell.com. Learn why this is
> important at https://aka.ms/LearnAboutSenderIdentification ]
>
> 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:
> <PCI BDF>,representor=[pf[0-1],pf2vf[1,2-3],[4-5]]
>
> Signed-off-by: Harman Kalra <hka...@marvell.com>
> ---
> doc/guides/prog_guide/poll_mode_drv.rst | 4 +-
> .../prog_guide/switch_representation.rst | 1 +
> drivers/net/bnxt/bnxt_ethdev.c | 4 +-
> drivers/net/enic/enic_ethdev.c | 4 +-
> drivers/net/i40e/i40e_ethdev.c | 4 +-
> drivers/net/ice/ice_dcf_ethdev.c | 4 +-
> drivers/net/ixgbe/ixgbe_ethdev.c | 4 +-
> drivers/net/mlx5/linux/mlx5_os.c | 8 +-
> .../net/nfp/flower/nfp_flower_representor.c | 4 +-
> drivers/net/sfc/sfc_ethdev.c | 4 +-
> lib/ethdev/ethdev_driver.c | 108 +++++++++++++++---
> lib/ethdev/ethdev_driver.h | 9 +-
> 12 files changed, 122 insertions(+), 36 deletions(-)
>
> diff --git a/doc/guides/prog_guide/poll_mode_drv.rst
> b/doc/guides/prog_guide/poll_mode_drv.rst
> index c145a9066c..5008b41c60 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],pf2vf[0-2],pf3[3,5-8]]
> + (Multiple representors in one device argument can be represented as
> + a list)
>
> 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..46e0ca85a5 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],pf2vf[0-2],pf3[3,5]]
>
> - As virtual devices, they may be more limited than their physical
> counterparts, for instance by exposing only a subset of device diff --git
> a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index
> acf7e6e46e..5d4f599044 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -6383,8 +6383,8 @@ 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)
> + ð_da, 1);
> + if (ret < 0)
> return ret;
> }
>
...
> a/drivers/net/nfp/flower/nfp_flower_representor.c
> b/drivers/net/nfp/flower/nfp_flower_representor.c
> index 5f7c1fa737..63fe37c8d7 100644
> --- a/drivers/net/nfp/flower/nfp_flower_representor.c
> +++ b/drivers/net/nfp/flower/nfp_flower_representor.c
> @@ -792,8 +792,8 @@ 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) {
> + ret = rte_eth_devargs_parse(pci_dev->device.devargs->args,
> ð_da, 1);
> + if (ret < 0) {
> PMD_INIT_LOG(ERR, "devarg parse failed");
> return -EINVAL;
> }
Sorry, I don't quite understand why change 'ret != 0' to 'ret < 0'?
Compare return value with 0 or NULL is the specification for our PMD, we prefer
not to change it if don't have a good reason.
Thanks.
> --
> 2.18.0