DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] app/flow-perf: add represented-port and port-representor flow actions
@ 2026-07-01 15:04 Hadi Sandid
  2026-07-02  8:56 ` [PATCH v2] app/flow-perf: add represented-port/port-representor actions Hadi Sandid
  0 siblings, 1 reply; 2+ messages in thread
From: Hadi Sandid @ 2026-07-01 15:04 UTC (permalink / raw)
  To: wisamm; +Cc: dev, Hadi Sandid

Add 'represented-port' and 'port-representor' action support,
and update documentation.

Signed-off-by: Hadi Sandid <hadisandid@gmail.com>
---
 .mailmap                         |  1 +
 app/test-flow-perf/actions_gen.c | 36 ++++++++++++++++++++++++++++++++
 app/test-flow-perf/main.c        | 21 +++++++++++++++++--
 doc/guides/tools/flow-perf.rst   | 20 ++++++++++++++++++
 4 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/.mailmap b/.mailmap
index c5bc728fae..c51b14fbda 100644
--- a/.mailmap
+++ b/.mailmap
@@ -557,6 +557,7 @@ Guruprasad Rao <guruprasadx.rao@intel.com>
 Guy Kaneti <guyk@marvell.com>
 Guy Tzalik <gtzalik@amazon.com>
 H. Peter Anvin <hpa@linux.intel.com>
+Hadi Sandid <hadisandid@gmail.com>
 Haggai Eran <haggaie@nvidia.com>
 Haifei Luo <haifeil@nvidia.com>
 Haifeng Gao <gaohaifeng.gao@huawei.com>
diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 9d102e3af4..4a17349f92 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -187,6 +187,34 @@ add_port_id(struct rte_flow_action *actions,
 	actions[actions_counter].conf = &port_id;
 }
 
+static void
+add_represented_port(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	struct additional_para para)
+{
+	static struct rte_flow_action_ethdev represented_port = {
+		.port_id = PORT_ID_DST,
+	};
+
+	represented_port.port_id = para.dst_port;
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT;
+	actions[actions_counter].conf = &represented_port;
+}
+
+static void
+add_port_representor(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	struct additional_para para)
+{
+	static struct rte_flow_action_ethdev port_representor = {
+		.port_id = PORT_ID_DST,
+	};
+
+	port_representor.port_id = para.dst_port;
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR;
+	actions[actions_counter].conf = &port_representor;
+}
+
 static void
 add_drop(struct rte_flow_action *actions,
 	uint8_t actions_counter,
@@ -1102,6 +1130,14 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID),
 			.funct = add_port_id
 		},
+		{
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT),
+			.funct = add_represented_port,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR),
+			.funct = add_port_representor,
+		},
 		{
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_DROP),
 			.funct = add_drop,
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 6636d1517f..8147d41d4b 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -267,6 +267,18 @@ static const struct option_dict {
 		.map = &flow_actions[0],
 		.map_idx = &actions_idx
 	},
+	{
+		.str = "represented-port",
+		.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT),
+		.map = &flow_actions[0],
+		.map_idx = &actions_idx
+	},
+	{
+		.str = "port-representor",
+		.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR),
+		.map = &flow_actions[0],
+		.map_idx = &actions_idx
+	},
 	{
 		.str = "rss",
 		.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_RSS),
@@ -542,6 +554,8 @@ usage(char *progname)
 
 	printf("To set flow actions:\n");
 	printf("  --port-id: add port-id action in flow actions\n");
+	printf("  --represented-port: add represented-port action in flow actions\n");
+	printf("  --port-representor: add port-representor action in flow actions\n");
 	printf("  --rss: add rss action in flow actions\n");
 	printf("  --queue: add queue action in flow actions\n");
 	printf("  --jump: add jump action in flow actions\n");
@@ -699,6 +713,8 @@ args_parse(int argc, char **argv)
 		{ "icmpv6",                     0, 0, 0 },
 		/* Actions */
 		{ "port-id",                    2, 0, 0 },
+		{ "represented-port",           2, 0, 0 },
+		{ "port-representor",           2, 0, 0 },
 		{ "rss",                        0, 0, 0 },
 		{ "queue",                      0, 0, 0 },
 		{ "jump",                       0, 0, 0 },
@@ -913,8 +929,9 @@ args_parse(int argc, char **argv)
 					rte_exit(EXIT_FAILURE, "Invalid hairpin config mask\n");
 				hairpin_conf_mask = hp_conf;
 			}
-			if (strcmp(lgopts[opt_idx].name,
-					"port-id") == 0) {
+			if (strcmp(lgopts[opt_idx].name, "port-id") == 0 ||
+			    strcmp(lgopts[opt_idx].name, "represented-port") == 0 ||
+			    strcmp(lgopts[opt_idx].name, "port-representor") == 0) {
 				uint16_t port_idx = 0;
 
 				token = strtok(optarg, ",");
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 657f06fec7..7f97a9940d 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -248,6 +248,26 @@ Actions:
        specify the destination port, the number of values should be
        the same with number of set bits in portmask.
 
+*	``--represented-port``
+	Add represented port redirection action to all flows actions.
+	Port redirection destination is defined in config.h under
+	PORT_ID_DST, default value = 1.
+
+		It can also have an optional parameter like
+		--represented-port=N[,M] to specify the destination port. The
+		number of values should be the same as the number of set bits in
+		portmask.
+
+*	``--port-representor``
+	Add port representor redirection action to all flows actions.
+	Port redirection destination is defined in config.h under
+	PORT_ID_DST, default value = 1.
+
+		It can also have an optional parameter like
+		--port-representor=N[,M] to specify the destination port. The
+		number of values should be the same as the number of set bits in
+		portmask.
+
 *	``--rss``
 	Add RSS action to all flows actions,
 	The queues in RSS action will be all queues configured
-- 
2.43.0


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

* [PATCH v2] app/flow-perf: add represented-port/port-representor actions
  2026-07-01 15:04 [PATCH] app/flow-perf: add represented-port and port-representor flow actions Hadi Sandid
@ 2026-07-02  8:56 ` Hadi Sandid
  0 siblings, 0 replies; 2+ messages in thread
