DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter
@ 2021-10-12  3:42 Sean Zhang
  2021-10-12  7:10 ` Wisam Monther
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Sean Zhang @ 2021-10-12  3:42 UTC (permalink / raw)
  To: thomas, Wisam Jaddo; +Cc: dev, rasland

Add destination ports(dst-ports) parameter for port-id action,
the parameter is only valid for port-id action. The parameter is not
Must, and the value is 1 by default as before if not provided.

For example:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> --port-id --dst-ports=0

This command means the rule created on representor 0 with port 0
as destination, since the portmask is 0x2 and dst-ports is 0:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> --ether --portmask=0x12 --vxlan-encap --port-id --dst-ports=0,3

This command means the rules created on both representor 0 of PF 0
and PF 1, the destination port for the first represontor is PF 0,
and the destination port for the other one it PF 1.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
 app/test-flow-perf/actions_gen.c |  7 +++--
 app/test-flow-perf/actions_gen.h |  2 +-
 app/test-flow-perf/flow_gen.c    |  3 +-
 app/test-flow-perf/flow_gen.h    |  1 +
 app/test-flow-perf/main.c        | 48 ++++++++++++++++++++++++++++----
 doc/guides/tools/flow-perf.rst   |  6 ++++
 6 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 82cddfc676..8786dc967c 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -29,6 +29,7 @@ struct additional_para {
 	uint32_t counter;
 	uint64_t encap_data;
 	uint64_t decap_data;
+	uint16_t dst_port;
 	uint8_t core_idx;
 	bool unique_data;
 };
@@ -171,12 +172,13 @@ add_set_tag(struct rte_flow_action *actions,
 static void
 add_port_id(struct rte_flow_action *actions,
 	uint8_t actions_counter,
-	__rte_unused struct additional_para para)
+	struct additional_para para)
 {
 	static struct rte_flow_action_port_id port_id = {
 		.id = PORT_ID_DST,
 	};
 
+	port_id.id = para.dst_port;
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID;
 	actions[actions_counter].conf = &port_id;
 }
@@ -909,7 +911,7 @@ void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data)
+	bool unique_data, uint16_t dst_port)
 {
 	struct additional_para additional_para_data;
 	uint8_t actions_counter = 0;
@@ -933,6 +935,7 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 		.decap_data = decap_data,
 		.core_idx = core_idx,
 		.unique_data = unique_data,
+		.dst_port = dst_port,
 	};
 
 	if (hairpinq != 0) {
diff --git a/app/test-flow-perf/actions_gen.h b/app/test-flow-perf/actions_gen.h
index 6f2f833496..f3bb6fec41 100644
--- a/app/test-flow-perf/actions_gen.h
+++ b/app/test-flow-perf/actions_gen.h
@@ -20,6 +20,6 @@
 void fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data);
+	bool unique_data, uint16_t dst_port);
 
 #endif /* FLOW_PERF_ACTION_GEN */
diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c
index 8f87fac5f6..890387bffa 100644
--- a/app/test-flow-perf/flow_gen.c
+++ b/app/test-flow-perf/flow_gen.c
@@ -45,6 +45,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	bool unique_data,
 	struct rte_flow_error *error)
@@ -63,7 +64,7 @@ generate_flow(uint16_t port_id,
 	fill_actions(actions, flow_actions,
 		outer_ip_src, next_table, hairpinq,
 		encap_data, decap_data, core_idx,
-		unique_data);
+		unique_data, dst_port);
 
 	fill_items(items, flow_items, outer_ip_src, core_idx);
 
diff --git a/app/test-flow-perf/flow_gen.h b/app/test-flow-perf/flow_gen.h
index dc887fceae..2daebbe493 100644
--- a/app/test-flow-perf/flow_gen.h
+++ b/app/test-flow-perf/flow_gen.h
@@ -34,6 +34,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	bool unique_data,
 	struct rte_flow_error *error);
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 9be8edc31d..3a1eed3bcc 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -56,6 +56,7 @@ static uint64_t flow_attrs[MAX_ATTRS_NUM];
 static uint8_t items_idx, actions_idx, attrs_idx;
 
 static uint64_t ports_mask;
+static uint16_t dst_ports[RTE_MAX_ETHPORTS];
 static volatile bool force_quit;
 static bool dump_iterations;
 static bool delete_flag;
@@ -163,6 +164,7 @@ usage(char *progname)
 
 	printf("To set flow actions:\n");
 	printf("  --port-id: add port-id action in flow actions\n");
+	printf("  --dst-ports=N,M: add destination ports in port-id action\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");
@@ -219,6 +221,21 @@ usage(char *progname)
 	printf("  --vxlan-decap: add vxlan_decap action to flow actions\n");
 }
 
+static inline int
+has_port_id(void)
+{
+	int i;
+
+	for (i = 0; i < MAX_ACTIONS_NUM; ++i) {
+		if (flow_actions[i] == 0)
+			break;
+		if (flow_actions[i]
+			& FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID))
+			return 1;
+	}
+	return 0;
+}
+
 static void
 args_parse(int argc, char **argv)
 {
@@ -572,6 +589,7 @@ args_parse(int argc, char **argv)
 		{ "enable-fwd",                 0, 0, 0 },
 		{ "unique-data",                0, 0, 0 },
 		{ "portmask",                   1, 0, 0 },
+		{ "dst-ports",                  1, 0, 0 },
 		{ "cores",                      1, 0, 0 },
 		/* Attributes */
 		{ "ingress",                    0, 0, 0 },
@@ -633,6 +651,9 @@ args_parse(int argc, char **argv)
 	RTE_ETH_FOREACH_DEV(i)
 		ports_mask |= 1 << i;
 
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
+		dst_ports[i] = PORT_ID_DST;
+
 	hairpin_queues_num = 0;
 	argvopt = argv;
 
@@ -787,6 +808,22 @@ args_parse(int argc, char **argv)
 					rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
 				ports_mask = pm;
 			}
+			if (strcmp(lgopts[opt_idx].name,
+					"dst-ports") == 0) {
+				uint16_t port_idx = 0;
+				char *token;
+
+				if (!has_port_id())
+					rte_exit(EXIT_FAILURE,
+							"Error: need add port-id action first\n"
+							"dst-ports only can be used for port-id action\n");
+
+				token = strtok(optarg, ",");
+				while (token != NULL) {
+					dst_ports[port_idx++] = atoi(token);
+					token = strtok(NULL, ",");
+				}
+			}
 			if (strcmp(lgopts[opt_idx].name, "cores") == 0) {
 				n = atoi(optarg);
 				if ((int) rte_lcore_count() <= n) {
@@ -1128,7 +1165,7 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list)
 }
 
 static struct rte_flow **
-insert_flows(int port_id, uint8_t core_id)
+insert_flows(int port_id, uint8_t core_id, uint16_t dst_port_id)
 {
 	struct rte_flow **flows_list;
 	struct rte_flow_error error;
@@ -1173,8 +1210,8 @@ insert_flows(int port_id, uint8_t core_id)
 		 * group 0 eth / end actions jump group <flow_group>
 		 */
 		flow = generate_flow(port_id, 0, flow_attrs,
-			global_items, global_actions,
-			flow_group, 0, 0, 0, 0, core_id, unique_data, &error);
+			global_items, global_actions, flow_group, 0, 0, 0, 0,
+			dst_port_id, core_id, unique_data, &error);
 
 		if (flow == NULL) {
 			print_flow_error(error);
@@ -1189,7 +1226,7 @@ insert_flows(int port_id, uint8_t core_id)
 			flow_attrs, flow_items, flow_actions,
 			JUMP_ACTION_TABLE, counter,
 			hairpin_queues_num,
-			encap_data, decap_data,
+			encap_data, decap_data, dst_port_id,
 			core_id, unique_data, &error);
 
 		if (!counter) {
@@ -1250,6 +1287,7 @@ static void
 flows_handler(uint8_t core_id)
 {
 	struct rte_flow **flows_list;
+	uint16_t port_idx = 0;
 	uint16_t nr_ports;
 	int port_id;
 
@@ -1269,7 +1307,7 @@ flows_handler(uint8_t core_id)
 		mc_pool.last_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
 		if (has_meter())
 			meters_handler(port_id, core_id, METER_CREATE);
-		flows_list = insert_flows(port_id, core_id);
+		flows_list = insert_flows(port_id, core_id, dst_ports[port_idx++]);
 		if (flows_list == NULL)
 			rte_exit(EXIT_FAILURE, "Error: Insertion Failed!\n");
 		mc_pool.current_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 280bf7e0e0..23047b4bdf 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -96,6 +96,12 @@ The command line options are:
 *	``--portmask=N``
 	hexadecimal bitmask of ports to be used.
 
+*      ``--dst-ports=N,M``
+       Destination ports for ports with port-id action, the number of values
+       must be the same with number of set bits in portmask, and the parameter
+       is only valid for port-id action. The parameter is not MUST, the value
+       is by default 1 as before if not provided.
+
 *	``--cores=N``
 	Set the number of needed cores to insert/delete rte_flow rules.
 	Default cores count is 1.
-- 
2.33.0


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

* Re: [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter
  2021-10-12  3:42 [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter Sean Zhang
@ 2021-10-12  7:10 ` Wisam Monther
  2021-10-12  7:53 ` Wisam Monther
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Wisam Monther @ 2021-10-12  7:10 UTC (permalink / raw)
  To: Sean Zhang (Networking SW), NBU-Contact-Thomas Monjalon
  Cc: dev, Raslan Darawsheh

Hi,

> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Sent: Tuesday, October 12, 2021 6:43 AM
> To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; Wisam
> Monther <wisamm@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: [PATCH] app/flow-perf: add destination ports parameter
> 
> Add destination ports(dst-ports) parameter for port-id action, the parameter
> is only valid for port-id action. The parameter is not Must, and the value is 1
> by default as before if not provided.
> 
> For example:
> 
> $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \ --port-id
> > --dst-ports=0
> 
> This command means the rule created on representor 0 with port 0 as
> destination, since the portmask is 0x2 and dst-ports is 0:
> 
> $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> > --ether --portmask=0x12 --vxlan-encap --port-id --dst-ports=0,3
> 
> This command means the rules created on both representor 0 of PF 0 and PF
> 1, the destination port for the first represontor is PF 0, and the destination
> port for the other one it PF 1.
> 
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>

Reviewed-by: Wisam Jaddo <wisamm@nvidia.com>

BRs,
Wisam Jaddo

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

* Re: [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter
  2021-10-12  3:42 [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter Sean Zhang
  2021-10-12  7:10 ` Wisam Monther
