DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] ethdev: make representor parameter more explicit
@ 2025-10-28  9:58 Gregory Etelson
  2025-10-28  9:58 ` [PATCH 2/2] net/mlx5: support PF representor suppresion in multi-port E-Switch Gregory Etelson
  0 siblings, 1 reply; 2+ messages in thread
From: Gregory Etelson @ 2025-10-28  9:58 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>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [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
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2025-10-28 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).