The current format for a port representor parameter is
'-a DBDF,representor=pfXvfY'.
That parameter syntax describes port representor relative to
PCI device DBDF.
In that notation VF Y belongs to PF X and PF X is relative to DBDF.

The syntax 'pfXvfY' will probe 2 port representors: PF X and VF Y.
If we want to refer only to VF Y related to PF X, the parameter must
be '(pfX)vfY'.
In this case only VF Y representor will be probed.

Signed-off-by: Gregory Etelson <[email protected]>
---
 doc/guides/prog_guide/ethdev/ethdev.rst | 27 ++++++++++++++++++++-----
 lib/ethdev/ethdev_driver.h              |  4 ++++
 lib/ethdev/ethdev_private.c             | 13 ++++++++++--
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/doc/guides/prog_guide/ethdev/ethdev.rst 
b/doc/guides/prog_guide/ethdev/ethdev.rst
index 89eb31a48d..69f84325c7 100644
--- a/doc/guides/prog_guide/ethdev/ethdev.rst
+++ b/doc/guides/prog_guide/ethdev/ethdev.rst
@@ -379,18 +379,35 @@ parameters to those ports.
    -a DBDF,representor=vf[0,4,6,9]
    -a DBDF,representor=vf[0-31]
    -a DBDF,representor=vf[0,2-4,7,9-11]
+
+  These example will attach VF representors relative to DBDF.
+  The VF IDs can be a list, a range or a mix.
+  SF representors follow the same syntax::
+
    -a DBDF,representor=sf0
    -a DBDF,representor=sf[1,3,5]
    -a DBDF,representor=sf[0-1023]
    -a DBDF,representor=sf[0,2-4,7,9-11]
+
+  If there are multiple PFs associated with the same PCI device,
+  the PF ID must be used to distinguish between representors relative to 
different PFs::
+
    -a DBDF,representor=pf1vf0
-   -a DBDF,representor=pf[0-1]sf[0-127]
-   -a DBDF,representor=pf1
+   -a DBDF,representor=pf[0-1]vf0
+
+  The example above will attach 4 representors pf0vf0, pf1vf0, pf0 and pf1.
+  If only VF representors are required, the PF part must be enclosed with 
parenthesis::
+
+   -a DBDF,representor=(pf[0-1])vf0
+
+  The example above will attach 2 representors pf0vf0, pf1vf0.
+
+  List of representors for the same PCI device is enclosed in square brackets::
+
    -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.
+  Note: PMDs may have additional extensions for the representor parameter, and 
users
+  should consult the relevant PMD documentation to see support devargs.
 
 Extended Statistics API
 ~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index db0b3d2c40..645e76015a 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -2012,6 +2012,8 @@ __rte_internal
 int
 rte_eth_switch_domain_free(uint16_t domain_id);
 
+#define RTE_ETH_DEVARG_IGNORE_PF_REPRESENTOR RTE_BIT32(1)
+
 /**
  * Generic Ethernet device arguments
  *
@@ -2024,6 +2026,8 @@ struct rte_eth_devargs {
        /** number of controllers in multi-host controllers field */
        uint16_t ports[RTE_MAX_ETHPORTS];
        /** port/s number to enable on a multi-port single function */
+       uint32_t port_flags;
+       /** ports flags for special processing */
        uint16_t nb_ports;
        /** number of ports in ports field */
        uint16_t representor_ports[RTE_MAX_ETHPORTS];
diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c
index a881e9c003..df5fdf25ec 100644
--- a/lib/ethdev/ethdev_private.c
+++ b/lib/ethdev/ethdev_private.c
@@ -152,11 +152,20 @@ rte_eth_devargs_parse_representor_ports(char *str, void 
*data)
                if (str == NULL)
                        goto done;
        }
-       if (str[0] == 'p' && str[1] == 'f') {
+       /* pfX... or (pfX)... */
+       if ((str[0] == 'p' && str[1] == 'f') ||
+           (str[0] == '(' && str[1] == 'p' && str[2] == 'f')) {
                eth_da->type = RTE_ETH_REPRESENTOR_PF;
-               str += 2;
+               if (str[0] == '(')
+                       str++; /* advance past leading "(" */
+               str += 2; /* advance past "pf" */
                str = rte_eth_devargs_process_list(str, eth_da->ports,
                                &eth_da->nb_ports, RTE_DIM(eth_da->ports));
+               if (str[0] == ')') {
+                       str++; /* advance past ")" */
+                       eth_da->port_flags =
+                               RTE_ETH_DEVARG_IGNORE_PF_REPRESENTOR;
+               }
                if (str == NULL || str[0] == '\0')
                        goto done;
        } else if (eth_da->nb_mh_controllers > 0) {
-- 
2.51.0

Reply via email to