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 v2 1/2] ethdev: make representor parameter more explicit
Date: Wed, 5 Nov 2025 19:37:16 +0200 [thread overview]
Message-ID: <20251105173718.316971-1-getelson@nvidia.com> (raw)
In-Reply-To: <20251028095831.53669-1-getelson@nvidia.com>
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
next prev parent reply other threads:[~2025-11-05 17:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2025-11-05 17:37 ` [PATCH v2 " Gregory Etelson
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 ` [PATCH v3 1/2] ethdev: make representor parameter more explicit Stephen Hemminger
2025-11-05 21:17 ` Thomas Monjalon
2025-11-06 5:52 ` [PATCH v4 " Gregory Etelson
2025-11-06 5:52 ` [PATCH v4 2/2] net/mlx5: support PF representor suppression in multi-port E-Switch Gregory Etelson
2025-11-12 10:12 ` Dariusz Sosnowski
2025-11-09 14:42 ` [PATCH v4 1/2] ethdev: make representor parameter more explicit Andrew Rybchenko
2025-11-12 10:24 ` Thomas Monjalon
2025-11-12 15:02 ` Stephen Hemminger
2025-11-13 16:41 ` Stephen Hemminger
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=20251105173718.316971-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.