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]> --- v2: Add comments. In rte_eth_devargs structure rename port_flags -> flags. v4: Rename devargs flag macro. --- doc/guides/prog_guide/ethdev/ethdev.rst | 27 ++++++++++++++++++++----- lib/ethdev/ethdev_driver.h | 5 +++++ lib/ethdev/ethdev_private.c | 13 ++++++++++-- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/doc/guides/prog_guide/ethdev/ethdev.rst b/doc/guides/prog_guide/ethdev/ethdev.rst index 89eb31a48d..daaf43ea3b 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 examples 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 parentheses:: + + -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..1255cd6f2c 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -2012,6 +2012,10 @@ __rte_internal int rte_eth_switch_domain_free(uint16_t domain_id); +/* Flags for rte_eth_devargs::flags. */ +/* When enclosed in parentheses, the PF representor is not required. */ +#define RTE_ETH_DEVARG_REPRESENTOR_IGNORE_PF RTE_BIT32(0) + /** * Generic Ethernet device arguments * @@ -2026,6 +2030,7 @@ struct rte_eth_devargs { /** port/s number to enable on a multi-port single function */ uint16_t nb_ports; /** number of ports in ports field */ + uint32_t flags; /* see RTE_ETH_DEVARG_* */ uint16_t representor_ports[RTE_MAX_ETHPORTS]; /** representor port/s identifier to enable on device */ uint16_t nb_representor_ports; diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c index a881e9c003..72a0723846 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, ð_da->nb_ports, RTE_DIM(eth_da->ports)); + if (str != NULL && str[0] == ')') { + str++; /* advance past ")" */ + eth_da->flags = + RTE_ETH_DEVARG_REPRESENTOR_IGNORE_PF; + } if (str == NULL || str[0] == '\0') goto done; } else if (eth_da->nb_mh_controllers > 0) { -- 2.51.0