From: Hadi Sandid @ 2026-07-02  8:56 UTC (permalink / raw)
  To: wisamm; +Cc: dev, Hadi Sandid

Add 'represented-port' and 'port-representor' action support,
and update documentation.

Signed-off-by: Hadi Sandid <hadisandid@gmail.com>
---
v2:
  - use per-lcore port-action configurations during concurrent flow creation
  - clarify port redirection actions and destination option handling

 .mailmap                         |  1 +
 app/test-flow-perf/actions_gen.c | 46 ++++++++++++++++++++++++++++----
 app/test-flow-perf/main.c        | 31 ++++++++++++++++-----
 doc/guides/tools/flow-perf.rst   | 42 ++++++++++++++++++++++++-----
 4 files changed, 102 insertions(+), 18 deletions(-)

diff --git a/.mailmap b/.mailmap
index c5bc728fae..c51b14fbda 100644
--- a/.mailmap
+++ b/.mailmap
@@ -557,6 +557,7 @@ Guruprasad Rao <guruprasadx.rao@intel.com>
 Guy Kaneti <guyk@marvell.com>
 Guy Tzalik <gtzalik@amazon.com>
 H. Peter Anvin <hpa@linux.intel.com>
+Hadi Sandid <hadisandid@gmail.com>
 Haggai Eran <haggaie@nvidia.com>
 Haifei Luo <haifeil@nvidia.com>
 Haifeng Gao <gaohaifeng.gao@huawei.com>
diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 9d102e3af4..2a1fca9d7a 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -178,13 +178,41 @@ add_port_id(struct rte_flow_action *actions,
 	uint8_t actions_counter,
 	struct additional_para para)
 {
-	static struct rte_flow_action_port_id port_id = {
-		.id = PORT_ID_DST,
-	};
+	static alignas(RTE_CACHE_LINE_SIZE)
+	    struct rte_flow_action_port_id port_ids[RTE_MAX_LCORE];
+	uint8_t ti = para.core_idx;
 
-	port_id.id = para.dst_port;
+	port_ids[ti].id = para.dst_port;
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID;
-	actions[actions_counter].conf = &port_id;
+	actions[actions_counter].conf = &port_ids[ti];
+}
+
+static void
+add_represented_port(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	struct additional_para para)
+{
+	static alignas(RTE_CACHE_LINE_SIZE)
+	    struct rte_flow_action_ethdev represented_ports[RTE_MAX_LCORE];
+	uint8_t ti = para.core_idx;
+
+	represented_ports[ti].port_id = para.dst_port;
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT;
+	actions[actions_counter].conf = &represented_ports[ti];
+}
+
+static void
+add_port_representor(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	struct additional_para para)
+{
+	static alignas(RTE_CACHE_LINE_SIZE)
+	    struct rte_flow_action_ethdev port_representors[RTE_MAX_LCORE];
+	uint8_t ti = para.core_idx;
+
+	port_representors[ti].port_id = para.dst_port;
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR;
+	actions[actions_counter].conf = &port_representors[ti];
 }
 
 static void
@@ -1102,6 +1130,14 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID),
 			.funct = add_port_id
 		},
+		{
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT),
+			.funct = add_represented_port,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR),
+			.funct = add_port_representor,
+		},
 		{
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_DROP),
 			.funct = add_drop,
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 6636d1517f..646caccfda 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -267,6 +267,18 @@ static const struct option_dict {
 		.map = &flow_actions[0],
 		.map_idx = &actions_idx
 	},