@ 2021-10-12  7:53 ` Wisam Monther
  2021-10-12  8:14   ` Sean Zhang (Networking SW)
  2021-10-13  7:44 ` [dpdk-dev] [V2] " Sean Zhang
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Wisam Monther @ 2021-10-12  7:53 UTC (permalink / raw)
  To: Sean Zhang (Networking SW), NBU-Contact-Thomas Monjalon
  Cc: dev, Raslan Darawsheh

Hi,

> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Sent: Tuesday, October 12, 2021 6:43 AM
> To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; Wisam
> Monther <wisamm@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: [PATCH] app/flow-perf: add destination ports parameter
> 
> Add destination ports(dst-ports) parameter for port-id action, the parameter
> is only valid for port-id action. The parameter is not Must, and the value is 1
> by default as before if not provided.
> 
> For example:
> 
> $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \ --port-id
> > --dst-ports=0
> 
> This command means the rule created on representor 0 with port 0 as
> destination, since the portmask is 0x2 and dst-ports is 0:
> 
> $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> > --ether --portmask=0x12 --vxlan-encap --port-id --dst-ports=0,3
> 
> This command means the rules created on both representor 0 of PF 0 and PF
> 1, the destination port for the first represontor is PF 0, and the destination
> port for the other one it PF 1.
> 
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>

Do you think it's applicable to use the same option?
I mean, usage:
--port-id: means default.
--port-id=N,M: use the parsing ports?

BRs,
Wisam Jaddo

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

* Re: [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter
  2021-10-12  7:53 ` Wisam Monther
@ 2021-10-12  8:14   ` Sean Zhang (Networking SW)
  2021-10-12  8:15     ` Wisam Monther
  0 siblings, 1 reply; 14+ messages in thread
From: Sean Zhang (Networking SW) @ 2021-10-12  8:14 UTC (permalink / raw)
  To: Wisam Monther, NBU-Contact-Thomas Monjalon; +Cc: dev, Raslan Darawsheh

Hi Wisam,

> -----Original Message-----
> From: Wisam Monther <wisamm@nvidia.com>
> Sent: Tuesday, October 12, 2021 3:53 PM
> To: Sean Zhang (Networking SW) <xiazhang@nvidia.com>; NBU-Contact-
> Thomas Monjalon <thomas@monjalon.net>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: RE: [PATCH] app/flow-perf: add destination ports parameter
> 
> Hi,
> 
> > -----Original Message-----
> > From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> > Sent: Tuesday, October 12, 2021 6:43 AM
> > To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; Wisam
> Monther
> > <wisamm@nvidia.com>
> > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> > Subject: [PATCH] app/flow-perf: add destination ports parameter
> >
> > Add destination ports(dst-ports) parameter for port-id action, the
> > parameter is only valid for port-id action. The parameter is not Must,
> > and the value is 1 by default as before if not provided.
> >
> > For example:
> >
> > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> > > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> > > --port-id
> > > --dst-ports=0
> >
> > This command means the rule created on representor 0 with port 0 as
> > destination, since the portmask is 0x2 and dst-ports is 0:
> >
> > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> > > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> > > --ether --portmask=0x12 --vxlan-encap --port-id --dst-ports=0,3
> >
> > This command means the rules created on both representor 0 of PF 0 and
> > PF 1, the destination port for the first represontor is PF 0, and the
> > destination port for the other one it PF 1.
> >
> > Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> 
> Do you think it's applicable to use the same option?
> I mean, usage:
> --port-id: means default.
> --port-id=N,M: use the parsing ports?

Yes, since the argument can be optional, your suggestion is applicable. So do you suggest to change to --port-id=N,M?

> 
> BRs,
> Wisam Jaddo

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

