[v3,2/9] ethdev: support new VF representor syntax
diff mbox series

Message ID 20210113134422.15723-3-xuemingl@nvidia.com
State New
Delegated to: Thomas Monjalon
Headers show
Series
  • Untitled series #14692
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Xueming Li Jan. 13, 2021, 1:44 p.m. UTC
To prepare for more representor types, this patch adds compatible VF
representor devargs syntax:

vf#: new VF port representor/s, example: vf[0-3], vf2

For backwards compatibility, representor "#" is deemed as "vf#".

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 doc/guides/prog_guide/poll_mode_drv.rst | 6 +++---
 lib/librte_ethdev/ethdev_private.c      | 5 ++++-
 2 files changed, 7 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst
index 239ec820ea..979a2bab9d 100644
--- a/doc/guides/prog_guide/poll_mode_drv.rst
+++ b/doc/guides/prog_guide/poll_mode_drv.rst
@@ -374,9 +374,9 @@  parameters to those ports.
   this argument allows user to specify which switch ports to enable port
   representors for.::
 
-   -a DBDF,representor=0
-   -a DBDF,representor=[0,4,6,9]
-   -a DBDF,representor=[0-31]
+   -a DBDF,representor=vf0
+   -a DBDF,representor=vf[0,4,6,9]
+   -a DBDF,representor=vf[0-31]
 
 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/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c
index c219164a4a..54f565ca37 100644
--- a/lib/librte_ethdev/ethdev_private.c
+++ b/lib/librte_ethdev/ethdev_private.c
@@ -95,6 +95,7 @@  rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,
 /*
  * representor format:
  *   #: range or single number of VF representor - legacy
+ *   vf#: VF port representor/s
  */
 int
 rte_eth_devargs_parse_representor_ports(char *str, void *data)
@@ -102,8 +103,10 @@  rte_eth_devargs_parse_representor_ports(char *str, void *data)
 	struct rte_eth_devargs *eth_da = data;
 	int ret;
 
-	/* Number # alone implies VF */
+	/* Parse vf# or number # alone implies VF */
 	eth_da->type = RTE_ETH_REPRESENTOR_VF;
+	if (str[0] == 'v'  && str[1] == 'f')
+		str += 2;
 	ret = rte_eth_devargs_process_list(str, eth_da->representor_ports,
 		&eth_da->nb_representor_ports, RTE_MAX_ETHPORTS);
 	if (ret < 0)