+	{
+		.str = "represented-port",
+		.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT),
+		.map = &flow_actions[0],
+		.map_idx = &actions_idx
+	},
+	{
+		.str = "port-representor",
+		.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR),
+		.map = &flow_actions[0],
+		.map_idx = &actions_idx
+	},
 	{
 		.str = "rss",
 		.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_RSS),
@@ -542,6 +554,8 @@ usage(char *progname)
 
 	printf("To set flow actions:\n");
 	printf("  --port-id: add port-id action in flow actions\n");
+	printf("  --represented-port: add represented-port action in flow actions\n");
+	printf("  --port-representor: add port-representor action in flow actions\n");
 	printf("  --rss: add rss action in flow actions\n");
 	printf("  --queue: add queue action in flow actions\n");
 	printf("  --jump: add jump action in flow actions\n");
@@ -699,6 +713,8 @@ args_parse(int argc, char **argv)
 		{ "icmpv6",                     0, 0, 0 },
 		/* Actions */
 		{ "port-id",                    2, 0, 0 },
+		{ "represented-port",           2, 0, 0 },
+		{ "port-representor",           2, 0, 0 },
 		{ "rss",                        0, 0, 0 },
 		{ "queue",                      0, 0, 0 },
 		{ "jump",                       0, 0, 0 },
@@ -913,14 +929,17 @@ args_parse(int argc, char **argv)
 					rte_exit(EXIT_FAILURE, "Invalid hairpin config mask\n");
 				hairpin_conf_mask = hp_conf;
 			}
-			if (strcmp(lgopts[opt_idx].name,
-					"port-id") == 0) {
+			if (strcmp(lgopts[opt_idx].name, "port-id") == 0 ||
+			    strcmp(lgopts[opt_idx].name, "represented-port") == 0 ||
+			    strcmp(lgopts[opt_idx].name, "port-representor") == 0) {
 				uint16_t port_idx = 0;
 
-				token = strtok(optarg, ",");
-				while (token != NULL) {
-					dst_ports[port_idx++] = atoi(token);
-					token = strtok(NULL, ",");
+				if (optarg != NULL) {
+					token = strtok(optarg, ",");
+					while (token != NULL) {
+						dst_ports[port_idx++] = atoi(token);
+						token = strtok(NULL, ",");
+					}
 				}
 			}
 			if (strcmp(lgopts[opt_idx].name, "rxq") == 0) {
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 657f06fec7..aecbb846e3 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -240,13 +240,41 @@ Items:
 Actions:
 
 *	``--port-id``
-	Add port redirection action to all flows actions.
-	Port redirection destination is defined in user_parameters.h
-	under PORT_ID_DST, default value = 1.
-
-       It can also has optional parameter like --port-id=N[,M] to
-       specify the destination port, the number of values should be
-       the same with number of set bits in portmask.
+	Add an action that redirects matching traffic to a DPDK port ID.
+	As this action is deprecated; prefer ``--represented-port`` or
+	``--port-representor`` for embedded-switch flows when supported by
+	the PMD.
+	Port redirection destination is defined in config.h under
+	PORT_ID_DST, default value = 1.
+
+       Without an argument, ``PORT_ID_DST`` is used for each source port.
+       With ``--port-id=N[,M]``, the values override the destination for
+       enabled source ports in ``--portmask`` order; provide one value for
+       each set bit in the port mask.
+
+*	``--represented-port``
+	At the embedded-switch level, add an action that redirects matching
+	traffic to the entity represented by the specified ethdev. Use this
+	action when the destination is the represented entity.
+	Port redirection destination is defined in config.h under
+	PORT_ID_DST, default value = 1.
+
+		Without an argument, ``PORT_ID_DST`` is used for each source port.
+		With ``--represented-port=N[,M]``, the values override the destination
+		for enabled source ports in ``--portmask`` order; provide one value
+		for each set bit in the port mask.
+
+*	``--port-representor``
+	At the embedded-switch level, add an action that redirects matching
+	traffic to the specified ethdev. Use this action when the destination
+	is the ethdev rather than the entity it represents.
+	Port redirection destination is defined in config.h under
+	PORT_ID_DST, default value = 1.
+
+		Without an argument, ``PORT_ID_DST`` is used for each source port.
+		With ``--port-representor=N[,M]``, the values override the destination
+		for enabled source ports in ``--portmask`` order; provide one value
+		for each set bit in the port mask.
 
 *	``--rss``
 	Add RSS action to all flows actions,
-- 
2.43.0


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

end of thread, other threads:[~2026-07-02  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 15:04 [PATCH] app/flow-perf: add represented-port and port-representor flow actions Hadi Sandid
2026-07-02  8:56 ` [PATCH v2] app/flow-perf: add represented-port/port-representor actions Hadi Sandid

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox