From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
Cc: <getelson@nvidia.com>, <mkashani@nvidia.com>,
<rasland@nvidia.com>, <thomas@monjalon.net>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [PATCH 1/2] ethdev: make representor parameter more explicit
Date: Tue, 28 Oct 2025 11:58:29 +0200 [thread overview]
Message-ID: <20251028095831.53669-1-getelson@nvidia.com> (raw)
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,
ð_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
next reply other threads:[~2025-10-28 10:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 9:58 Gregory Etelson [this message]
2025-10-28 9:58 ` [PATCH 2/2] net/mlx5: support PF representor suppresion in multi-port E-Switch Gregory Etelson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251028095831.53669-1-getelson@nvidia.com \
--to=getelson@nvidia.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=mkashani@nvidia.com \
--cc=rasland@nvidia.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).