ethdev: make representor parameter more explicit
PATCH 1/2 ethdev: make representor parameter more explicit
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.
--- 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(-)
doc/guides/prog_guide/ethdev/ethdev.rst +22 -5
@@ -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 ~~~~~~~~~~~~~~~~~~~~~~~
lib/ethdev/ethdev_driver.h +4 -0
@@ -2012,6 +2012,8 @@ __rte_internalint 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 ];
lib/ethdev/ethdev_private.c +11 -2
@@ -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[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 ) {
Signature · 1 line
2.51.0
PATCH 2/2 net/mlx5: support PF representor suppresion in multi-port E-Switch
In multi-port E-Switch setup, the MLX5 PMD always added
PF representor port.
For example, representor=pf1vf[0,1] implicitly added PF1 representor port:
``` Port Name 0 p0 1 p1 2 representor_c0pf1vf0 3 representor_c0pf1vf1 ```
The patch adds support for the new representor format that suppresses PF representor attachment:
Example: representor=(pf1)vf[0,1]
``` Port Name 0 p0 1 representor_c0pf1vf0 2 representor_c0pf1vf1 ```
--- drivers/net/mlx5/linux/mlx5_os.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +12 -2
@@ -2284,6 +2284,12 @@ mlx5_device_mpesw_pci_match(struct ibv_device *ibv,return -1 ; } +static inline bool +mlx5_ingnore_pf_representor (const struct rte_eth_devargs *eth_da) +{ +return (eth_da->port_flags &RTE_ETH_DEVARG_IGNORE_PF_REPRESENTOR ) !=0 ; +} +/** * Register a PCI device within bonding. *
@@ -2593,8 +2599,12 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, list[ns].info.master =1 ; list[ns].info.representor =0 ; }else { - list[ns].info.master =0 ; - list[ns].info.representor =1 ; +if (mlx5_ingnore_pf_representor (req_eth_da)) { +continue ; + }else { + list[ns].info.master =0 ; + list[ns].info.representor =1 ; + } }/* * Ports of this type have uplink port index
Signature · 1 line
2.51.0
PATCH v2 1/2 ethdev: make representor parameter more explicit
In reply to Gregory EtelsonThe 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.
---
v2: Add comments.
In rte_eth_devargs structure rename port_flags -> flags. --- 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(-)
doc/guides/prog_guide/ethdev/ethdev.rst +22 -5
@@ -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 ~~~~~~~~~~~~~~~~~~~~~~~
lib/ethdev/ethdev_driver.h +5 -0
@@ -2012,6 +2012,10 @@ __rte_internalint 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_IGNORE_PF_REPRESENTOR 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;
lib/ethdev/ethdev_private.c +11 -2
@@ -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_IGNORE_PF_REPRESENTOR ; + }if (str ==NULL || str[0 ] =='\0' ) goto done; }else if (eth_da->nb_mh_controllers >0 ) {
Signature · 1 line
2.51.0
PATCH v2 2/2 net/mlx5: support PF representor suppresion in multi-port E-Switch
In multi-port E-Switch setup, the MLX5 PMD always added
PF representor port.
For example, representor=pf1vf[0,1] implicitly added PF1 representor port:
``` Port Name 0 p0 1 p1 2 representor_c0pf1vf0 3 representor_c0pf1vf1 ```
The patch adds support for the new representor format that suppresses PF representor attachment:
Example: representor=(pf1)vf[0,1]
``` Port Name 0 p0 1 representor_c0pf1vf0 2 representor_c0pf1vf1 ```
--- drivers/net/mlx5/linux/mlx5_os.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/mlx5/linux/mlx5_os.c +8 -0
@@ -2284,6 +2284,12 @@ mlx5_device_mpesw_pci_match(struct ibv_device *ibv,return -1 ; } +static inline bool +mlx5_ignore_pf_representor (const struct rte_eth_devargs *eth_da) +{ +return (eth_da->flags &RTE_ETH_DEVARG_IGNORE_PF_REPRESENTOR ) !=0 ; +} +/** * Register a PCI device within bonding. *
@@ -2592,6 +2598,8 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,if (list[ns].info.port_name == mpesw) { list[ns].info.master =1 ; list[ns].info.representor =0 ; + }else if (mlx5_ignore_pf_representor (ð_da)) { +continue ; }else { list[ns].info.master =0 ; list[ns].info.representor =1 ;
Signature · 1 line
2.51.0
PATCH v3 1/2 ethdev: make representor parameter more explicit
In reply to Gregory EtelsonThe 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.
---
v2: Add comments.
In rte_eth_devargs structure rename port_flags -> flags. --- 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(-)
doc/guides/prog_guide/ethdev/ethdev.rst +22 -5
@@ -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 ~~~~~~~~~~~~~~~~~~~~~~~
lib/ethdev/ethdev_driver.h +5 -0
@@ -2012,6 +2012,10 @@ __rte_internalint 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_IGNORE_PF_REPRESENTOR 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;
lib/ethdev/ethdev_private.c +11 -2
@@ -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_IGNORE_PF_REPRESENTOR ; + }if (str ==NULL || str[0 ] =='\0' ) goto done; }else if (eth_da->nb_mh_controllers >0 ) {
Signature · 1 line
2.51.0
PATCH v3 2/2 net/mlx5: support PF representor suppression in multi-port E-Switch
In multi-port E-Switch setup, the MLX5 PMD always added
PF representor port.
For example, representor=pf1vf[0,1] implicitly added PF1 representor port:
``` Port Name 0 p0 1 p1 2 representor_c0pf1vf0 3 representor_c0pf1vf1 ```
The patch adds support for the new representor format that suppresses PF representor attachment:
Example: representor=(pf1)vf[0,1]
``` Port Name 0 p0 1 representor_c0pf1vf0 2 representor_c0pf1vf1 ```
---
v2: Use updated rte_eth_devargs::flags.
v3: Fix typo in comment.
--- drivers/net/mlx5/linux/mlx5_os.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/mlx5/linux/mlx5_os.c +8 -0
@@ -2284,6 +2284,12 @@ mlx5_device_mpesw_pci_match(struct ibv_device *ibv,return -1 ; } +static inline bool +mlx5_ignore_pf_representor (const struct rte_eth_devargs *eth_da) +{ +return (eth_da->flags &RTE_ETH_DEVARG_IGNORE_PF_REPRESENTOR ) !=0 ; +} +/** * Register a PCI device within bonding. *
@@ -2592,6 +2598,8 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,if (list[ns].info.port_name == mpesw) { list[ns].info.master =1 ; list[ns].info.representor =0 ; + }else if (mlx5_ignore_pf_representor (ð_da)) { +continue ; }else { list[ns].info.master =0 ; list[ns].info.representor =1 ;
Signature · 1 line
2.51.0
Looks good as is, a couple of minor observations.
lib/ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 157
Quoted 3 lines
lib/ethdev/ethdev_private.c +3
-0+/* pfX... or (pfX)... */ +if ((str[0 ] =='p' && str[1 ] =='f' ) || + (str[0 ] =='(' && str[1 ] =='p' && str[2 ] =='f' )) {
This is correct but seem like it is getting verbose. If there are more cases than this looking for prefix, might be useful to have helper function.
Looks like devargs could use some better pattern matching, lots of string handling already in this code. String processing in C is often an error trap.
lib/ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 167
Quoted 4 lines
lib/ethdev/ethdev_private.c +4
-0+if (str !=NULL && str[0 ] ==')' ) { + str++;/* advance past ")" */ + eth_da->flags = +RTE_ETH_DEVARG_IGNORE_PF_REPRESENTOR ;
Can't that go on one line, max line length in DPDK is 100. Is there a case where there could be multiple devargs flags?
05/11/2025 20:20, Stephen Hemminger:
Quoted 14 lines
Looks good as is, a couple of minor observations.
lib/ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 157
Quoted 3 lines
lib/ethdev/ethdev_private.c +3
-0+/* pfX... or (pfX)... */ +if ((str[0 ] =='p' && str[1 ] =='f' ) || + (str[0 ] =='(' && str[1 ] =='p' && str[2 ] =='f' )) {This is correct but seem like it is getting verbose. If there are more cases than this looking for prefix, might be useful to have helper function.
Looks like devargs could use some better pattern matching, lots of string handling already in this code. String processing in C is often an error trap.
Quoted 7 lines
lib/ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 167
Quoted 4 lines
lib/ethdev/ethdev_private.c +4
-0+if (str !=NULL && str[0 ] ==')' ) { + str++;/* advance past ")" */ + eth_da->flags = +RTE_ETH_DEVARG_IGNORE_PF_REPRESENTOR ;Can't that go on one line, max line length in DPDK is 100. Is there a case where there could be multiple devargs flags?
It is the first flag.
I would prefer this flag to be named RTE_ETH_DEVARG_REPRESENTOR_IGNORE_PF.
PATCH v4 1/2 ethdev: make representor parameter more explicit
In reply to Gregory EtelsonThe 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.
---
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(-)
doc/guides/prog_guide/ethdev/ethdev.rst +22 -5
@@ -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 ~~~~~~~~~~~~~~~~~~~~~~~
lib/ethdev/ethdev_driver.h +5 -0
@@ -2012,6 +2012,10 @@ __rte_internalint 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;
lib/ethdev/ethdev_private.c +11 -2
@@ -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 ) {
Signature · 1 line
2.51.0
PATCH v4 2/2 net/mlx5: support PF representor suppression in multi-port E-Switch
In multi-port E-Switch setup, the MLX5 PMD always added
PF representor port.
For example, representor=pf1vf[0,1] implicitly added PF1 representor port:
``` Port Name 0 p0 1 p1 2 representor_c0pf1vf0 3 representor_c0pf1vf1 ```
The patch adds support for the new representor format that suppresses PF representor attachment:
Example: representor=(pf1)vf[0,1]
``` Port Name 0 p0 1 representor_c0pf1vf0 2 representor_c0pf1vf1 ```
---
v2: Use updated rte_eth_devargs::flags.
v3: Fix typo in comment.
v4: Use update devarg macro name.
--- drivers/net/mlx5/linux/mlx5_os.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/mlx5/linux/mlx5_os.c +8 -0
@@ -2284,6 +2284,12 @@ mlx5_device_mpesw_pci_match(struct ibv_device *ibv,return -1 ; } +static inline bool +mlx5_ignore_pf_representor (const struct rte_eth_devargs *eth_da) +{ +return (eth_da->flags &RTE_ETH_DEVARG_REPRESENTOR_IGNORE_PF ) !=0 ; +} +/** * Register a PCI device within bonding. *
@@ -2592,6 +2598,8 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,if (list[ns].info.port_name == mpesw) { list[ns].info.master =1 ; list[ns].info.representor =0 ; + }else if (mlx5_ignore_pf_representor (ð_da)) { +continue ; }else { list[ns].info.master =0 ; list[ns].info.representor =1 ;
Signature · 1 line
2.51.0
Re: [PATCH v4 2/2] net/mlx5: support PF representor suppression in multi-port E-Switch
Quoted 18 lines · Gregory Etelson
In multi-port E-Switch setup, the MLX5 PMD always added
PF representor port.
For example,representor=pf1vf[0,1]implicitly added PF1 representor port:``` Port Name 0 p0 1 p1 2 representor_c0pf1vf0 3 representor_c0pf1vf1 ```The patch adds support for the new representor format that suppresses PF representor attachment:
Example:
representor=(pf1)vf[0,1]
Quoted 8 lines
``` Port Name 0 p0 1 representor_c0pf1vf0 2 representor_c0pf1vf1 ```Signed-off-by Gregory Etelson <[email protected]>
Quoted 6 lines · Gregory Etelson
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.
Quoted 6 lines
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]>
Thomas Monjalon
Acked-by09/11/2025 15:42, Andrew Rybchenko:
Quoted 7 lines · Gregory Etelson
Quoted 6 lines
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.
Quoted 8 lines
Quoted 6 lines
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]>Acked-by Andrew Rybchenko <[email protected]>
Quoted 11 lines · On Thu, 6 Nov 2025 07:52:44 +0200 Gregory Etelson <[email protected]> wrote:
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.
Quoted 5 lines
Signed-off-by Gregory Etelson <[email protected]>---
v2: Add comments.In rte_eth_devargs structure rename port_flags -> flags.v4: Rename devargs flag macro.
Quoted 6 lines · On Thu, 6 Nov 2025 07:52:44 +0200 Gregory Etelson <[email protected]> wrote:
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.
Quoted 7 lines
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]>---
Both patches queued in next-net