* [PATCH 2/2] net/mlx5: support PF representor suppresion in multi-port E-Switch
2025-10-28 9:58 [PATCH 1/2] ethdev: make representor parameter more explicit Gregory Etelson
@ 2025-10-28 9:58 ` Gregory Etelson
2025-11-05 17:37 ` [PATCH v2 1/2] ethdev: make representor parameter more explicit Gregory Etelson
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Gregory Etelson @ 2025-10-28 9:58 UTC (permalink / raw)
To: dev
Cc: getelson, mkashani, rasland, thomas, Dariusz Sosnowski,
Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad
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
```
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
drivers/net/mlx5/linux/mlx5_os.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 8d11b1ac3a..92084b4cdd 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -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
--
2.51.0
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v2 1/2] ethdev: make representor parameter more explicit
2025-10-28 9:58 [PATCH 1/2] ethdev: make representor parameter more explicit Gregory Etelson
2025-10-28 9:58 ` [PATCH 2/2] net/mlx5: support PF representor suppresion in multi-port E-Switch Gregory Etelson
@ 2025-11-05 17:37 ` Gregory Etelson
2025-11-05 17:37 ` [PATCH v2 2/2] net/mlx5: support PF representor suppresion in multi-port E-Switch Gregory Etelson
2025-11-05 17:48 ` [PATCH v3 1/2] ethdev: make representor parameter more explicit Gregory Etelson
2025-11-06 5:52 ` [PATCH v4 " Gregory Etelson
3 siblings, 1 reply; 10+ messages in thread
From: Gregory Etelson @ 2025-11-05 17:37 UTC (permalink / raw)
To: dev; +Cc: getelson, mkashani, rasland, thomas, Andrew Rybchenko
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 <getelson@nvidia.com>
---
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(-)
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..31674210fe 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_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;
diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c
index a881e9c003..d332654f00 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_IGNORE_PF_REPRESENTOR;
+ }
if (str == NULL || str[0] == '\0')
goto done;
} else if (eth_da->nb_mh_controllers > 0) {
--
2.51.0
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v2 2/2] net/mlx5: support PF representor suppresion in multi-port E-Switch
2025-11-05 17:37 ` [PATCH v2 1/2] ethdev: make representor parameter more explicit Gregory Etelson
@ 2025-11-05 17:37 ` Gregory Etelson
0 siblings, 0 replies; 10+ messages in thread
From: Gregory Etelson @ 2025-11-05 17:37 UTC (permalink / raw)
To: dev
Cc: getelson, mkashani, rasland, thomas, Dariusz Sosnowski,
Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad
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
```
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
drivers/net/mlx5/linux/mlx5_os.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index c742e0f282..fe80773d49 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -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;
--
2.51.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 1/2] ethdev: make representor parameter more explicit
2025-10-28 9:58 [PATCH 1/2] ethdev: make representor parameter more explicit Gregory Etelson
2025-10-28 9:58 ` [PATCH 2/2] net/mlx5: support PF representor suppresion in multi-port E-Switch Gregory Etelson
2025-11-05 17:37 ` [PATCH v2 1/2] ethdev: make representor parameter more explicit Gregory Etelson
@ 2025-11-05 17:48 ` Gregory Etelson
2025-11-05 17:48 ` [PATCH v3 2/2] net/mlx5: support PF representor suppression in multi-port E-Switch Gregory Etelson
2025-11-05 19:20 ` [PATCH v3 1/2] ethdev: make representor parameter more explicit Stephen Hemminger
2025-11-06 5:52 ` [PATCH v4 " Gregory Etelson
3 siblings, 2 replies; 10+ messages in thread
From: Gregory Etelson @ 2025-11-05 17:48 UTC (permalink / raw)
To: dev; +Cc: getelson, mkashani, rasland, thomas, Andrew Rybchenko
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 <getelson@nvidia.com>
---
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(-)
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..31674210fe 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_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;
diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c
index a881e9c003..d332654f00 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_IGNORE_PF_REPRESENTOR;
+ }
if (str == NULL || str[0] == '\0')
goto done;
} else if (eth_da->nb_mh_controllers > 0) {
--
2.51.0
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v3 2/2] net/mlx5: support PF representor suppression in multi-port E-Switch
2025-11-05 17:48 ` [PATCH v3 1/2] ethdev: make representor parameter more explicit Gregory Etelson
@ 2025-11-05 17:48 ` Gregory Etelson
2025-11-05 19:20 ` [PATCH v3 1/2] ethdev: make representor parameter more explicit Stephen Hemminger
1 sibling, 0 replies; 10+ messages in thread
From: Gregory Etelson @ 2025-11-05 17:48 UTC (permalink / raw)
To: dev
Cc: getelson, mkashani, rasland, thomas, Dariusz Sosnowski,
Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad
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
```
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
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(+)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index c742e0f282..fe80773d49 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -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;
--
2.51.0
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v3 1/2] ethdev: make representor parameter more explicit
2025-11-05 17:48 ` [PATCH v3 1/2] ethdev: make representor parameter more explicit Gregory Etelson
2025-11-05 17:48 ` [PATCH v3 2/2] net/mlx5: support PF representor suppression in multi-port E-Switch Gregory Etelson
@ 2025-11-05 19:20 ` Stephen Hemminger
2025-11-05 21:17 ` Thomas Monjalon
1 sibling, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2025-11-05 19:20 UTC (permalink / raw)
To: Gregory Etelson; +Cc: dev, mkashani, rasland, thomas, Andrew Rybchenko
Looks good as is, a couple of minor observations.
> + /* 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.
> + 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?
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v3 1/2] ethdev: make representor parameter more explicit
2025-11-05 19:20 ` [PATCH v3 1/2] ethdev: make representor parameter more explicit Stephen Hemminger
@ 2025-11-05 21:17 ` Thomas Monjalon
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2025-11-05 21:17 UTC (permalink / raw)
To: Gregory Etelson
Cc: Stephen Hemminger, dev, mkashani, rasland, Andrew Rybchenko
05/11/2025 20:20, Stephen Hemminger:
> Looks good as is, a couple of minor observations.
>
> > + /* 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.
>
> > + 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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v4 1/2] ethdev: make representor parameter more explicit
2025-10-28 9:58 [PATCH 1/2] ethdev: make representor parameter more explicit Gregory Etelson
` (2 preceding siblings ...)
2025-11-05 17:48 ` [PATCH v3 1/2] ethdev: make representor parameter more explicit Gregory Etelson
@ 2025-11-06 5:52 ` Gregory Etelson
2025-11-06 5:52 ` [PATCH v4 2/2] net/mlx5: support PF representor suppression in multi-port E-Switch Gregory Etelson
3 siblings, 1 reply; 10+ messages in thread
From: Gregory Etelson @ 2025-11-06 5:52 UTC (permalink / raw)
To: dev; +Cc: getelson, mkashani, rasland, thomas, Andrew Rybchenko
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 <getelson@nvidia.com>
---
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
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v4 2/2] net/mlx5: support PF representor suppression in multi-port E-Switch
2025-11-06 5:52 ` [PATCH v4 " Gregory Etelson
@ 2025-11-06 5:52 ` Gregory Etelson
0 siblings, 0 replies; 10+ messages in thread
From: Gregory Etelson @ 2025-11-06 5:52 UTC (permalink / raw)
To: dev
Cc: getelson, mkashani, rasland, thomas, Dariusz Sosnowski,
Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad
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
```
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
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(+)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index c742e0f282..dba3b61b68 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -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;
--
2.51.0
^ permalink raw reply [flat|nested] 10+ messages in thread