* Re: [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter
  2021-10-12  8:14   ` Sean Zhang (Networking SW)
@ 2021-10-12  8:15     ` Wisam Monther
  2021-10-12  8:22       ` Sean Zhang (Networking SW)
  0 siblings, 1 reply; 14+ messages in thread
From: Wisam Monther @ 2021-10-12  8:15 UTC (permalink / raw)
  To: Sean Zhang (Networking SW), NBU-Contact-Thomas Monjalon
  Cc: dev, Raslan Darawsheh



> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Sent: Tuesday, October 12, 2021 11:14 AM
> To: Wisam Monther <wisamm@nvidia.com>; NBU-Contact-Thomas
> Monjalon <thomas@monjalon.net>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: RE: [PATCH] app/flow-perf: add destination ports parameter
> 
> Hi Wisam,
> 
> > -----Original Message-----
> > From: Wisam Monther <wisamm@nvidia.com>
> > Sent: Tuesday, October 12, 2021 3:53 PM
> > To: Sean Zhang (Networking SW) <xiazhang@nvidia.com>; NBU-Contact-
> > Thomas Monjalon <thomas@monjalon.net>
> > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> > Subject: RE: [PATCH] app/flow-perf: add destination ports parameter
> >
> > Hi,
> >
> > > -----Original Message-----
> > > From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> > > Sent: Tuesday, October 12, 2021 6:43 AM
> > > To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; Wisam
> > Monther
> > > <wisamm@nvidia.com>
> > > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> > > Subject: [PATCH] app/flow-perf: add destination ports parameter
> > >
> > > Add destination ports(dst-ports) parameter for port-id action, the
> > > parameter is only valid for port-id action. The parameter is not
> > > Must, and the value is 1 by default as before if not provided.
> > >
> > > For example:
> > >
> > > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> > > > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> > > > --port-id
> > > > --dst-ports=0
> > >
> > > This command means the rule created on representor 0 with port 0 as
> > > destination, since the portmask is 0x2 and dst-ports is 0:
> > >
> > > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> > > > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> > > > --ether --portmask=0x12 --vxlan-encap --port-id --dst-ports=0,3
> > >
> > > This command means the rules created on both representor 0 of PF 0
> > > and PF 1, the destination port for the first represontor is PF 0,
> > > and the destination port for the other one it PF 1.
> > >
> > > Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> >
> > Do you think it's applicable to use the same option?
> > I mean, usage:
> > --port-id: means default.
> > --port-id=N,M: use the parsing ports?
> 
> Yes, since the argument can be optional, your suggestion is applicable. So do
> you suggest to change to --port-id=N,M?

Yes after 2end look, it make more sense to remove the dependency of two options for same action.

> 
> >
> > BRs,
> > Wisam Jaddo

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

* Re: [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter
  2021-10-12  8:15     ` Wisam Monther
@ 2021-10-12  8:22       ` Sean Zhang (Networking SW)
  0 siblings, 0 replies; 14+ messages in thread
From: Sean Zhang (Networking SW) @ 2021-10-12  8:22 UTC (permalink / raw)
  To: Wisam Monther, NBU-Contact-Thomas Monjalon; +Cc: dev, Raslan Darawsheh



> -----Original Message-----
> From: Wisam Monther <wisamm@nvidia.com>
> Sent: Tuesday, October 12, 2021 4:16 PM
> To: Sean Zhang (Networking SW) <xiazhang@nvidia.com>; NBU-Contact-
> Thomas Monjalon <thomas@monjalon.net>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: RE: [PATCH] app/flow-perf: add destination ports parameter
> 
> 
> 
> > -----Original Message-----
> > From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> > Sent: Tuesday, October 12, 2021 11:14 AM
> > To: Wisam Monther <wisamm@nvidia.com>; NBU-Contact-Thomas
> Monjalon
> > <thomas@monjalon.net>
> > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> > Subject: RE: [PATCH] app/flow-perf: add destination ports parameter
> >
> > Hi Wisam,
> >
> > > -----Original Message-----
> > > From: Wisam Monther <wisamm@nvidia.com>
> > > Sent: Tuesday, October 12, 2021 3:53 PM
> > > To: Sean Zhang (Networking SW) <xiazhang@nvidia.com>; NBU-Contact-
> > > Thomas Monjalon <thomas@monjalon.net>
> > > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> > > Subject: RE: [PATCH] app/flow-perf: add destination ports parameter
> > >
> > > Hi,
> > >
> > > > -----Original Message-----
> > > > From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> > > > Sent: Tuesday, October 12, 2021 6:43 AM
> > > > To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; Wisam
> > > Monther
> > > > <wisamm@nvidia.com>
> > > > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> > > > Subject: [PATCH] app/flow-perf: add destination ports parameter
> > > >
> > > > Add destination ports(dst-ports) parameter for port-id action, the
> > > > parameter is only valid for port-id action. The parameter is not
> > > > Must, and the value is 1 by default as before if not provided.
> > > >
> > > > For example:
> > > >
> > > > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> > > > > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> > > > > --port-id
> > > > > --dst-ports=0
> > > >
> > > > This command means the rule created on representor 0 with port 0
> > > > as destination, since the portmask is 0x2 and dst-ports is 0:
> > > >
> > > > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> > > > > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> > > > > --ether --portmask=0x12 --vxlan-encap --port-id --dst-ports=0,3
> > > >
> > > > This command means the rules created on both representor 0 of PF 0
> > > > and PF 1, the destination port for the first represontor is PF 0,
> > > > and the destination port for the other one it PF 1.
> > > >
> > > > Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> > >
> > > Do you think it's applicable to use the same option?
> > > I mean, usage:
> > > --port-id: means default.
> > > --port-id=N,M: use the parsing ports?
> >
> > Yes, since the argument can be optional, your suggestion is
> > applicable. So do you suggest to change to --port-id=N,M?
> 
> Yes after 2end look, it make more sense to remove the dependency of two
> options for same action.

OK, I will update the patch.

Thanks,
Sean
> 
> >
> > >
> > > BRs,
> > > Wisam Jaddo

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

* [dpdk-dev] [V2] app/flow-perf: add destination ports parameter
  2021-10-12  3:42 [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter Sean Zhang
  2021-10-12  7:10 ` Wisam Monther
  2021-10-12  7:53 ` Wisam Monther
@ 2021-10-13  7:44 ` Sean Zhang
  2021-10-14  7:53   ` Wisam Monther
  2021-10-28  3:57 ` [dpdk-dev] [PATCH] " Sean Zhang
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Sean Zhang @ 2021-10-13  7:44 UTC (permalink / raw)
  To: thomas, Wisam Jaddo; +Cc: dev, rasland

Add optional destination ports parameter for port-id action.
The parameter is not must, and the value is 1 by default as before
if the parameter not provided.

For example:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> --port-id=0

This command means the rule created on representor 0 with port 0
as destination, since the portmask is 0x2 and dst-ports is 0:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> --ether --portmask=0x12 --vxlan-encap --port-id=0,3

This command means the rules created on both representor 0 of PF 0
and PF 1, the destination port for the first represontor is PF 0,
and the destination port for the other one it PF 1.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
v2:
remove new added dst-ports parameter, reuse port-id with optional
parameter
---
---
 app/test-flow-perf/actions_gen.c |  7 +++++--
 app/test-flow-perf/actions_gen.h |  2 +-
 app/test-flow-perf/flow_gen.c    |  3 ++-
 app/test-flow-perf/flow_gen.h    |  1 +
 app/test-flow-perf/main.c        | 29 +++++++++++++++++++++++------
 doc/guides/tools/flow-perf.rst   |  3 +++
 6 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 82cddfc676..8786dc967c 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -29,6 +29,7 @@ struct additional_para {
 	uint32_t counter;
 	uint64_t encap_data;
 	uint64_t decap_data;
+	uint16_t dst_port;
 	uint8_t core_idx;
 	bool unique_data;
 };
@@ -171,12 +172,13 @@ add_set_tag(struct rte_flow_action *actions,
 static void
 add_port_id(struct rte_flow_action *actions,
 	uint8_t actions_counter,
-	__rte_unused struct additional_para para)
+	struct additional_para para)
 {
 	static struct rte_flow_action_port_id port_id = {
 		.id = PORT_ID_DST,
 	};
 
+	port_id.id = para.dst_port;
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID;
 	actions[actions_counter].conf = &port_id;
 }
@@ -909,7 +911,7 @@ void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data)
+	bool unique_data, uint16_t dst_port)
 {
 	struct additional_para additional_para_data;
 	uint8_t actions_counter = 0;
@@ -933,6 +935,7 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 		.decap_data = decap_data,
 		.core_idx = core_idx,
 		.unique_data = unique_data,
+		.dst_port = dst_port,
 	};
 
 	if (hairpinq != 0) {
diff --git a/app/test-flow-perf/actions_gen.h b/app/test-flow-perf/actions_gen.h
index 6f2f833496..f3bb6fec41 100644
--- a/app/test-flow-perf/actions_gen.h
+++ b/app/test-flow-perf/actions_gen.h
@@ -20,6 +20,6 @@
 void fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data);
+	bool unique_data, uint16_t dst_port);
 
 #endif /* FLOW_PERF_ACTION_GEN */
diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c
index 8f87fac5f6..890387bffa 100644
--- a/app/test-flow-perf/flow_gen.c
+++ b/app/test-flow-perf/flow_gen.c
@@ -45,6 +45,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	bool unique_data,
 	struct rte_flow_error *error)
@@ -63,7 +64,7 @@ generate_flow(uint16_t port_id,
 	fill_actions(actions, flow_actions,
 		outer_ip_src, next_table, hairpinq,
 		encap_data, decap_data, core_idx,
-		unique_data);
+		unique_data, dst_port);
 
 	fill_items(items, flow_items, outer_ip_src, core_idx);
 
diff --git a/app/test-flow-perf/flow_gen.h b/app/test-flow-perf/flow_gen.h
index dc887fceae..2daebbe493 100644
--- a/app/test-flow-perf/flow_gen.h
+++ b/app/test-flow-perf/flow_gen.h
@@ -34,6 +34,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	bool unique_data,
 	struct rte_flow_error *error);
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 9be8edc31d..5d12bfeb03 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -56,6 +56,7 @@ static uint64_t flow_attrs[MAX_ATTRS_NUM];
 static uint8_t items_idx, actions_idx, attrs_idx;
 
 static uint64_t ports_mask;
+static uint16_t dst_ports[RTE_MAX_ETHPORTS];
 static volatile bool force_quit;
 static bool dump_iterations;
 static bool delete_flag;
@@ -595,7 +596,7 @@ args_parse(int argc, char **argv)
 		{ "icmpv4",                     0, 0, 0 },
 		{ "icmpv6",                     0, 0, 0 },
 		/* Actions */
-		{ "port-id",                    0, 0, 0 },
+		{ "port-id",                    2, 0, 0 },
 		{ "rss",                        0, 0, 0 },
 		{ "queue",                      0, 0, 0 },
 		{ "jump",                       0, 0, 0 },
@@ -633,6 +634,9 @@ args_parse(int argc, char **argv)
 	RTE_ETH_FOREACH_DEV(i)
 		ports_mask |= 1 << i;
 
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
+		dst_ports[i] = PORT_ID_DST;
+
 	hairpin_queues_num = 0;
 	argvopt = argv;
 
@@ -787,6 +791,17 @@ args_parse(int argc, char **argv)
 					rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
 				ports_mask = pm;
 			}
+			if (strcmp(lgopts[opt_idx].name,
+					"port-id") == 0) {
+				uint16_t port_idx = 0;
+				char *token;
+
+				token = strtok(optarg, ",");
+				while (token != NULL) {
+					dst_ports[port_idx++] = atoi(token);
+					token = strtok(NULL, ",");
+				}
+			}
 			if (strcmp(lgopts[opt_idx].name, "cores") == 0) {
 				n = atoi(optarg);
 				if ((int) rte_lcore_count() <= n) {
@@ -1128,7 +1143,7 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list)
 }
 
 static struct rte_flow **
-insert_flows(int port_id, uint8_t core_id)
+insert_flows(int port_id, uint8_t core_id, uint16_t dst_port_id)
 {
 	struct rte_flow **flows_list;
 	struct rte_flow_error error;
@@ -1173,8 +1188,8 @@ insert_flows(int port_id, uint8_t core_id)
 		 * group 0 eth / end actions jump group <flow_group>
 		 */
 		flow = generate_flow(port_id, 0, flow_attrs,
-			global_items, global_actions,
-			flow_group, 0, 0, 0, 0, core_id, unique_data, &error);
+			global_items, global_actions, flow_group, 0, 0, 0, 0,
+			dst_port_id, core_id, unique_data, &error);
 
 		if (flow == NULL) {
 			print_flow_error(error);
@@ -1189,7 +1204,7 @@ insert_flows(int port_id, uint8_t core_id)
 			flow_attrs, flow_items, flow_actions,
 			JUMP_ACTION_TABLE, counter,
 			hairpin_queues_num,
-			encap_data, decap_data,
+			encap_data, decap_data, dst_port_id,
 			core_id, unique_data, &error);
 
 		if (!counter) {
@@ -1250,6 +1265,7 @@ static void
 flows_handler(uint8_t core_id)
 {
 	struct rte_flow **flows_list;
+	uint16_t port_idx = 0;
 	uint16_t nr_ports;
 	int port_id;
 
@@ -1269,7 +1285,8 @@ flows_handler(uint8_t core_id)
 		mc_pool.last_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
 		if (has_meter())
 			meters_handler(port_id, core_id, METER_CREATE);
-		flows_list = insert_flows(port_id, core_id);
+		flows_list = insert_flows(port_id, core_id,
+						dst_ports[port_idx++]);
 		if (flows_list == NULL)
 			rte_exit(EXIT_FAILURE, "Error: Insertion Failed!\n");
 		mc_pool.current_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 280bf7e0e0..edfd81c25f 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -205,6 +205,9 @@ Actions:
 	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.
 
 *	``--rss``
 	Add RSS action to all flows actions,
-- 
2.33.0


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

* Re: [dpdk-dev] [V2] app/flow-perf: add destination ports parameter
  2021-10-13  7:44 ` [dpdk-dev] [V2] " Sean Zhang
@ 2021-10-14  7:53   ` Wisam Monther
  2021-10-25 19:40     ` Thomas Monjalon
  0 siblings, 1 reply; 14+ messages in thread
From: Wisam Monther @ 2021-10-14  7:53 UTC (permalink / raw)
  To: Sean Zhang (Networking SW), NBU-Contact-Thomas Monjalon
  Cc: dev, Raslan Darawsheh

Hi Sean,

> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Sent: Wednesday, October 13, 2021 10:44 AM
> To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; Wisam
> Monther <wisamm@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: [V2] app/flow-perf: add destination ports parameter
> 
> Add optional destination ports parameter for port-id action.
> The parameter is not must, and the value is 1 by default as before if the
> parameter not provided.
> 
> For example:
> 
> $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> > --port-id=0
> 
> This command means the rule created on representor 0 with port 0 as
> destination, since the portmask is 0x2 and dst-ports is 0:
> 
> $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> > --ether --portmask=0x12 --vxlan-encap --port-id=0,3
> 
> This command means the rules created on both representor 0 of PF 0 and PF
> 1, the destination port for the first represontor is PF 0, and the destination
> port for the other one it PF 1.
> 
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> ---
> v2:
> remove new added dst-ports parameter, reuse port-id with optional
> parameter
> ---

Reviewed-by: Wisam Jaddo <wisamm@nvidia.com>

BRs,
Wisam Jaddo

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

* Re: [dpdk-dev] [V2] app/flow-perf: add destination ports parameter
  2021-10-14  7:53   ` Wisam Monther
@ 2021-10-25 19:40     ` Thomas Monjalon
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Monjalon @ 2021-10-25 19:40 UTC (permalink / raw)
  To: Sean Zhang (Networking SW); +Cc: dev, Raslan Darawsheh, Wisam Monther

> > Add optional destination ports parameter for port-id action.
> > The parameter is not must, and the value is 1 by default as before if the
> > parameter not provided.
> > 
> > For example:
> > 
> > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> > > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> > > --port-id=0
> > 
> > This command means the rule created on representor 0 with port 0 as
> > destination, since the portmask is 0x2 and dst-ports is 0:
> > 
> > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> > > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> > > --ether --portmask=0x12 --vxlan-encap --port-id=0,3
> > 
> > This command means the rules created on both representor 0 of PF 0 and PF
> > 1, the destination port for the first represontor is PF 0, and the destination
> > port for the other one it PF 1.
> > 
> > Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> 
> Reviewed-by: Wisam Jaddo <wisamm@nvidia.com>

It conflicts with Wisam's patch adding more options.
Please rebase.




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

* [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter
  2021-10-12  3:42 [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter Sean Zhang
                   ` (2 preceding siblings ...)
  2021-10-13  7:44 ` [dpdk-dev] [V2] " Sean Zhang
@ 2021-10-28  3:57 ` Sean Zhang
  2021-10-28  4:01 ` [dpdk-dev] [V3] " Sean Zhang
  2021-10-29  5:52 ` Sean Zhang
  5 siblings, 0 replies; 14+ messages in thread
From: Sean Zhang @ 2021-10-28  3:57 UTC (permalink / raw)
  To: thomas, Wisam Jaddo; +Cc: dev, rasland

Add optional destination ports parameter for port-id action.
The parameter is not must, and the value is 1 by default as before
if the parameter not provided.

For example:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> --port-id=0

This command means the rule created on representor 0 with port 0
as destination, since the portmask is 0x2 and dst-ports is 0:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> --ether --portmask=0x12 --vxlan-encap --port-id=0,3

This command means the rules created on both representor 0 of PF 0
and PF 1, the destination port for the first represontor is PF 0,
and the destination port for the other one it PF 1.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
v3:
resolve merging conflict
v2:
remove new added dst-ports parameter, reuse port-id with optional
parameter
---
---
 app/test-flow-perf/actions_gen.c |  7 +++++--
 app/test-flow-perf/actions_gen.h |  2 +-
 app/test-flow-perf/flow_gen.c    |  3 ++-
 app/test-flow-perf/flow_gen.h    |  1 +
 app/test-flow-perf/main.c        | 31 ++++++++++++++++++++++++-------
 doc/guides/tools/flow-perf.rst   |  3 +++
 6 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 7c209f7266..13e1b82389 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -29,6 +29,7 @@ struct additional_para {
 	uint32_t counter;
 	uint64_t encap_data;
 	uint64_t decap_data;
+	uint16_t dst_port;
 	uint8_t core_idx;
 	bool unique_data;
 };
@@ -171,12 +172,13 @@ add_set_tag(struct rte_flow_action *actions,
 static void
 add_port_id(struct rte_flow_action *actions,
 	uint8_t actions_counter,
-	__rte_unused struct additional_para para)
+	struct additional_para para)
 {
 	static struct rte_flow_action_port_id port_id = {
 		.id = PORT_ID_DST,
 	};
 
+	port_id.id = para.dst_port;
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID;
 	actions[actions_counter].conf = &port_id;
 }
@@ -909,7 +911,7 @@ void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data, uint8_t rx_queues_count)
+	bool unique_data, uint8_t rx_queues_count, uint16_t dst_port)
 {
 	struct additional_para additional_para_data;
 	uint8_t actions_counter = 0;
@@ -933,6 +935,7 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 		.decap_data = decap_data,
 		.core_idx = core_idx,
 		.unique_data = unique_data,
+		.dst_port = dst_port,
 	};
 
 	if (hairpinq != 0) {
diff --git a/app/test-flow-perf/actions_gen.h b/app/test-flow-perf/actions_gen.h
index 8990686269..9e13b164f9 100644
--- a/app/test-flow-perf/actions_gen.h
+++ b/app/test-flow-perf/actions_gen.h
@@ -20,6 +20,6 @@
 void fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data, uint8_t rx_queues_count);
+	bool unique_data, uint8_t rx_queues_count, uint16_t dst_port);
 
 #endif /* FLOW_PERF_ACTION_GEN */
diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c
index 51871dbfdc..c7b7652c02 100644
--- a/app/test-flow-perf/flow_gen.c
+++ b/app/test-flow-perf/flow_gen.c
@@ -45,6 +45,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	uint8_t rx_queues_count,
 	bool unique_data,
@@ -64,7 +65,7 @@ generate_flow(uint16_t port_id,
 	fill_actions(actions, flow_actions,
 		outer_ip_src, next_table, hairpinq,
 		encap_data, decap_data, core_idx,
-		unique_data, rx_queues_count);
+		unique_data, rx_queues_count, dst_port);
 
 	fill_items(items, flow_items, outer_ip_src, core_idx);
 
diff --git a/app/test-flow-perf/flow_gen.h b/app/test-flow-perf/flow_gen.h
index 1118a9fc14..46ce575ff8 100644
--- a/app/test-flow-perf/flow_gen.h
+++ b/app/test-flow-perf/flow_gen.h
@@ -34,6 +34,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	uint8_t rx_queues_count,
 	bool unique_data,
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 3ebc025fb2..c1ad9bb0a3 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -56,6 +56,7 @@ static uint64_t flow_attrs[MAX_ATTRS_NUM];
 static uint8_t items_idx, actions_idx, attrs_idx;
 
 static uint64_t ports_mask;
+static uint16_t dst_ports[RTE_MAX_ETHPORTS];
 static volatile bool force_quit;
 static bool dump_iterations;
 static bool delete_flag;
@@ -619,7 +620,7 @@ args_parse(int argc, char **argv)
 		{ "icmpv4",                     0, 0, 0 },
 		{ "icmpv6",                     0, 0, 0 },
 		/* Actions */
-		{ "port-id",                    0, 0, 0 },
+		{ "port-id",                    2, 0, 0 },
 		{ "rss",                        0, 0, 0 },
 		{ "queue",                      0, 0, 0 },
 		{ "jump",                       0, 0, 0 },
@@ -657,6 +658,9 @@ args_parse(int argc, char **argv)
 	RTE_ETH_FOREACH_DEV(i)
 		ports_mask |= 1 << i;
 
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
+		dst_ports[i] = PORT_ID_DST;
+
 	hairpin_queues_num = 0;
 	argvopt = argv;
 
@@ -811,6 +815,17 @@ args_parse(int argc, char **argv)
 					rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
 				ports_mask = pm;
 			}
+			if (strcmp(lgopts[opt_idx].name,
+					"port-id") == 0) {
+				uint16_t port_idx = 0;
+				char *token;
+
+				token = strtok(optarg, ",");
+				while (token != NULL) {
+					dst_ports[port_idx++] = atoi(token);
+					token = strtok(NULL, ",");
+				}
+			}
 			if (strcmp(lgopts[opt_idx].name, "rxq") == 0) {
 				n = atoi(optarg);
 				rx_queues_count = (uint8_t) n;
@@ -1180,7 +1195,7 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list)
 }
 
 static struct rte_flow **
-insert_flows(int port_id, uint8_t core_id)
+insert_flows(int port_id, uint8_t core_id, uint16_t dst_port_id)
 {
 	struct rte_flow **flows_list;
 	struct rte_flow_error error;
@@ -1226,8 +1241,8 @@ insert_flows(int port_id, uint8_t core_id)
 		 */
 		flow = generate_flow(port_id, 0, flow_attrs,
 			global_items, global_actions,
-			flow_group, 0, 0, 0, 0, core_id, rx_queues_count,
-			unique_data, &error);
+			flow_group, 0, 0, 0, 0, dst_port_id, core_id,
+			rx_queues_count, unique_data, &error);
 
 		if (flow == NULL) {
 			print_flow_error(error);
@@ -1241,8 +1256,8 @@ insert_flows(int port_id, uint8_t core_id)
 		flow = generate_flow(port_id, flow_group,
 			flow_attrs, flow_items, flow_actions,
 			JUMP_ACTION_TABLE, counter,
-			hairpin_queues_num,
-			encap_data, decap_data,
+			hairpin_queues_num, encap_data,
+			decap_data, dst_port_id,
 			core_id, rx_queues_count,
 			unique_data, &error);
 
@@ -1304,6 +1319,7 @@ static void
 flows_handler(uint8_t core_id)
 {
 	struct rte_flow **flows_list;
+	uint16_t port_idx = 0;
 	uint16_t nr_ports;
 	int port_id;
 
@@ -1323,7 +1339,8 @@ flows_handler(uint8_t core_id)
 		mc_pool.last_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
 		if (has_meter())
 			meters_handler(port_id, core_id, METER_CREATE);
-		flows_list = insert_flows(port_id, core_id);
+		flows_list = insert_flows(port_id, core_id,
+						dst_ports[port_idx++]);
 		if (flows_list == NULL)
 			rte_exit(EXIT_FAILURE, "Error: Insertion Failed!\n");
 		mc_pool.current_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 0855f88689..9812b43a74 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -230,6 +230,9 @@ Actions:
 	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.
 
 *	``--rss``
 	Add RSS action to all flows actions,
-- 
2.33.0


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

* [dpdk-dev] [V3] app/flow-perf: add destination ports parameter
  2021-10-12  3:42 [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter Sean Zhang
                   ` (3 preceding siblings ...)
  2021-10-28  3:57 ` [dpdk-dev] [PATCH] " Sean Zhang
@ 2021-10-28  4:01 ` Sean Zhang
  2021-10-29  5:52 ` Sean Zhang
  5 siblings, 0 replies; 14+ messages in thread
From: Sean Zhang @ 2021-10-28  4:01 UTC (permalink / raw)
  To: thomas, Wisam Jaddo; +Cc: dev, rasland

Add optional destination ports parameter for port-id action.
The parameter is not must, and the value is 1 by default as before
if the parameter not provided.

For example:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> --port-id=0

This command means the rule created on representor 0 with port 0
as destination, since the portmask is 0x2 and dst-ports is 0:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> --ether --portmask=0x12 --vxlan-encap --port-id=0,3

This command means the rules created on both representor 0 of PF 0
and PF 1, the destination port for the first represontor is PF 0,
and the destination port for the other one it PF 1.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
v3:
resolve merging conflict
v2:
remove new added dst-ports parameter, reuse port-id with optional
parameter
---
---
 app/test-flow-perf/actions_gen.c |  7 +++++--
 app/test-flow-perf/actions_gen.h |  2 +-
 app/test-flow-perf/flow_gen.c    |  3 ++-
 app/test-flow-perf/flow_gen.h    |  1 +
 app/test-flow-perf/main.c        | 31 ++++++++++++++++++++++++-------
 doc/guides/tools/flow-perf.rst   |  3 +++
 6 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 7c209f7266..13e1b82389 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -29,6 +29,7 @@ struct additional_para {
 	uint32_t counter;
 	uint64_t encap_data;
 	uint64_t decap_data;
+	uint16_t dst_port;
 	uint8_t core_idx;
 	bool unique_data;
 };
@@ -171,12 +172,13 @@ add_set_tag(struct rte_flow_action *actions,
 static void
 add_port_id(struct rte_flow_action *actions,
 	uint8_t actions_counter,
-	__rte_unused struct additional_para para)
+	struct additional_para para)
 {
 	static struct rte_flow_action_port_id port_id = {
 		.id = PORT_ID_DST,
 	};
 
+	port_id.id = para.dst_port;
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID;
 	actions[actions_counter].conf = &port_id;
 }
@@ -909,7 +911,7 @@ void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data, uint8_t rx_queues_count)
+	bool unique_data, uint8_t rx_queues_count, uint16_t dst_port)
 {
 	struct additional_para additional_para_data;
 	uint8_t actions_counter = 0;
@@ -933,6 +935,7 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 		.decap_data = decap_data,
 		.core_idx = core_idx,
 		.unique_data = unique_data,
+		.dst_port = dst_port,
 	};
 
 	if (hairpinq != 0) {
diff --git a/app/test-flow-perf/actions_gen.h b/app/test-flow-perf/actions_gen.h
index 8990686269..9e13b164f9 100644
--- a/app/test-flow-perf/actions_gen.h
+++ b/app/test-flow-perf/actions_gen.h
@@ -20,6 +20,6 @@
 void fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data, uint8_t rx_queues_count);
+	bool unique_data, uint8_t rx_queues_count, uint16_t dst_port);
 
 #endif /* FLOW_PERF_ACTION_GEN */
diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c
index 51871dbfdc..c7b7652c02 100644
--- a/app/test-flow-perf/flow_gen.c
+++ b/app/test-flow-perf/flow_gen.c
@@ -45,6 +45,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	uint8_t rx_queues_count,
 	bool unique_data,
@@ -64,7 +65,7 @@ generate_flow(uint16_t port_id,
 	fill_actions(actions, flow_actions,
 		outer_ip_src, next_table, hairpinq,
 		encap_data, decap_data, core_idx,
-		unique_data, rx_queues_count);
+		unique_data, rx_queues_count, dst_port);
 
 	fill_items(items, flow_items, outer_ip_src, core_idx);
 
diff --git a/app/test-flow-perf/flow_gen.h b/app/test-flow-perf/flow_gen.h
index 1118a9fc14..46ce575ff8 100644
--- a/app/test-flow-perf/flow_gen.h
+++ b/app/test-flow-perf/flow_gen.h
@@ -34,6 +34,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	uint8_t rx_queues_count,
 	bool unique_data,
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 3ebc025fb2..c1ad9bb0a3 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -56,6 +56,7 @@ static uint64_t flow_attrs[MAX_ATTRS_NUM];
 static uint8_t items_idx, actions_idx, attrs_idx;
 
 static uint64_t ports_mask;
+static uint16_t dst_ports[RTE_MAX_ETHPORTS];
 static volatile bool force_quit;
 static bool dump_iterations;
 static bool delete_flag;
@@ -619,7 +620,7 @@ args_parse(int argc, char **argv)
 		{ "icmpv4",                     0, 0, 0 },
 		{ "icmpv6",                     0, 0, 0 },
 		/* Actions */
-		{ "port-id",                    0, 0, 0 },
+		{ "port-id",                    2, 0, 0 },
 		{ "rss",                        0, 0, 0 },
 		{ "queue",                      0, 0, 0 },
 		{ "jump",                       0, 0, 0 },
@@ -657,6 +658,9 @@ args_parse(int argc, char **argv)
 	RTE_ETH_FOREACH_DEV(i)
 		ports_mask |= 1 << i;
 
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
+		dst_ports[i] = PORT_ID_DST;
+
 	hairpin_queues_num = 0;
 	argvopt = argv;
 
@@ -811,6 +815,17 @@ args_parse(int argc, char **argv)
 					rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
 				ports_mask = pm;
 			}
+			if (strcmp(lgopts[opt_idx].name,
+					"port-id") == 0) {
+				uint16_t port_idx = 0;
+				char *token;
+
+				token = strtok(optarg, ",");
+				while (token != NULL) {
+					dst_ports[port_idx++] = atoi(token);
+					token = strtok(NULL, ",");
+				}
+			}
 			if (strcmp(lgopts[opt_idx].name, "rxq") == 0) {
 				n = atoi(optarg);
 				rx_queues_count = (uint8_t) n;
@@ -1180,7 +1195,7 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list)
 }
 
 static struct rte_flow **
-insert_flows(int port_id, uint8_t core_id)
+insert_flows(int port_id, uint8_t core_id, uint16_t dst_port_id)
 {
 	struct rte_flow **flows_list;
 	struct rte_flow_error error;
@@ -1226,8 +1241,8 @@ insert_flows(int port_id, uint8_t core_id)
 		 */
 		flow = generate_flow(port_id, 0, flow_attrs,
 			global_items, global_actions,
-			flow_group, 0, 0, 0, 0, core_id, rx_queues_count,
-			unique_data, &error);
+			flow_group, 0, 0, 0, 0, dst_port_id, core_id,
+			rx_queues_count, unique_data, &error);
 
 		if (flow == NULL) {
 			print_flow_error(error);
@@ -1241,8 +1256,8 @@ insert_flows(int port_id, uint8_t core_id)
 		flow = generate_flow(port_id, flow_group,
 			flow_attrs, flow_items, flow_actions,
 			JUMP_ACTION_TABLE, counter,
-			hairpin_queues_num,
-			encap_data, decap_data,
+			hairpin_queues_num, encap_data,
+			decap_data, dst_port_id,
 			core_id, rx_queues_count,
 			unique_data, &error);
 
@@ -1304,6 +1319,7 @@ static void
 flows_handler(uint8_t core_id)
 {
 	struct rte_flow **flows_list;
+	uint16_t port_idx = 0;
 	uint16_t nr_ports;
 	int port_id;
 
@@ -1323,7 +1339,8 @@ flows_handler(uint8_t core_id)
 		mc_pool.last_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
 		if (has_meter())
 			meters_handler(port_id, core_id, METER_CREATE);
-		flows_list = insert_flows(port_id, core_id);
+		flows_list = insert_flows(port_id, core_id,
+						dst_ports[port_idx++]);
 		if (flows_list == NULL)
 			rte_exit(EXIT_FAILURE, "Error: Insertion Failed!\n");
 		mc_pool.current_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 0855f88689..9812b43a74 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -230,6 +230,9 @@ Actions:
 	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.
 
 *	``--rss``
 	Add RSS action to all flows actions,
-- 
2.33.0


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

* [dpdk-dev] [V3] app/flow-perf: add destination ports parameter
  2021-10-12  3:42 [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter Sean Zhang
                   ` (4 preceding siblings ...)
  2021-10-28  4:01 ` [dpdk-dev] [V3] " Sean Zhang
@ 2021-10-29  5:52 ` Sean Zhang
  2021-10-31  8:44   ` Wisam Monther
  5 siblings, 1 reply; 14+ messages in thread
From: Sean Zhang @ 2021-10-29  5:52 UTC (permalink / raw)
  To: thomas, Wisam Jaddo; +Cc: dev, rasland

Add optional destination ports parameter for port-id action.
The parameter is not must, and the value is 1 by default as before
if the parameter not provided.

For example:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> --port-id=0

This command means the rule created on representor 0 with port 0
as destination, since the portmask is 0x2 and dst-ports is 0:

$ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> --ether --portmask=0x12 --vxlan-encap --port-id=0,3

This command means the rules created on both representor 0 of PF 0
and PF 1, the destination port for the first represontor is PF 0,
and the destination port for the other one it PF 1.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
v3:
resolve merging conflict
v2:
remove new added dst-ports parameter, reuse port-id with optional
parameter
---
---
 app/test-flow-perf/actions_gen.c |  7 +++++--
 app/test-flow-perf/actions_gen.h |  2 +-
 app/test-flow-perf/flow_gen.c    |  3 ++-
 app/test-flow-perf/flow_gen.h    |  1 +
 app/test-flow-perf/main.c        | 31 ++++++++++++++++++++++++-------
 doc/guides/tools/flow-perf.rst   |  4 ++++
 6 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 7c209f7266..13e1b82389 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -29,6 +29,7 @@ struct additional_para {
 	uint32_t counter;
 	uint64_t encap_data;
 	uint64_t decap_data;
+	uint16_t dst_port;
 	uint8_t core_idx;
 	bool unique_data;
 };
@@ -171,12 +172,13 @@ add_set_tag(struct rte_flow_action *actions,
 static void
 add_port_id(struct rte_flow_action *actions,
 	uint8_t actions_counter,
-	__rte_unused struct additional_para para)
+	struct additional_para para)
 {
 	static struct rte_flow_action_port_id port_id = {
 		.id = PORT_ID_DST,
 	};
 
+	port_id.id = para.dst_port;
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID;
 	actions[actions_counter].conf = &port_id;
 }
@@ -909,7 +911,7 @@ void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data, uint8_t rx_queues_count)
+	bool unique_data, uint8_t rx_queues_count, uint16_t dst_port)
 {
 	struct additional_para additional_para_data;
 	uint8_t actions_counter = 0;
@@ -933,6 +935,7 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 		.decap_data = decap_data,
 		.core_idx = core_idx,
 		.unique_data = unique_data,
+		.dst_port = dst_port,
 	};
 
 	if (hairpinq != 0) {
diff --git a/app/test-flow-perf/actions_gen.h b/app/test-flow-perf/actions_gen.h
index 8990686269..9e13b164f9 100644
--- a/app/test-flow-perf/actions_gen.h
+++ b/app/test-flow-perf/actions_gen.h
@@ -20,6 +20,6 @@
 void fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
 	uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
-	bool unique_data, uint8_t rx_queues_count);
+	bool unique_data, uint8_t rx_queues_count, uint16_t dst_port);
 
 #endif /* FLOW_PERF_ACTION_GEN */
diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c
index 51871dbfdc..c7b7652c02 100644
--- a/app/test-flow-perf/flow_gen.c
+++ b/app/test-flow-perf/flow_gen.c
@@ -45,6 +45,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	uint8_t rx_queues_count,
 	bool unique_data,
@@ -64,7 +65,7 @@ generate_flow(uint16_t port_id,
 	fill_actions(actions, flow_actions,
 		outer_ip_src, next_table, hairpinq,
 		encap_data, decap_data, core_idx,
-		unique_data, rx_queues_count);
+		unique_data, rx_queues_count, dst_port);
 
 	fill_items(items, flow_items, outer_ip_src, core_idx);
 
diff --git a/app/test-flow-perf/flow_gen.h b/app/test-flow-perf/flow_gen.h
index 1118a9fc14..46ce575ff8 100644
--- a/app/test-flow-perf/flow_gen.h
+++ b/app/test-flow-perf/flow_gen.h
@@ -34,6 +34,7 @@ generate_flow(uint16_t port_id,
 	uint16_t hairpinq,
 	uint64_t encap_data,
 	uint64_t decap_data,
+	uint16_t dst_port,
 	uint8_t core_idx,
 	uint8_t rx_queues_count,
 	bool unique_data,
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 3ebc025fb2..c1ad9bb0a3 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -56,6 +56,7 @@ static uint64_t flow_attrs[MAX_ATTRS_NUM];
 static uint8_t items_idx, actions_idx, attrs_idx;
 
 static uint64_t ports_mask;
+static uint16_t dst_ports[RTE_MAX_ETHPORTS];
 static volatile bool force_quit;
 static bool dump_iterations;
 static bool delete_flag;
@@ -619,7 +620,7 @@ args_parse(int argc, char **argv)
 		{ "icmpv4",                     0, 0, 0 },
 		{ "icmpv6",                     0, 0, 0 },
 		/* Actions */
-		{ "port-id",                    0, 0, 0 },
+		{ "port-id",                    2, 0, 0 },
 		{ "rss",                        0, 0, 0 },
 		{ "queue",                      0, 0, 0 },
 		{ "jump",                       0, 0, 0 },
@@ -657,6 +658,9 @@ args_parse(int argc, char **argv)
 	RTE_ETH_FOREACH_DEV(i)
 		ports_mask |= 1 << i;
 
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++)
+		dst_ports[i] = PORT_ID_DST;
+
 	hairpin_queues_num = 0;
 	argvopt = argv;
 
@@ -811,6 +815,17 @@ args_parse(int argc, char **argv)
 					rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
 				ports_mask = pm;
 			}
+			if (strcmp(lgopts[opt_idx].name,
+					"port-id") == 0) {
+				uint16_t port_idx = 0;
+				char *token;
+
+				token = strtok(optarg, ",");
+				while (token != NULL) {
+					dst_ports[port_idx++] = atoi(token);
+					token = strtok(NULL, ",");
+				}
+			}
 			if (strcmp(lgopts[opt_idx].name, "rxq") == 0) {
 				n = atoi(optarg);
 				rx_queues_count = (uint8_t) n;
@@ -1180,7 +1195,7 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list)
 }
 
 static struct rte_flow **
-insert_flows(int port_id, uint8_t core_id)
+insert_flows(int port_id, uint8_t core_id, uint16_t dst_port_id)
 {
 	struct rte_flow **flows_list;
 	struct rte_flow_error error;
@@ -1226,8 +1241,8 @@ insert_flows(int port_id, uint8_t core_id)
 		 */
 		flow = generate_flow(port_id, 0, flow_attrs,
 			global_items, global_actions,
-			flow_group, 0, 0, 0, 0, core_id, rx_queues_count,
-			unique_data, &error);
+			flow_group, 0, 0, 0, 0, dst_port_id, core_id,
+			rx_queues_count, unique_data, &error);
 
 		if (flow == NULL) {
 			print_flow_error(error);
@@ -1241,8 +1256,8 @@ insert_flows(int port_id, uint8_t core_id)
 		flow = generate_flow(port_id, flow_group,
 			flow_attrs, flow_items, flow_actions,
 			JUMP_ACTION_TABLE, counter,
-			hairpin_queues_num,
-			encap_data, decap_data,
+			hairpin_queues_num, encap_data,
+			decap_data, dst_port_id,
 			core_id, rx_queues_count,
 			unique_data, &error);
 
@@ -1304,6 +1319,7 @@ static void
 flows_handler(uint8_t core_id)
 {
 	struct rte_flow **flows_list;
+	uint16_t port_idx = 0;
 	uint16_t nr_ports;
 	int port_id;
 
@@ -1323,7 +1339,8 @@ flows_handler(uint8_t core_id)
 		mc_pool.last_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
 		if (has_meter())
 			meters_handler(port_id, core_id, METER_CREATE);
-		flows_list = insert_flows(port_id, core_id);
+		flows_list = insert_flows(port_id, core_id,
+						dst_ports[port_idx++]);
 		if (flows_list == NULL)
 			rte_exit(EXIT_FAILURE, "Error: Insertion Failed!\n");
 		mc_pool.current_alloc[core_id] = (int64_t)dump_socket_mem(stdout);
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 0855f88689..e608a44c24 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -231,6 +231,10 @@ 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.
+
 *	``--rss``
 	Add RSS action to all flows actions,
 	The queues in RSS action will be all queues configured
-- 
2.33.0


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

* Re: [dpdk-dev] [V3] app/flow-perf: add destination ports parameter
  2021-10-29  5:52 ` Sean Zhang
@ 2021-10-31  8:44   ` Wisam Monther
  2021-11-05  9:50     ` Thomas Monjalon
  0 siblings, 1 reply; 14+ messages in thread
From: Wisam Monther @ 2021-10-31  8:44 UTC (permalink / raw)
  To: Sean Zhang (Networking SW), NBU-Contact-Thomas Monjalon
  Cc: dev, Raslan Darawsheh

Hi,


> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Sent: Friday, October 29, 2021 8:53 AM
> To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; Wisam
> Monther <wisamm@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: [V3] app/flow-perf: add destination ports parameter
> 
> Add optional destination ports parameter for port-id action.
> The parameter is not must, and the value is 1 by default as before if the
> parameter not provided.
> 
> For example:
> 
> $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> > --port-id=0
> 
> This command means the rule created on representor 0 with port 0 as
> destination, since the portmask is 0x2 and dst-ports is 0:
> 
> $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> > --ether --portmask=0x12 --vxlan-encap --port-id=0,3
> 
> This command means the rules created on both representor 0 of PF 0 and PF
> 1, the destination port for the first represontor is PF 0, and the destination
> port for the other one it PF 1.
> 
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> ---
> v3:
> resolve merging conflict
> v2:
> remove new added dst-ports parameter, reuse port-id with optional
> parameter
> ---

Reviewed-by: Wisam Jaddo <wisamm@nvidia.com>

BRs,
Wisam Jaddo

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

* Re: [dpdk-dev] [V3] app/flow-perf: add destination ports parameter
  2021-10-31  8:44   ` Wisam Monther
@ 2021-11-05  9:50     ` Thomas Monjalon
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Monjalon @ 2021-11-05  9:50 UTC (permalink / raw)
  To: Sean Zhang (Networking SW), Raslan Darawsheh; +Cc: dev, Wisam Monther

> > Add optional destination ports parameter for port-id action.
> > The parameter is not must, and the value is 1 by default as before if the
> > parameter not provided.
> > 
> > For example:
> > 
> > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \
> > > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \
> > > --port-id=0
> > 
> > This command means the rule created on representor 0 with port 0 as
> > destination, since the portmask is 0x2 and dst-ports is 0:
> > 
> > $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \
> > > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \
> > > --ether --portmask=0x12 --vxlan-encap --port-id=0,3
> > 
> > This command means the rules created on both representor 0 of PF 0 and PF
> > 1, the destination port for the first represontor is PF 0, and the destination
> > port for the other one it PF 1.
> > 
> > Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> > ---
> > v3:
> > resolve merging conflict
> > v2:
> > remove new added dst-ports parameter, reuse port-id with optional
> > parameter
> > ---
> 
> Reviewed-by: Wisam Jaddo <wisamm@nvidia.com>

Applied, thanks.




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

end of thread, other threads:[~2021-11-05  9:51 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  3:42 [dpdk-dev] [PATCH] app/flow-perf: add destination ports parameter Sean Zhang
2021-10-12  7:10 ` Wisam Monther
2021-10-12  7:53 ` Wisam Monther
2021-10-12  8:14   ` Sean Zhang (Networking SW)
2021-10-12  8:15     ` Wisam Monther
2021-10-12  8:22       ` Sean Zhang (Networking SW)
2021-10-13  7:44 ` [dpdk-dev] [V2] " Sean Zhang
2021-10-14  7:53   ` Wisam Monther
2021-10-25 19:40     ` Thomas Monjalon
2021-10-28  3:57 ` [dpdk-dev] [PATCH] " Sean Zhang
2021-10-28  4:01 ` [dpdk-dev] [V3] " Sean Zhang
2021-10-29  5:52 ` Sean Zhang
2021-10-31  8:44   ` Wisam Monther
2021-11-05  9:50     ` Thomas Monjalon

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).