DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions
@ 2020-08-30 11:15 Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 01/13] app/flow-perf: fix actions mask macro usage Wisam Jaddo
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

* Some fixes.
* Add headers modify actions support.
* Add flag action support.
* Add raw-encap & raw-decap actions support.
* Add VXLAN encap & VXLAN decap actions support.
* Add set portmask option.
* Add icmp and icmp6 matching items support.
* Allow installing rte flows with different modify
headers values and different encap data for each
rte flow.

Wisam Jaddo (13):
  app/flow-perf: fix actions mask macro usage
  doc/flow-perf: fix app sections
  app/flow-perf: start supporting user order
  app/flow-perf: add header modify actions support
  app/flow-perf: add flag action support
  app/flow-perf: fix memory leak from RSS action
  app/flow-perf: add raw encap/decap actions support
  app/flow-perf: add VXLAN encap/decap actions support
  app/flow-perf: fix source ipv4 matching
  app/flow-perf: add random mark id values
  app/flow-perf: add set port mask to options
  app/flow-perf: add icmp matching support
  app/flow-perf: allow fixed values for actions

 app/test-flow-perf/actions_gen.c       | 904 ++++++++++++++++++++++++-
 app/test-flow-perf/actions_gen.h       |  10 +-
 app/test-flow-perf/config.h            |   8 +-
 app/test-flow-perf/flow_gen.c          |  30 +-
 app/test-flow-perf/flow_gen.h          |   8 +-
 app/test-flow-perf/items_gen.c         |  69 +-
 app/test-flow-perf/items_gen.h         |   2 +-
 app/test-flow-perf/main.c              | 424 ++++++++++--
 doc/guides/rel_notes/release_20_08.rst |  17 +
 doc/guides/tools/flow-perf.rst         | 111 ++-
 10 files changed, 1476 insertions(+), 107 deletions(-)

-- 
2.17.1


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

* [dpdk-dev] [PATCH 01/13] app/flow-perf: fix actions mask macro usage
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 02/13] doc/flow-perf: fix app sections Wisam Jaddo
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin; +Cc: wisamm

Actions have it's own macro which is FLOW_ACTION_MASK

Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation")
Cc: wisamm@mellanox.com

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/actions_gen.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 864d0c9786..cb9316f1df 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -219,39 +219,39 @@ fill_actions(struct rte_flow_action *actions, uint64_t flow_actions,
 			);
 	} flows_actions[] = {
 		{
-			.mask = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_MARK),
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_MARK),
 			.funct = add_mark,
 		},
 		{
-			.mask = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_COUNT),
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_COUNT),
 			.funct = add_count,
 		},
 		{
-			.mask = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_SET_META),
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_META),
 			.funct = add_set_meta,
 		},
 		{
-			.mask = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_SET_TAG),
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_TAG),
 			.funct = add_set_tag,
 		},
 		{
-			.mask = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_QUEUE),
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_QUEUE),
 			.funct = add_queue,
 		},
 		{
-			.mask = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_RSS),
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_RSS),
 			.funct = add_rss,
 		},
 		{
-			.mask = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_JUMP),
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_JUMP),
 			.funct = add_jump,
 		},
 		{
-			.mask = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID),
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID),
 			.funct = add_port_id
 		},
 		{
-			.mask = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_DROP),
+			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_DROP),
 			.funct = add_drop,
 		},
 		{
-- 
2.17.1


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

* [dpdk-dev] [PATCH 02/13] doc/flow-perf: fix app sections
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 01/13] app/flow-perf: fix actions mask macro usage Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 03/13] app/flow-perf: start supporting user order Wisam Jaddo
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin; +Cc: wisamm

Currently all the sections are considered as main title under
DPDK Tools User Guides.

This fix will collect all flow perf sections under one title
which is Flow Performance Tool

Fixes: 3344cf2e3001 ("app/flow-perf: add flow performance skeleton")
Cc: wisamm@mellanox.com

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 doc/guides/tools/flow-perf.rst | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index cdedaf9a97..ca551aee6e 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -18,7 +18,7 @@ give different flow each time, and all other items will have open masks.
 
 
 Known Limitations
-=================
+-----------------
 
 The current version has limitations which can be removed in future:
 
@@ -33,7 +33,7 @@ The app supports single and multi core performance measurements.
 
 
 Compiling the Application
-=========================
+-------------------------
 
 The ``test-flow-perf`` application is compiled as part of the main compilation
 of the DPDK libraries and tools.
@@ -42,10 +42,10 @@ Refer to the DPDK Getting Started Guides for details.
 
 
 Running the Application
-=======================
+-----------------------
 
 EAL Command-line Options
-------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~
 
 Please refer to :doc:`EAL parameters (Linux) <../linux_gsg/linux_eal_parameters>`
 or :doc:`EAL parameters (FreeBSD) <../freebsd_gsg/freebsd_eal_parameters>` for
@@ -53,7 +53,7 @@ a list of available EAL command-line options.
 
 
 Flow Performance Options
-------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~
 
 The following are the command-line options for the flow performance application.
 They must be separated from the EAL options, shown in the previous section,
-- 
2.17.1


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

* [dpdk-dev] [PATCH 03/13] app/flow-perf: start supporting user order
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 01/13] app/flow-perf: fix actions mask macro usage Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 02/13] doc/flow-perf: fix app sections Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 04/13] app/flow-perf: add header modify actions support Wisam Jaddo
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

The old design was using the bit mask to identify
items, action and attributes.

So it was all based on the order of the code itself,
to place the order of the actions, items & attributes
inside the flows. Such design will lead into many failures
when some PMD support order different than other PMD,
in the end the rules will fail to create. Also sometimes
the user needs to have one action before other actions
and vice versa, so using new design of arrays that
take user order into consideration make more sense.

After this patch, we start supporting inner items
and more than one instance of same action.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/actions_gen.c       |  26 +++---
 app/test-flow-perf/actions_gen.h       |   2 +-
 app/test-flow-perf/config.h            |   1 +
 app/test-flow-perf/flow_gen.c          |  25 +++---
 app/test-flow-perf/flow_gen.h          |   6 +-
 app/test-flow-perf/items_gen.c         |  26 +++---
 app/test-flow-perf/items_gen.h         |   2 +-
 app/test-flow-perf/main.c              | 106 ++++++++++++++++---------
 doc/guides/rel_notes/release_20_08.rst |   8 ++
 doc/guides/tools/flow-perf.rst         |  12 ++-
 10 files changed, 135 insertions(+), 79 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index cb9316f1df..d115cdd723 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -182,14 +182,14 @@ add_count(struct rte_flow_action *actions,
 }
 
 void
-fill_actions(struct rte_flow_action *actions, uint64_t flow_actions,
+fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq)
 {
 	struct additional_para additional_para_data;
 	uint8_t actions_counter = 0;
 	uint16_t hairpin_queues[hairpinq];
 	uint16_t queues[RXQ_NUM];
-	uint16_t i;
+	uint16_t i, j;
 
 	for (i = 0; i < RXQ_NUM; i++)
 		queues[i] = i;
@@ -217,7 +217,7 @@ fill_actions(struct rte_flow_action *actions, uint64_t flow_actions,
 			uint8_t actions_counter,
 			struct additional_para para
 			);
-	} flows_actions[] = {
+	} actions_list[] = {
 		{
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_MARK),
 			.funct = add_mark,
@@ -264,13 +264,19 @@ fill_actions(struct rte_flow_action *actions, uint64_t flow_actions,
 		},
 	};
 
-	for (i = 0; i < RTE_DIM(flows_actions); i++) {
-		if ((flow_actions & flows_actions[i].mask) == 0)
-			continue;
-		flows_actions[i].funct(
-			actions, actions_counter++,
-			additional_para_data
-		);
+	for (j = 0; j < MAX_ACTIONS_NUM; j++) {
+		if (flow_actions[j] == 0)
+			break;
+		for (i = 0; i < RTE_DIM(actions_list); i++) {
+			if ((flow_actions[j] &
+				actions_list[i].mask) == 0)
+				continue;
+			actions_list[i].funct(
+				actions, actions_counter++,
+				additional_para_data
+			);
+			break;
+		}
 	}
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_END;
 }
diff --git a/app/test-flow-perf/actions_gen.h b/app/test-flow-perf/actions_gen.h
index 0defa7c97c..d6918a53a6 100644
--- a/app/test-flow-perf/actions_gen.h
+++ b/app/test-flow-perf/actions_gen.h
@@ -12,7 +12,7 @@
 
 #include "config.h"
 
-void fill_actions(struct rte_flow_action *actions, uint64_t actions_selector,
+void fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq);
 
 #endif /* FLOW_PERF_ACTION_GEN */
diff --git a/app/test-flow-perf/config.h b/app/test-flow-perf/config.h
index e47d788572..439f3264b4 100644
--- a/app/test-flow-perf/config.h
+++ b/app/test-flow-perf/config.h
@@ -29,3 +29,4 @@
 /* Flow items/acctions max size */
 #define MAX_ITEMS_NUM 32
 #define MAX_ACTIONS_NUM 32
+#define MAX_ATTRS_NUM 16
diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c
index e87276bd14..b2c828c7df 100644
--- a/app/test-flow-perf/flow_gen.c
+++ b/app/test-flow-perf/flow_gen.c
@@ -18,23 +18,28 @@
 
 static void
 fill_attributes(struct rte_flow_attr *attr,
-	uint64_t flow_attrs, uint16_t group)
+	uint64_t *flow_attrs, uint16_t group)
 {
-	if (flow_attrs & INGRESS)
-		attr->ingress = 1;
-	if (flow_attrs & EGRESS)
-		attr->egress = 1;
-	if (flow_attrs & TRANSFER)
-		attr->transfer = 1;
+	uint8_t i;
+	for (i = 0; i < MAX_ATTRS_NUM; i++) {
+		if (flow_attrs[i] == 0)
+			break;
+		if (flow_attrs[i] & INGRESS)
+			attr->ingress = 1;
+		else if (flow_attrs[i] & EGRESS)
+			attr->egress = 1;
+		else if (flow_attrs[i] & TRANSFER)
+			attr->transfer = 1;
+	}
 	attr->group = group;
 }
 
 struct rte_flow *
 generate_flow(uint16_t port_id,
 	uint16_t group,
-	uint64_t flow_attrs,
-	uint64_t flow_items,
-	uint64_t flow_actions,
+	uint64_t *flow_attrs,
+	uint64_t *flow_items,
+	uint64_t *flow_actions,
 	uint16_t next_table,
 	uint32_t outer_ip_src,
 	uint16_t hairpinq,
diff --git a/app/test-flow-perf/flow_gen.h b/app/test-flow-perf/flow_gen.h
index 848331e229..53469c659f 100644
--- a/app/test-flow-perf/flow_gen.h
+++ b/app/test-flow-perf/flow_gen.h
@@ -26,9 +26,9 @@
 struct rte_flow *
 generate_flow(uint16_t port_id,
 	uint16_t group,
-	uint64_t flow_attrs,
-	uint64_t flow_items,
-	uint64_t flow_actions,
+	uint64_t *flow_attrs,
+	uint64_t *flow_items,
+	uint64_t *flow_actions,
 	uint16_t next_table,
 	uint32_t outer_ip_src,
 	uint16_t hairpinq,
diff --git a/app/test-flow-perf/items_gen.c b/app/test-flow-perf/items_gen.c
index 6a8915100c..cc031f24a5 100644
--- a/app/test-flow-perf/items_gen.c
+++ b/app/test-flow-perf/items_gen.c
@@ -312,10 +312,10 @@ add_meta_tag(struct rte_flow_item *items,
 
 void
 fill_items(struct rte_flow_item *items,
-	uint64_t flow_items, uint32_t outer_ip_src)
+	uint64_t *flow_items, uint32_t outer_ip_src)
 {
 	uint8_t items_counter = 0;
-	uint8_t i;
+	uint8_t i, j;
 	struct additional_para additional_para_data = {
 		.src_ip = outer_ip_src,
 	};
@@ -328,7 +328,7 @@ fill_items(struct rte_flow_item *items,
 			uint8_t items_counter,
 			struct additional_para para
 			);
-	} flows_items[] = {
+	} items_list[] = {
 		{
 			.mask = RTE_FLOW_ITEM_TYPE_META,
 			.funct = add_meta_data,
@@ -384,13 +384,19 @@ fill_items(struct rte_flow_item *items,
 
 	};
 
-	for (i = 0; i < RTE_DIM(flows_items); i++) {
-		if ((flow_items & FLOW_ITEM_MASK(flows_items[i].mask)) == 0)
-			continue;
-		flows_items[i].funct(
-			items, items_counter++,
-			additional_para_data
-		);
+	for (j = 0; j < MAX_ITEMS_NUM; j++) {
+		if (flow_items[j] == 0)
+			break;
+		for (i = 0; i < RTE_DIM(items_list); i++) {
+			if ((flow_items[j] &
+				FLOW_ITEM_MASK(items_list[i].mask)) == 0)
+				continue;
+			items_list[i].funct(
+				items, items_counter++,
+				additional_para_data
+			);
+			break;
+		}
 	}
 
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_END;
diff --git a/app/test-flow-perf/items_gen.h b/app/test-flow-perf/items_gen.h
index 9509d0f11c..d68958e4d3 100644
--- a/app/test-flow-perf/items_gen.h
+++ b/app/test-flow-perf/items_gen.h
@@ -12,7 +12,7 @@
 
 #include "config.h"
 
-void fill_items(struct rte_flow_item *items, uint64_t flow_items,
+void fill_items(struct rte_flow_item *items, uint64_t *flow_items,
 	uint32_t outer_ip_src);
 
 #endif /* FLOW_PERF_ITEMS_GEN */
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 3589b316f9..0ff8080aa0 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -45,9 +45,10 @@
 struct rte_flow *flow;
 static uint8_t flow_group;
 
-static uint64_t flow_items;
-static uint64_t flow_actions;
-static uint64_t flow_attrs;
+static uint64_t flow_items[MAX_ITEMS_NUM];
+static uint64_t flow_actions[MAX_ACTIONS_NUM];
+static uint64_t flow_attrs[MAX_ATTRS_NUM];
+static uint8_t items_idx, actions_idx, attrs_idx;
 
 static volatile bool force_quit;
 static bool dump_iterations;
@@ -150,132 +151,159 @@ args_parse(int argc, char **argv)
 	static const struct option_dict {
 		const char *str;
 		const uint64_t mask;
-		uint64_t *bitmap;
+		uint64_t *map;
+		uint8_t *map_idx;
+
 	} flow_options[] = {
 		{
 			.str = "ether",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "ipv4",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "ipv6",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "vlan",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VLAN),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "tcp",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TCP),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "udp",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "vxlan",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "vxlan-gpe",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "gre",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "geneve",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "gtp",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "meta",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_META),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "tag",
 			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TAG),
-			.bitmap = &flow_items
+			.map = &flow_items[0],
+			.map_idx = &items_idx
 		},
 		{
 			.str = "ingress",
 			.mask = INGRESS,
-			.bitmap = &flow_attrs
+			.map = &flow_attrs[0],
+			.map_idx = &attrs_idx
 		},
 		{
 			.str = "egress",
 			.mask = EGRESS,
-			.bitmap = &flow_attrs
+			.map = &flow_attrs[0],
+			.map_idx = &attrs_idx
 		},
 		{
 			.str = "transfer",
 			.mask = TRANSFER,
-			.bitmap = &flow_attrs
+			.map = &flow_attrs[0],
+			.map_idx = &attrs_idx
 		},
 		{
 			.str = "port-id",
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID),
-			.bitmap = &flow_actions
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
 		},
 		{
 			.str = "rss",
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_RSS),
-			.bitmap = &flow_actions
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
 		},
 		{
 			.str = "queue",
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_QUEUE),
-			.bitmap = &flow_actions
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
 		},
 		{
 			.str = "jump",
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_JUMP),
-			.bitmap = &flow_actions
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
 		},
 		{
 			.str = "mark",
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_MARK),
-			.bitmap = &flow_actions
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
 		},
 		{
 			.str = "count",
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_COUNT),
-			.bitmap = &flow_actions
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
 		},
 		{
 			.str = "set-meta",
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_META),
-			.bitmap = &flow_actions
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
 		},
 		{
 			.str = "set-tag",
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_TAG),
-			.bitmap = &flow_actions
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
 		},
 		{
 			.str = "drop",
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_DROP),
-			.bitmap = &flow_actions
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
 		}
 	};
 
@@ -320,9 +348,6 @@ args_parse(int argc, char **argv)
 		{ "hairpin-rss",                1, 0, 0 },
 	};
 
-	flow_items = 0;
-	flow_actions = 0;
-	flow_attrs = 0;
 	hairpin_queues_num = 0;
 	argvopt = argv;
 
@@ -349,7 +374,8 @@ args_parse(int argc, char **argv)
 			for (i = 0; i < RTE_DIM(flow_options); i++)
 				if (strcmp(lgopts[opt_idx].name,
 						flow_options[i].str) == 0) {
-					*flow_options[i].bitmap |=
+					flow_options[i].map[
+					(*flow_options[i].map_idx)++] =
 						flow_options[i].mask;
 					printf("%s / ", flow_options[i].str);
 				}
@@ -363,7 +389,8 @@ args_parse(int argc, char **argv)
 					rte_exit(EXIT_SUCCESS,
 						"Hairpin queues should be > 0\n");
 
-				flow_actions |= HAIRPIN_RSS_ACTION;
+				flow_actions[actions_idx++] =
+					HAIRPIN_RSS_ACTION;
 				printf("hairpin-rss / ");
 			}
 			if (strcmp(lgopts[opt_idx].name,
@@ -375,7 +402,8 @@ args_parse(int argc, char **argv)
 					rte_exit(EXIT_SUCCESS,
 						"Hairpin queues should be > 0\n");
 
-				flow_actions |= HAIRPIN_QUEUE_ACTION;
+				flow_actions[actions_idx++] =
+					HAIRPIN_QUEUE_ACTION;
 				printf("hairpin-queue / ");
 			}
 
@@ -558,6 +586,11 @@ flows_handler(void)
 	int port_id;
 	int iter_id;
 	uint32_t flow_index;
+	uint64_t global_items[MAX_ITEMS_NUM] = { 0 };
+	uint64_t global_actions[MAX_ACTIONS_NUM] = { 0 };
+
+	global_items[0] = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH);
+	global_actions[0] = FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_JUMP);
 
 	nr_ports = rte_eth_dev_count_avail();
 
@@ -587,8 +620,7 @@ flows_handler(void)
 			 *
 			 */
 			flow = generate_flow(port_id, 0, flow_attrs,
-				FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH),
-				FLOW_ITEM_MASK(RTE_FLOW_ACTION_TYPE_JUMP),
+				global_items, global_actions,
 				flow_group, 0, 0, &error);
 
 			if (flow == NULL) {
diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index a19ec6db2b..d3ba4cd1d0 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -272,6 +272,14 @@ New Features
   of ingress packets to specific NIC queues.
   See the :doc:`../sample_app_ug/ipsec_secgw` for more details.
 
+* **Add more support for flow-perf application.**
+
+  * Start supporting user order instead of bit mask:
+    Now the user can create any structure of rte_flow
+    using flow performance application with any order,
+    moreover the app also now starts to support inner
+    items matching as well.
+
 
 Removed Items
 -------------
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index ca551aee6e..6941155fee 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -16,20 +16,18 @@ After that the application will start producing rules with same pattern
 but increasing the outer IP source address by 1 each time, thus it will
 give different flow each time, and all other items will have open masks.
 
+The application also provide the ability to measure rte flow deletion rate,
+in addition to memory consumption before and after the flows creation.
+
+The app supports single and multi core performance measurements.
+
 
 Known Limitations
 -----------------
 
 The current version has limitations which can be removed in future:
 
-* Support outer items up to tunnel layer only.
 * Single core insertion only.
-* Only one instance of same action can be added in one rule.
-
-The application also provide the ability to measure rte flow deletion rate,
-in addition to memory consumption before and after the flows creation.
-
-The app supports single and multi core performance measurements.
 
 
 Compiling the Application
-- 
2.17.1


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

* [dpdk-dev] [PATCH 04/13] app/flow-perf: add header modify actions support
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (2 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 03/13] app/flow-perf: start supporting user order Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 05/13] app/flow-perf: add flag action support Wisam Jaddo
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

Introduce headers modify actions in the app.
All header modify actions will add different value
for each flow, to make sure each flow will create
and use it's own actions.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/actions_gen.c       | 344 +++++++++++++++++++++++++
 app/test-flow-perf/main.c              | 180 ++++++++++++-
 doc/guides/rel_notes/release_20_08.rst |   2 +
 doc/guides/tools/flow-perf.rst         |  59 +++++
 4 files changed, 583 insertions(+), 2 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index d115cdd723..7e0637595a 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -21,6 +21,7 @@ struct additional_para {
 	uint16_t next_table;
 	uint16_t *queues;
 	uint16_t queues_number;
+	uint32_t counter;
 };
 
 /* Storage for struct rte_flow_action_rss including external data. */
@@ -181,6 +182,252 @@ add_count(struct rte_flow_action *actions,
 	actions[actions_counter].conf = &count_action;
 }
 
+static void
+add_set_src_mac(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_mac set_mac;
+	uint32_t mac = para.counter;
+	uint16_t i;
+
+	/* Mac address to be set is random each time */
+	for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) {
+		set_mac.mac_addr[i] = mac & 0xff;
+		mac = mac >> 8;
+	}
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_MAC_SRC;
+	actions[actions_counter].conf = &set_mac;
+}
+
+static void
+add_set_dst_mac(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_mac set_mac;
+	uint32_t mac = para.counter;
+	uint16_t i;
+
+	/* Mac address to be set is random each time */
+	for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) {
+		set_mac.mac_addr[i] = mac & 0xff;
+		mac = mac >> 8;
+	}
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_MAC_DST;
+	actions[actions_counter].conf = &set_mac;
+}
+
+static void
+add_set_src_ipv4(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_ipv4 set_ipv4;
+
+	/* IPv4 value to be set is random each time */
+	set_ipv4.ipv4_addr = RTE_BE32(para.counter + 1);
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC;
+	actions[actions_counter].conf = &set_ipv4;
+}
+
+static void
+add_set_dst_ipv4(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_ipv4 set_ipv4;
+
+	/* IPv4 value to be set is random each time */
+	set_ipv4.ipv4_addr = RTE_BE32(para.counter + 1);
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV4_DST;
+	actions[actions_counter].conf = &set_ipv4;
+}
+
+static void
+add_set_src_ipv6(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_ipv6 set_ipv6;
+	uint32_t ipv6 = para.counter;
+	uint8_t i;
+
+	/* IPv6 value to set is random each time */
+	for (i = 0; i < 16; i++) {
+		set_ipv6.ipv6_addr[i] = ipv6 & 0xff;
+		ipv6 = ipv6 >> 8;
+	}
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC;
+	actions[actions_counter].conf = &set_ipv6;
+}
+
+static void
+add_set_dst_ipv6(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_ipv6 set_ipv6;
+	uint32_t ipv6 = para.counter;
+	uint8_t i;
+
+	/* IPv6 value to set is random each time */
+	for (i = 0; i < 16; i++) {
+		set_ipv6.ipv6_addr[i] = ipv6 & 0xff;
+		ipv6 = ipv6 >> 8;
+	}
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV6_DST;
+	actions[actions_counter].conf = &set_ipv6;
+}
+
+static void
+add_set_src_tp(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_tp set_tp;
+	uint32_t tp = para.counter;
+
+	/* TP src port is random each time */
+	if (tp > 0xffff)
+		tp = tp >> 16;
+
+	set_tp.port = RTE_BE16(tp & 0xffff);
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_TP_SRC;
+	actions[actions_counter].conf = &set_tp;
+}
+
+static void
+add_set_dst_tp(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_tp set_tp;
+	uint32_t tp = para.counter;
+
+	/* TP src port is random each time */
+	if (tp > 0xffff)
+		tp = tp >> 16;
+
+	set_tp.port = RTE_BE16(tp & 0xffff);
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_TP_DST;
+	actions[actions_counter].conf = &set_tp;
+}
+
+static void
+add_inc_tcp_ack(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static rte_be32_t value = RTE_BE32(1);
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_INC_TCP_ACK;
+	actions[actions_counter].conf = &value;
+}
+
+static void
+add_dec_tcp_ack(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static rte_be32_t value = RTE_BE32(1);
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK;
+	actions[actions_counter].conf = &value;
+}
+
+static void
+add_inc_tcp_seq(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static rte_be32_t value = RTE_BE32(1);
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ;
+	actions[actions_counter].conf = &value;
+}
+
+static void
+add_dec_tcp_seq(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static rte_be32_t value = RTE_BE32(1);
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ;
+	actions[actions_counter].conf = &value;
+}
+
+static void
+add_set_ttl(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_ttl set_ttl;
+	uint32_t ttl_value = para.counter;
+
+	/* Set ttl to random value each time */
+	while (ttl_value > 0xff)
+		ttl_value = ttl_value >> 8;
+
+	set_ttl.ttl_value = ttl_value;
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_TTL;
+	actions[actions_counter].conf = &set_ttl;
+}
+
+static void
+add_dec_ttl(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_DEC_TTL;
+}
+
+static void
+add_set_ipv4_dscp(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_dscp set_dscp;
+	uint32_t dscp_value = para.counter;
+
+	/* Set dscp to random value each time */
+	while (dscp_value > 0xff)
+		dscp_value = dscp_value >> 8;
+
+	set_dscp.dscp = dscp_value;
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP;
+	actions[actions_counter].conf = &set_dscp;
+}
+
+static void
+add_set_ipv6_dscp(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_set_dscp set_dscp;
+	uint32_t dscp_value = para.counter;
+
+	/* Set dscp to random value each time */
+	while (dscp_value > 0xff)
+		dscp_value = dscp_value >> 8;
+
+	set_dscp.dscp = dscp_value;
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP;
+	actions[actions_counter].conf = &set_dscp;
+}
+
 void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq)
@@ -202,6 +449,7 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 		.next_table = next_table,
 		.queues = queues,
 		.queues_number = RXQ_NUM,
+		.counter = counter,
 	};
 
 	if (hairpinq != 0) {
@@ -234,6 +482,102 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_TAG),
 			.funct = add_set_tag,
 		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_MAC_SRC
+			),
+			.funct = add_set_src_mac,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_MAC_DST
+			),
+			.funct = add_set_dst_mac,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
+			),
+			.funct = add_set_src_ipv4,
+		},
+		{
+			.mask =	FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
+			),
+			.funct = add_set_dst_ipv4,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
+			),
+			.funct = add_set_src_ipv6,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
+			),
+			.funct = add_set_dst_ipv6,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_TP_SRC
+			),
+			.funct = add_set_src_tp,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_TP_DST
+			),
+			.funct = add_set_dst_tp,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_INC_TCP_ACK
+			),
+			.funct = add_inc_tcp_ack,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK
+			),
+			.funct = add_dec_tcp_ack,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ
+			),
+			.funct = add_inc_tcp_seq,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ
+			),
+			.funct = add_dec_tcp_seq,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_TTL
+			),
+			.funct = add_set_ttl,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_DEC_TTL
+			),
+			.funct = add_dec_ttl,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
+			),
+			.funct = add_set_ipv4_dscp,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
+			),
+			.funct = add_set_ipv6_dscp,
+		},
 		{
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_QUEUE),
 			.funct = add_queue,
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 0ff8080aa0..1f693d4ed1 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -138,6 +138,38 @@ usage(char *progname)
 	printf("  --drop: add drop action in flow actions\n");
 	printf("  --hairpin-queue=N: add hairpin-queue action in flow actions\n");
 	printf("  --hairpin-rss=N: add hairpin-rss action in flow actions\n");
+	printf("  --set-src-mac: add set src mac action to flow actions\n"
+		"Src mac to be set is random each flow\n");
+	printf("  --set-dst-mac: add set dst mac action to flow actions\n"
+		 "Dst mac to be set is random each flow\n");
+	printf("  --set-src-ipv4: add set src ipv4 action to flow actions\n"
+		"Src ipv4 to be set is random each flow\n");
+	printf("  --set-dst-ipv4 add set dst ipv4 action to flow actions\n"
+		"Dst ipv4 to be set is random each flow\n");
+	printf("  --set-src-ipv6: add set src ipv6 action to flow actions\n"
+		"Src ipv6 to be set is random each flow\n");
+	printf("  --set-dst-ipv6: add set dst ipv6 action to flow actions\n"
+		"Dst ipv6 to be set is random each flow\n");
+	printf("  --set-src-tp: add set src tp action to flow actions\n"
+		"Src tp to be set is random each flow\n");
+	printf("  --set-dst-tp: add set dst tp action to flow actions\n"
+		"Dst tp to be set is random each flow\n");
+	printf("  --inc-tcp-ack: add inc tcp ack action to flow actions\n"
+		"tcp ack will be increments by 1\n");
+	printf("  --dec-tcp-ack: add dec tcp ack action to flow actions\n"
+		"tcp ack will be decrements by 1\n");
+	printf("  --inc-tcp-seq: add inc tcp seq action to flow actions\n"
+		"tcp seq will be increments by 1\n");
+	printf("  --dec-tcp-seq: add dec tcp seq action to flow actions\n"
+		"tcp seq will be decrements by 1\n");
+	printf("  --set-ttl: add set ttl action to flow actions\n"
+		"L3 ttl to be set is random each flow\n");
+	printf("  --dec-ttl: add dec ttl action to flow actions\n"
+		"L3 ttl will be decrements by 1\n");
+	printf("  --set-ipv4-dscp: add set ipv4 dscp action to flow actions\n"
+		"ipv4 dscp value to be set is random each flow\n");
+	printf("  --set-ipv6-dscp: add set ipv6 dscp action to flow actions\n"
+		"ipv6 dscp value to be set is random each flow\n");
 }
 
 static void
@@ -304,7 +336,135 @@ args_parse(int argc, char **argv)
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_DROP),
 			.map = &flow_actions[0],
 			.map_idx = &actions_idx
-		}
+		},
+		{
+			.str = "set-src-mac",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_MAC_SRC
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-dst-mac",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_MAC_DST
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-src-ipv4",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-dst-ipv4",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-src-ipv6",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-dst-ipv6",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-src-tp",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_TP_SRC
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-dst-tp",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_TP_DST
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "inc-tcp-ack",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_INC_TCP_ACK
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "dec-tcp-ack",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "inc-tcp-seq",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "dec-tcp-seq",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-ttl",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_TTL
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "dec-ttl",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_DEC_TTL
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-ipv4-dscp",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "set-ipv6-dscp",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
 	};
 
 	static const struct option lgopts[] = {
@@ -346,6 +506,22 @@ args_parse(int argc, char **argv)
 		{ "drop",                       0, 0, 0 },
 		{ "hairpin-queue",              1, 0, 0 },
 		{ "hairpin-rss",                1, 0, 0 },
+		{ "set-src-mac",                0, 0, 0 },
+		{ "set-dst-mac",                0, 0, 0 },
+		{ "set-src-ipv4",               0, 0, 0 },
+		{ "set-dst-ipv4",               0, 0, 0 },
+		{ "set-src-ipv6",               0, 0, 0 },
+		{ "set-dst-ipv6",               0, 0, 0 },
+		{ "set-src-tp",                 0, 0, 0 },
+		{ "set-dst-tp",                 0, 0, 0 },
+		{ "inc-tcp-ack",                0, 0, 0 },
+		{ "dec-tcp-ack",                0, 0, 0 },
+		{ "inc-tcp-seq",                0, 0, 0 },
+		{ "dec-tcp-seq",                0, 0, 0 },
+		{ "set-ttl",                    0, 0, 0 },
+		{ "dec-ttl",                    0, 0, 0 },
+		{ "set-ipv4-dscp",              0, 0, 0 },
+		{ "set-ipv6-dscp",              0, 0, 0 },
 	};
 
 	hairpin_queues_num = 0;
@@ -368,7 +544,7 @@ args_parse(int argc, char **argv)
 				else
 					rte_exit(EXIT_SUCCESS,
 						"flow group should be >= 0\n");
-				printf("group %d ", flow_group);
+				printf("group %d / ", flow_group);
 			}
 
 			for (i = 0; i < RTE_DIM(flow_options); i++)
diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index d3ba4cd1d0..7c9d508a07 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -280,6 +280,8 @@ New Features
     moreover the app also now starts to support inner
     items matching as well.
 
+  * Start supporting header modify actions.
+
 
 Removed Items
 -------------
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 6941155fee..e225550e40 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -244,3 +244,62 @@ Actions:
 	Add hairpin RSS action to all flows actions.
 	The queues in RSS action will be all hairpin queues configured
 	in the app.
+
+*	``--set-src-mac``
+	Add set source mac action to all flows actions.
+	The mac to be set is random each flow.
+
+*	``--set-dst-mac``
+	Add set destination mac action to all flows actions.
+	The mac to be set is random each flow.
+
+*	``-set-src-ipv4``
+	Add set source ipv4 action to all flows actions.
+	The ipv4 header to be set is random each flow.
+
+*	``--set-dst-ipv4``
+	Add set destination ipv4 action to all flows actions.
+	The ipv4 header to be set is random each flow.
+
+*	``--set-src-ipv6``
+	Add set source ipv6 action to all flows actions.
+	The ipv6 header to be set is random each flow.
+
+*	``--set-dst-ipv6``
+	Add set destination ipv6 action to all flows actions.
+	The ipv6 header to be set is random each flow.
+
+*	``--set-src-tp``
+	Add set source tp action to all flows actions.
+	The tp sport header to be set is random each flow.
+
+*	``--set-dst-tp``
+	Add set destination tp action to all flows actions.
+	The tp dport header to be set is random each flow.
+
+*	``--inc-tcp-ack``
+	Add increment TCP acknowledgment by one to all flows actions.
+
+*	``--dec-tcp-ack``
+	Add decrement TCP acknowledgment by one to all flows actions.
+
+*	``--inc-tcp-seq``
+	Add increment TCP sequence by one to all flows actions.
+
+*	``--dec-tcp-seq``
+	Add decrement TCP sequence by one to all flows actions.
+
+*	``--set-ttl``
+	Add set IP ttl action to all flows actions.
+	The ttl value to be set is random each flow.
+
+*	``--dec-ttl``
+	Add decrement IP ttl by one to all flows actions.
+
+*	``--set-ipv4-dscp``
+	Add set IPv4 dscp action to all flows actions.
+	The dscp value to be is random each flow.
+
+*	``--set-ipv6-dscp``
+	Add set IPv6 dscp action to all flows actions.
+	The dscp value to be is random each flow.
-- 
2.17.1


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

* [dpdk-dev] [PATCH 05/13] app/flow-perf: add flag action support
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (3 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 04/13] app/flow-perf: add header modify actions support Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 06/13] app/flow-perf: fix memory leak from RSS action Wisam Jaddo
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

Introudce flag action support to flow perf
application.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/actions_gen.c       | 14 ++++++++++++++
 app/test-flow-perf/main.c              | 10 ++++++++++
 doc/guides/rel_notes/release_20_08.rst |  1 +
 doc/guides/tools/flow-perf.rst         |  3 +++
 4 files changed, 28 insertions(+)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 7e0637595a..9fe11abc94 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -428,6 +428,14 @@ add_set_ipv6_dscp(struct rte_flow_action *actions,
 	actions[actions_counter].conf = &set_dscp;
 }
 
+static void
+add_flag(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_FLAG;
+}
+
 void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq)
@@ -482,6 +490,12 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 			.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_TAG),
 			.funct = add_set_tag,
 		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_FLAG
+			),
+			.funct = add_flag,
+		},
 		{
 			.mask = FLOW_ACTION_MASK(
 				RTE_FLOW_ACTION_TYPE_SET_MAC_SRC
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 1f693d4ed1..ae0d1a3be5 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -170,6 +170,7 @@ usage(char *progname)
 		"ipv4 dscp value to be set is random each flow\n");
 	printf("  --set-ipv6-dscp: add set ipv6 dscp action to flow actions\n"
 		"ipv6 dscp value to be set is random each flow\n");
+	printf("  --flag: add flag action to flow actions\n");
 }
 
 static void
@@ -465,6 +466,14 @@ args_parse(int argc, char **argv)
 			.map = &flow_actions[0],
 			.map_idx = &actions_idx
 		},
+		{
+			.str = "flag",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_FLAG
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
 	};
 
 	static const struct option lgopts[] = {
@@ -522,6 +531,7 @@ args_parse(int argc, char **argv)
 		{ "dec-ttl",                    0, 0, 0 },
 		{ "set-ipv4-dscp",              0, 0, 0 },
 		{ "set-ipv6-dscp",              0, 0, 0 },
+		{ "flag",                       0, 0, 0 },
 	};
 
 	hairpin_queues_num = 0;
diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index 7c9d508a07..eed3900a8c 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -281,6 +281,7 @@ New Features
     items matching as well.
 
   * Start supporting header modify actions.
+  * Start supporting flag action.
 
 
 Removed Items
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index e225550e40..69cdd1b222 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -303,3 +303,6 @@ Actions:
 *	``--set-ipv6-dscp``
 	Add set IPv6 dscp action to all flows actions.
 	The dscp value to be is random each flow.
+
+*	``--flag``
+	Add flag action to all flows actions.
-- 
2.17.1


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

* [dpdk-dev] [PATCH 06/13] app/flow-perf: fix memory leak from RSS action
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (4 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 05/13] app/flow-perf: add flag action support Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 07/13] app/flow-perf: add raw encap/decap actions support Wisam Jaddo
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin; +Cc: wisamm

Currently, each call for add_rss_action will allocate
extra memory for rss_data, which will reflect bad results
on memory consumption for all flows, and will leads into
memory leak.

In this fix, it will check if it's allocated before
reallocating it.

Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation")
Cc: wisamm@mellanox.com

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/actions_gen.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 9fe11abc94..99e47bf786 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -86,8 +86,9 @@ add_rss(struct rte_flow_action *actions,
 
 	uint16_t queue;
 
-	rss_data = rte_malloc("rss_data",
-		sizeof(struct action_rss_data), 0);
+	if (rss_data == NULL)
+		rss_data = rte_malloc("rss_data",
+			sizeof(struct action_rss_data), 0);
 
 	if (rss_data == NULL)
 		rte_exit(EXIT_FAILURE, "No Memory available!");
-- 
2.17.1


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

* [dpdk-dev] [PATCH 07/13] app/flow-perf: add raw encap/decap actions support
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (5 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 06/13] app/flow-perf: fix memory leak from RSS action Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 08/13] app/flow-perf: add VXLAN " Wisam Jaddo
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

Introduce raw-encap and raw-decap actions.
The two actions are added in command line
options, and for the data to encap or decap
the user need to parse it within the command
line.

All values of raw-encap data is set to be fixed
values.

Usage example:

--raw-encap=ether,ipv4,udp,vxlan

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/actions_gen.c       | 330 ++++++++++++++++++++++++-
 app/test-flow-perf/actions_gen.h       |   8 +-
 app/test-flow-perf/flow_gen.c          |   5 +-
 app/test-flow-perf/flow_gen.h          |   2 +
 app/test-flow-perf/main.c              |  70 +++++-
 doc/guides/rel_notes/release_20_08.rst |   1 +
 doc/guides/tools/flow-perf.rst         |  10 +
 7 files changed, 421 insertions(+), 5 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 99e47bf786..3ae6059fb1 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -10,6 +10,8 @@
 #include <rte_malloc.h>
 #include <rte_flow.h>
 #include <rte_ethdev.h>
+#include <rte_vxlan.h>
+#include <rte_gtp.h>
 
 #include "actions_gen.h"
 #include "flow_gen.h"
@@ -22,6 +24,23 @@ struct additional_para {
 	uint16_t *queues;
 	uint16_t queues_number;
 	uint32_t counter;
+	uint64_t encap_data;
+	uint64_t decap_data;
+};
+
+/* Storage for struct rte_flow_action_raw_encap including external data. */
+struct action_raw_encap_data {
+	struct rte_flow_action_raw_encap conf;
+	uint8_t data[128];
+	uint8_t preserve[128];
+	uint16_t idx;
+};
+
+/* Storage for struct rte_flow_action_raw_decap including external data. */
+struct action_raw_decap_data {
+	struct rte_flow_action_raw_decap conf;
+	uint8_t data[128];
+	uint16_t idx;
 };
 
 /* Storage for struct rte_flow_action_rss including external data. */
@@ -437,9 +456,304 @@ add_flag(struct rte_flow_action *actions,
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_FLAG;
 }
 
+static void
+add_ether_header(uint8_t **header, uint64_t data,
+	__rte_unused struct additional_para para)
+{
+	struct rte_flow_item_eth eth_item;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH)))
+		return;
+
+	memset(&eth_item, 0, sizeof(struct rte_flow_item_eth));
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VLAN))
+		eth_item.type = RTE_BE16(RTE_ETHER_TYPE_VLAN);
+	else if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4))
+		eth_item.type = RTE_BE16(RTE_ETHER_TYPE_IPV4);
+	else if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6))
+		eth_item.type = RTE_BE16(RTE_ETHER_TYPE_IPV6);
+	memcpy(*header, &eth_item, sizeof(eth_item));
+	*header += sizeof(eth_item);
+}
+
+static void
+add_vlan_header(uint8_t **header, uint64_t data,
+	__rte_unused struct additional_para para)
+{
+	struct rte_flow_item_vlan vlan_item;
+	uint16_t vlan_value;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VLAN)))
+		return;
+
+	vlan_value = VLAN_VALUE;
+
+	memset(&vlan_item, 0, sizeof(struct rte_flow_item_vlan));
+	vlan_item.tci = RTE_BE16(vlan_value);
+
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4))
+		vlan_item.inner_type = RTE_BE16(RTE_ETHER_TYPE_IPV4);
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6))
+		vlan_item.inner_type = RTE_BE16(RTE_ETHER_TYPE_IPV6);
+	memcpy(*header, &vlan_item, sizeof(vlan_item));
+	*header += sizeof(vlan_item);
+}
+
+static void
+add_ipv4_header(uint8_t **header, uint64_t data,
+	struct additional_para para)
+{
+	struct rte_flow_item_ipv4 ipv4_item;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4)))
+		return;
+
+	memset(&ipv4_item, 0, sizeof(struct rte_flow_item_ipv4));
+	ipv4_item.hdr.src_addr = RTE_IPV4(127, 0, 0, 1);
+	ipv4_item.hdr.dst_addr = RTE_BE32(para.counter);
+	ipv4_item.hdr.version_ihl = RTE_IPV4_VHL_DEF;
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP))
+		ipv4_item.hdr.next_proto_id = RTE_IP_TYPE_UDP;
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE))
+		ipv4_item.hdr.next_proto_id = RTE_IP_TYPE_GRE;
+	memcpy(*header, &ipv4_item, sizeof(ipv4_item));
+	*header += sizeof(ipv4_item);
+}
+
+static void
+add_ipv6_header(uint8_t **header, uint64_t data,
+	__rte_unused struct additional_para para)
+{
+	struct rte_flow_item_ipv6 ipv6_item;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6)))
+		return;
+
+	memset(&ipv6_item, 0, sizeof(struct rte_flow_item_ipv6));
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP))
+		ipv6_item.hdr.proto = RTE_IP_TYPE_UDP;
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE))
+		ipv6_item.hdr.proto = RTE_IP_TYPE_GRE;
+	memcpy(*header, &ipv6_item, sizeof(ipv6_item));
+	*header += sizeof(ipv6_item);
+}
+
+static void
+add_udp_header(uint8_t **header, uint64_t data,
+	__rte_unused struct additional_para para)
+{
+	struct rte_flow_item_udp udp_item;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP)))
+		return;
+
+	memset(&udp_item, 0, sizeof(struct rte_flow_item_udp));
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN))
+		udp_item.hdr.dst_port = RTE_BE16(RTE_VXLAN_DEFAULT_PORT);
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE))
+		udp_item.hdr.dst_port = RTE_BE16(RTE_VXLAN_GPE_UDP_PORT);
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE))
+		udp_item.hdr.dst_port = RTE_BE16(RTE_GENEVE_UDP_PORT);
+	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP))
+		udp_item.hdr.dst_port = RTE_BE16(RTE_GTPU_UDP_PORT);
+	 memcpy(*header, &udp_item, sizeof(udp_item));
+	 *header += sizeof(udp_item);
+}
+
+static void
+add_vxlan_header(uint8_t **header, uint64_t data,
+	struct additional_para para)
+{
+	struct rte_flow_item_vxlan vxlan_item;
+	uint32_t vni_value = para.counter;
+	uint8_t i;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN)))
+		return;
+
+	memset(&vxlan_item, 0, sizeof(struct rte_flow_item_vxlan));
+
+	for (i = 0; i < 3; i++)
+		vxlan_item.vni[2 - i] = vni_value >> (i * 8);
+	vxlan_item.flags = 0x8;
+
+	memcpy(*header, &vxlan_item, sizeof(vxlan_item));
+	*header += sizeof(vxlan_item);
+}
+
+static void
+add_vxlan_gpe_header(uint8_t **header, uint64_t data,
+	struct additional_para para)
+{
+	struct rte_flow_item_vxlan_gpe vxlan_gpe_item;
+	uint32_t vni_value = para.counter;
+	uint8_t i;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE)))
+		return;
+
+	memset(&vxlan_gpe_item, 0, sizeof(struct rte_flow_item_vxlan_gpe));
+
+	for (i = 0; i < 3; i++)
+		vxlan_gpe_item.vni[2 - i] = vni_value >> (i * 8);
+	vxlan_gpe_item.flags = 0x0c;
+
+	memcpy(*header, &vxlan_gpe_item, sizeof(vxlan_gpe_item));
+	*header += sizeof(vxlan_gpe_item);
+}
+
+static void
+add_gre_header(uint8_t **header, uint64_t data,
+	__rte_unused struct additional_para para)
+{
+	struct rte_flow_item_gre gre_item;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE)))
+		return;
+
+	memset(&gre_item, 0, sizeof(struct rte_flow_item_gre));
+
+	gre_item.protocol = RTE_BE16(RTE_ETHER_TYPE_TEB);
+
+	memcpy(*header, &gre_item, sizeof(gre_item));
+	*header += sizeof(gre_item);
+}
+
+static void
+add_geneve_header(uint8_t **header, uint64_t data,
+	struct additional_para para)
+{
+	struct rte_flow_item_geneve geneve_item;
+	uint32_t vni_value = para.counter;
+	uint8_t i;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE)))
+		return;
+
+	memset(&geneve_item, 0, sizeof(struct rte_flow_item_geneve));
+
+	for (i = 0; i < 3; i++)
+		geneve_item.vni[2 - i] = vni_value >> (i * 8);
+
+	memcpy(*header, &geneve_item, sizeof(geneve_item));
+	*header += sizeof(geneve_item);
+}
+
+static void
+add_gtp_header(uint8_t **header, uint64_t data,
+	struct additional_para para)
+{
+	struct rte_flow_item_gtp gtp_item;
+
+	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP)))
+		return;
+
+	memset(&gtp_item, 0, sizeof(struct rte_flow_item_gtp));
+
+	gtp_item.teid = RTE_BE32(para.counter);
+	gtp_item.msg_type = 255;
+
+	memcpy(*header, &gtp_item, sizeof(gtp_item));
+	*header += sizeof(gtp_item);
+}
+
+static const struct encap_decap_headers {
+	void (*funct)(
+		uint8_t **header,
+		uint64_t data,
+		struct additional_para para
+		);
+} headers[] = {
+	{.funct = add_ether_header},
+	{.funct = add_vlan_header},
+	{.funct = add_ipv4_header},
+	{.funct = add_ipv6_header},
+	{.funct = add_udp_header},
+	{.funct = add_vxlan_header},
+	{.funct = add_vxlan_gpe_header},
+	{.funct = add_gre_header},
+	{.funct = add_geneve_header},
+	{.funct = add_gtp_header},
+};
+
+static void
+add_raw_encap(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	struct additional_para para)
+{
+	static struct action_raw_encap_data *action_encap_data;
+	uint64_t encap_data = para.encap_data;
+	uint8_t *header;
+	uint8_t i;
+
+	/* Avoid double allocation. */
+	if (action_encap_data == NULL)
+		action_encap_data = rte_malloc("encap_data",
+			sizeof(struct action_raw_encap_data), 0);
+
+	/* Check if allocation failed. */
+	if (action_encap_data == NULL)
+		rte_exit(EXIT_FAILURE, "No Memory available!");
+
+	*action_encap_data = (struct action_raw_encap_data) {
+		.conf = (struct rte_flow_action_raw_encap) {
+			.data = action_encap_data->data,
+		},
+			.data = {},
+	};
+	header = action_encap_data->data;
+
+	for (i = 0; i < RTE_DIM(headers); i++)
+		headers[i].funct(&header, encap_data, para);
+
+	action_encap_data->conf.size = header -
+		action_encap_data->data;
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_RAW_ENCAP;
+	actions[actions_counter].conf = &action_encap_data->conf;
+}
+
+static void
+add_raw_decap(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	struct additional_para para)
+{
+	static struct action_raw_decap_data *action_decap_data;
+	uint64_t decap_data = para.decap_data;
+	uint8_t *header;
+	uint8_t i;
+
+	/* Avoid double allocation. */
+	if (action_decap_data == NULL)
+		action_decap_data = rte_malloc("decap_data",
+			sizeof(struct action_raw_decap_data), 0);
+
+	/* Check if allocation failed. */
+	if (action_decap_data == NULL)
+		rte_exit(EXIT_FAILURE, "No Memory available!");
+
+	*action_decap_data = (struct action_raw_decap_data) {
+		.conf = (struct rte_flow_action_raw_decap) {
+			.data = action_decap_data->data,
+		},
+			.data = {},
+	};
+	header = action_decap_data->data;
+
+	for (i = 0; i < RTE_DIM(headers); i++)
+		headers[i].funct(&header, decap_data, para);
+
+	action_decap_data->conf.size = header -
+		action_decap_data->data;
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_RAW_DECAP;
+	actions[actions_counter].conf = &action_decap_data->conf;
+}
+
 void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
-	uint32_t counter, uint16_t next_table, uint16_t hairpinq)
+	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
+	uint64_t encap_data, uint64_t decap_data)
 {
 	struct additional_para additional_para_data;
 	uint8_t actions_counter = 0;
@@ -459,6 +773,8 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 		.queues = queues,
 		.queues_number = RXQ_NUM,
 		.counter = counter,
+		.encap_data = encap_data,
+		.decap_data = decap_data,
 	};
 
 	if (hairpinq != 0) {
@@ -621,6 +937,18 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 			.mask = HAIRPIN_RSS_ACTION,
 			.funct = add_rss,
 		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_RAW_ENCAP
+			),
+			.funct = add_raw_encap,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_RAW_DECAP
+			),
+			.funct = add_raw_decap,
+		},
 	};
 
 	for (j = 0; j < MAX_ACTIONS_NUM; j++) {
diff --git a/app/test-flow-perf/actions_gen.h b/app/test-flow-perf/actions_gen.h
index d6918a53a6..85e3176b09 100644
--- a/app/test-flow-perf/actions_gen.h
+++ b/app/test-flow-perf/actions_gen.h
@@ -12,7 +12,13 @@
 
 #include "config.h"
 
+#define RTE_IP_TYPE_UDP	17
+#define RTE_IP_TYPE_GRE	47
+#define RTE_VXLAN_GPE_UDP_PORT 250
+#define RTE_GENEVE_UDP_PORT 6081
+
 void fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
-	uint32_t counter, uint16_t next_table, uint16_t hairpinq);
+	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
+	uint64_t encap_data, uint64_t decap_data);
 
 #endif /* FLOW_PERF_ACTION_GEN */
diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c
index b2c828c7df..a979b3856d 100644
--- a/app/test-flow-perf/flow_gen.c
+++ b/app/test-flow-perf/flow_gen.c
@@ -43,6 +43,8 @@ generate_flow(uint16_t port_id,
 	uint16_t next_table,
 	uint32_t outer_ip_src,
 	uint16_t hairpinq,
+	uint64_t encap_data,
+	uint64_t decap_data,
 	struct rte_flow_error *error)
 {
 	struct rte_flow_attr attr;
@@ -57,7 +59,8 @@ generate_flow(uint16_t port_id,
 	fill_attributes(&attr, flow_attrs, group);
 
 	fill_actions(actions, flow_actions,
-		outer_ip_src, next_table, hairpinq);
+		outer_ip_src, next_table, hairpinq,
+		encap_data, decap_data);
 
 	fill_items(items, flow_items, outer_ip_src);
 
diff --git a/app/test-flow-perf/flow_gen.h b/app/test-flow-perf/flow_gen.h
index 53469c659f..3d13737d65 100644
--- a/app/test-flow-perf/flow_gen.h
+++ b/app/test-flow-perf/flow_gen.h
@@ -32,6 +32,8 @@ generate_flow(uint16_t port_id,
 	uint16_t next_table,
 	uint32_t outer_ip_src,
 	uint16_t hairpinq,
+	uint64_t encap_data,
+	uint64_t decap_data,
 	struct rte_flow_error *error);
 
 #endif /* FLOW_PERF_FLOW_GEN */
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index ae0d1a3be5..1b456e6922 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -45,6 +45,9 @@
 struct rte_flow *flow;
 static uint8_t flow_group;
 
+static uint64_t encap_data;
+static uint64_t decap_data;
+
 static uint64_t flow_items[MAX_ITEMS_NUM];
 static uint64_t flow_actions[MAX_ACTIONS_NUM];
 static uint64_t flow_attrs[MAX_ATTRS_NUM];
@@ -171,12 +174,19 @@ usage(char *progname)
 	printf("  --set-ipv6-dscp: add set ipv6 dscp action to flow actions\n"
 		"ipv6 dscp value to be set is random each flow\n");
 	printf("  --flag: add flag action to flow actions\n");
+	printf("  --raw-encap=<data>: add raw encap action to flow actions\n"
+		"Data is the data needed to be encaped\n"
+		"Example: raw-encap=ether,ipv4,udp,vxlan\n");
+	printf("  --raw-decap=<data>: add raw decap action to flow actions\n"
+		"Data is the data needed to be decaped\n"
+		"Example: raw-decap=ether,ipv4,udp,vxlan\n");
 }
 
 static void
 args_parse(int argc, char **argv)
 {
 	char **argvopt;
+	char *token;
 	int n, opt;
 	int opt_idx;
 	size_t i;
@@ -532,6 +542,8 @@ args_parse(int argc, char **argv)
 		{ "set-ipv4-dscp",              0, 0, 0 },
 		{ "set-ipv6-dscp",              0, 0, 0 },
 		{ "flag",                       0, 0, 0 },
+		{ "raw-encap",                  1, 0, 0 },
+		{ "raw-decap",                  1, 0, 0 },
 	};
 
 	hairpin_queues_num = 0;
@@ -593,6 +605,58 @@ args_parse(int argc, char **argv)
 				printf("hairpin-queue / ");
 			}
 
+			if (strcmp(lgopts[opt_idx].name, "raw-encap") == 0) {
+				printf("raw-encap ");
+				flow_actions[actions_idx++] =
+					FLOW_ITEM_MASK(
+						RTE_FLOW_ACTION_TYPE_RAW_ENCAP
+					);
+
+				token = strtok(optarg, ",");
+				while (token != NULL) {
+					for (i = 0; i < RTE_DIM(flow_options); i++) {
+						if (strcmp(flow_options[i].str, token) == 0) {
+							printf("%s,", token);
+							encap_data |= flow_options[i].mask;
+							break;
+						}
+						/* Reached last item with no match */
+						if (i == (RTE_DIM(flow_options) - 1)) {
+							fprintf(stderr, "Invalid encap item: %s\n", token);
+							usage(argv[0]);
+							rte_exit(EXIT_SUCCESS, "Invalid encap item\n");
+						}
+					}
+					token = strtok(NULL, ",");
+				}
+				printf(" / ");
+			}
+			if (strcmp(lgopts[opt_idx].name, "raw-decap") == 0) {
+				printf("raw-decap ");
+				flow_actions[actions_idx++] =
+					FLOW_ITEM_MASK(
+						RTE_FLOW_ACTION_TYPE_RAW_DECAP
+					);
+
+				token = strtok(optarg, ",");
+				while (token != NULL) {
+					for (i = 0; i < RTE_DIM(flow_options); i++) {
+						if (strcmp(flow_options[i].str, token) == 0) {
+							printf("%s,", token);
+							encap_data |= flow_options[i].mask;
+							break;
+						}
+						/* Reached last item with no match */
+						if (i == (RTE_DIM(flow_options) - 1)) {
+							fprintf(stderr, "Invalid decap item: %s\n", token);
+							usage(argv[0]);
+							rte_exit(EXIT_SUCCESS, "Invalid decap item\n");
+						}
+					}
+					token = strtok(NULL, ",");
+				}
+				printf(" / ");
+			}
 			/* Control */
 			if (strcmp(lgopts[opt_idx].name,
 					"flows-count") == 0) {
@@ -807,7 +871,7 @@ flows_handler(void)
 			 */
 			flow = generate_flow(port_id, 0, flow_attrs,
 				global_items, global_actions,
-				flow_group, 0, 0, &error);
+				flow_group, 0, 0, 0, 0, &error);
 
 			if (flow == NULL) {
 				print_flow_error(error);
@@ -823,7 +887,9 @@ flows_handler(void)
 			flow = generate_flow(port_id, flow_group,
 				flow_attrs, flow_items, flow_actions,
 				JUMP_ACTION_TABLE, i,
-				hairpin_queues_num, &error);
+				hairpin_queues_num,
+				encap_data, decap_data,
+				&error);
 
 			if (force_quit)
 				i = flows_count;
diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index eed3900a8c..5a94eacded 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -282,6 +282,7 @@ New Features
 
   * Start supporting header modify actions.
   * Start supporting flag action.
+  * Start supporting raw-encap and raw-decap actions.
 
 
 Removed Items
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 69cdd1b222..10c0c422e4 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -306,3 +306,13 @@ Actions:
 
 *	``--flag``
 	Add flag action to all flows actions.
+
+*	``--raw-encap=<DATA>``
+	Add raw encap action to all flows actions.
+	Data is the data needed to be encaped, with fixed values.
+	Example: raw-encap=ether,ipv4,udp,vxlan
+
+*	``--raw-decap=<DATA>``
+	Add raw decap action to all flows actions.
+	Data is the data needed to be decaped, with fixed values.
+	Example: raw-decap=ether,ipv4,gre
-- 
2.17.1


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

* [dpdk-dev] [PATCH 08/13] app/flow-perf: add VXLAN encap/decap actions support
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (6 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 07/13] app/flow-perf: add raw encap/decap actions support Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 09/13] app/flow-perf: fix source ipv4 matching Wisam Jaddo
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

Introduce vxlan-encap and vxlan-decap actions.

vxlan-encap have fixed pattern and values for
encap data.

Usage example:
--vxlan-encap
--vxlan-decap

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/actions_gen.c       | 64 ++++++++++++++++++++++++++
 app/test-flow-perf/main.c              | 22 +++++++++
 doc/guides/rel_notes/release_20_08.rst |  1 +
 doc/guides/tools/flow-perf.rst         |  8 ++++
 4 files changed, 95 insertions(+)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 3ae6059fb1..10ddef4deb 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -17,6 +17,7 @@
 #include "flow_gen.h"
 #include "config.h"
 
+
 /* Storage for additional parameters for actions */
 struct additional_para {
 	uint16_t queue;
@@ -750,6 +751,57 @@ add_raw_decap(struct rte_flow_action *actions,
 	actions[actions_counter].conf = &action_decap_data->conf;
 }
 
+static void
+add_vxlan_encap(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_action_vxlan_encap vxlan_encap;
+	static struct rte_flow_item items[5];
+	static struct rte_flow_item_eth item_eth;
+	static struct rte_flow_item_ipv4 item_ipv4;
+	static struct rte_flow_item_udp item_udp;
+	static struct rte_flow_item_vxlan item_vxlan;
+
+	items[0].spec = &item_eth;
+	items[0].mask = &item_eth;
+	items[0].type = RTE_FLOW_ITEM_TYPE_ETH;
+
+	item_ipv4.hdr.src_addr = RTE_IPV4(127, 0, 0, 1);
+	item_ipv4.hdr.dst_addr = RTE_IPV4(255, 255, 255, 255);
+	item_ipv4.hdr.version_ihl = RTE_IPV4_VHL_DEF;
+	items[1].spec = &item_ipv4;
+	items[1].mask = &item_ipv4;
+	items[1].type = RTE_FLOW_ITEM_TYPE_IPV4;
+
+
+	item_udp.hdr.dst_port = RTE_BE16(RTE_VXLAN_DEFAULT_PORT);
+	items[2].spec = &item_udp;
+	items[2].mask = &item_udp;
+	items[2].type = RTE_FLOW_ITEM_TYPE_UDP;
+
+
+	item_vxlan.vni[2] = 1;
+	items[3].spec = &item_vxlan;
+	items[3].mask = &item_vxlan;
+	items[3].type = RTE_FLOW_ITEM_TYPE_VXLAN;
+
+	items[4].type = RTE_FLOW_ITEM_TYPE_END;
+
+	vxlan_encap.definition = items;
+
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP;
+	actions[actions_counter].conf = &vxlan_encap;
+}
+
+static void
+add_vxlan_decap(struct rte_flow_action *actions,
+	uint8_t actions_counter,
+	__rte_unused struct additional_para para)
+{
+	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_VXLAN_DECAP;
+}
+
 void
 fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 	uint32_t counter, uint16_t next_table, uint16_t hairpinq,
@@ -949,6 +1001,18 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
 			),
 			.funct = add_raw_decap,
 		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP
+			),
+			.funct = add_vxlan_encap,
+		},
+		{
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_VXLAN_DECAP
+			),
+			.funct = add_vxlan_decap,
+		},
 	};
 
 	for (j = 0; j < MAX_ACTIONS_NUM; j++) {
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 1b456e6922..0a030a462c 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -180,6 +180,10 @@ usage(char *progname)
 	printf("  --raw-decap=<data>: add raw decap action to flow actions\n"
 		"Data is the data needed to be decaped\n"
 		"Example: raw-decap=ether,ipv4,udp,vxlan\n");
+	printf("  --vxlan-encap: add vxlan-encap action to flow actions\n"
+		"Encapped data is fixed with pattern: ether,ipv4,udp,vxlan\n"
+		"With fixed values\n");
+	printf("  --vxlan-decap: add vxlan_decap action to flow actions\n");
 }
 
 static void
@@ -484,6 +488,22 @@ args_parse(int argc, char **argv)
 			.map = &flow_actions[0],
 			.map_idx = &actions_idx
 		},
+		{
+			.str = "vxlan-encap",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
+		{
+			.str = "vxlan-decap",
+			.mask = FLOW_ACTION_MASK(
+				RTE_FLOW_ACTION_TYPE_VXLAN_DECAP
+			),
+			.map = &flow_actions[0],
+			.map_idx = &actions_idx
+		},
 	};
 
 	static const struct option lgopts[] = {
@@ -544,6 +564,8 @@ args_parse(int argc, char **argv)
 		{ "flag",                       0, 0, 0 },
 		{ "raw-encap",                  1, 0, 0 },
 		{ "raw-decap",                  1, 0, 0 },
+		{ "vxlan-encap",                0, 0, 0 },
+		{ "vxlan-decap",                0, 0, 0 },
 	};
 
 	hairpin_queues_num = 0;
diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index 5a94eacded..c0f7ab6293 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -283,6 +283,7 @@ New Features
   * Start supporting header modify actions.
   * Start supporting flag action.
   * Start supporting raw-encap and raw-decap actions.
+  * Start supporting vxlan-encap and vxlan-decap actions.
 
 
 Removed Items
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 10c0c422e4..15b4273cc0 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -316,3 +316,11 @@ Actions:
 	Add raw decap action to all flows actions.
 	Data is the data needed to be decaped, with fixed values.
 	Example: raw-decap=ether,ipv4,gre
+
+*	``--vxlan-encap``
+	Add vxlan encap action to all flows actions.
+	Data to encap is fixed with pattern: ether,ipv4,udp,vxlan,
+	all encapped items have fixed values.
+
+*	``--vxlan-decap``
+	Add vxlan decap action to all flows actions.
-- 
2.17.1


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

* [dpdk-dev] [PATCH 09/13] app/flow-perf: fix source ipv4 matching
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (7 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 08/13] app/flow-perf: add VXLAN " Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 10/13] app/flow-perf: add random mark id values Wisam Jaddo
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin; +Cc: wisamm

All value must be converted into intended endianness.

Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation")
Cc: wisamm@mellanox.com

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/items_gen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-flow-perf/items_gen.c b/app/test-flow-perf/items_gen.c
index cc031f24a5..8277ac70da 100644
--- a/app/test-flow-perf/items_gen.c
+++ b/app/test-flow-perf/items_gen.c
@@ -64,7 +64,7 @@ add_ipv4(struct rte_flow_item *items,
 	memset(&ipv4_spec, 0, sizeof(struct rte_flow_item_ipv4));
 	memset(&ipv4_mask, 0, sizeof(struct rte_flow_item_ipv4));
 
-	ipv4_spec.hdr.src_addr = para.src_ip;
+	ipv4_spec.hdr.src_addr = RTE_BE32(para.src_ip);
 	ipv4_mask.hdr.src_addr = RTE_BE32(0xffffffff);
 
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_IPV4;
-- 
2.17.1


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

* [dpdk-dev] [PATCH 10/13] app/flow-perf: add random mark id values
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (8 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 09/13] app/flow-perf: fix source ipv4 matching Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 11/13] app/flow-perf: add set port mask to options Wisam Jaddo
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

Instead of having single id value, use up to 256
values, thus we make sure that all flows will not
use same mark action.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/actions_gen.c | 6 ++++--
 app/test-flow-perf/config.h      | 1 -
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 10ddef4deb..278c0a3004 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -54,12 +54,14 @@ struct action_rss_data {
 static void
 add_mark(struct rte_flow_action *actions,
 	uint8_t actions_counter,
-	__rte_unused struct additional_para para)
+	struct additional_para para)
 {
 	static struct rte_flow_action_mark mark_action;
+	uint32_t counter = para.counter;
 
 	do {
-		mark_action.id = MARK_ID;
+		/* Random values from 1 to 256 */
+		mark_action.id = (counter % 255) + 1;
 	} while (0);
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_MARK;
diff --git a/app/test-flow-perf/config.h b/app/test-flow-perf/config.h
index 439f3264b4..ee1a4a3724 100644
--- a/app/test-flow-perf/config.h
+++ b/app/test-flow-perf/config.h
@@ -23,7 +23,6 @@
 #define META_DATA 1
 #define TAG_INDEX 0
 #define PORT_ID_DST 1
-#define MARK_ID 1
 #define TEID_VALUE 1
 
 /* Flow items/acctions max size */
-- 
2.17.1


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

* [dpdk-dev] [PATCH 11/13] app/flow-perf: add set port mask to options
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (9 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 10/13] app/flow-perf: add random mark id values Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 12/13] app/flow-perf: add icmp matching support Wisam Jaddo
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

Sometimes you need to check flow performance for
certain port and not all ports. Thus a portmask
option is needed.

Usage:
--portmask=N

Where N represent the hexadecimal bitmask of ports
used.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/main.c              | 20 ++++++++++++++++++++
 doc/guides/rel_notes/release_20_08.rst |  4 +++-
 doc/guides/tools/flow-perf.rst         |  3 +++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 0a030a462c..18199c6e2e 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -53,6 +53,7 @@ static uint64_t flow_actions[MAX_ACTIONS_NUM];
 static uint64_t flow_attrs[MAX_ATTRS_NUM];
 static uint8_t items_idx, actions_idx, attrs_idx;
 
+static uint64_t ports_mask;
 static volatile bool force_quit;
 static bool dump_iterations;
 static bool delete_flag;
@@ -106,6 +107,7 @@ usage(char *progname)
 	printf("  --dump-socket-mem: To dump all socket memory\n");
 	printf("  --enable-fwd: To enable packets forwarding"
 		" after insertion\n");
+	printf("  --portmask=N: hexadecimal bitmask of ports used\n");
 
 	printf("To set flow attributes:\n");
 	printf("  --ingress: set ingress attribute in flows\n");
@@ -189,8 +191,10 @@ usage(char *progname)
 static void
 args_parse(int argc, char **argv)
 {
+	uint64_t pm;
 	char **argvopt;
 	char *token;
+	char *end;
 	int n, opt;
 	int opt_idx;
 	size_t i;
@@ -514,6 +518,7 @@ args_parse(int argc, char **argv)
 		{ "deletion-rate",              0, 0, 0 },
 		{ "dump-socket-mem",            0, 0, 0 },
 		{ "enable-fwd",                 0, 0, 0 },
+		{ "portmask",                   1, 0, 0 },
 		/* Attributes */
 		{ "ingress",                    0, 0, 0 },
 		{ "egress",                     0, 0, 0 },
@@ -568,6 +573,9 @@ args_parse(int argc, char **argv)
 		{ "vxlan-decap",                0, 0, 0 },
 	};
 
+	RTE_ETH_FOREACH_DEV(i)
+		ports_mask |= 1 << i;
+
 	hairpin_queues_num = 0;
 	argvopt = argv;
 
@@ -703,6 +711,15 @@ args_parse(int argc, char **argv)
 			if (strcmp(lgopts[opt_idx].name,
 					"enable-fwd") == 0)
 				enable_fwd = true;
+			if (strcmp(lgopts[opt_idx].name,
+					"portmask") == 0) {
+				/* parse hexadecimal string */
+				end = NULL;
+				pm = strtoull(optarg, &end, 16);
+				if ((optarg[0] == '\0') || (end == NULL) || (*end != '\0'))
+					rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
+				ports_mask = pm;
+			}
 			break;
 		default:
 			fprintf(stderr, "Invalid option: %s\n", argv[optind]);
@@ -880,6 +897,9 @@ flows_handler(void)
 		rte_exit(EXIT_FAILURE, "No Memory available!");
 
 	for (port_id = 0; port_id < nr_ports; port_id++) {
+		/* If port outside portmask */
+		if (!((ports_mask >> port_id) & 0x1))
+			continue;
 		cpu_time_used = 0;
 		flow_index = 0;
 		if (flow_group > 0) {
diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index c0f7ab6293..b21f0bfb03 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -284,7 +284,9 @@ New Features
   * Start supporting flag action.
   * Start supporting raw-encap and raw-decap actions.
   * Start supporting vxlan-encap and vxlan-decap actions.
-
+  * Add new option to set portmask for insertion/deletion:
+    ``--portmask=N`` Where N represent the hexadecimal
+    bitmask of ports used.
 
 Removed Items
 -------------
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 15b4273cc0..bbefc978c6 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -84,6 +84,9 @@ The command line options are:
 *	``--enable-fwd``
 	Enable packets forwarding after insertion/deletion operations.
 
+*	``--portmask=N``
+	hexadecimal bitmask of ports to be used.
+
 
 Attributes:
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH 12/13] app/flow-perf: add icmp matching support
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (10 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 11/13] app/flow-perf: add set port mask to options Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 13/13] app/flow-perf: allow fixed values for actions Wisam Jaddo
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

Start support matching on icmpv4 and icmpv6.

Usage:
--icmpv4: add icmp item to match on.
--icmpv6: add icmpv6 item to match on.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/items_gen.c         | 41 +++++++++++++++++++++++++-
 app/test-flow-perf/main.c              | 16 ++++++++++
 doc/guides/rel_notes/release_20_08.rst |  2 ++
 doc/guides/tools/flow-perf.rst         |  6 ++++
 4 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/app/test-flow-perf/items_gen.c b/app/test-flow-perf/items_gen.c
index 8277ac70da..2b1ab41467 100644
--- a/app/test-flow-perf/items_gen.c
+++ b/app/test-flow-perf/items_gen.c
@@ -310,6 +310,38 @@ add_meta_tag(struct rte_flow_item *items,
 	items[items_counter].mask = &tag_mask;
 }
 
+static void
+add_icmpv4(struct rte_flow_item *items,
+	uint8_t items_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_item_icmp icmpv4_spec;
+	static struct rte_flow_item_icmp icmpv4_mask;
+
+	memset(&icmpv4_spec, 0, sizeof(struct rte_flow_item_icmp));
+	memset(&icmpv4_mask, 0, sizeof(struct rte_flow_item_icmp));
+
+	items[items_counter].type = RTE_FLOW_ITEM_TYPE_ICMP;
+	items[items_counter].spec = &icmpv4_spec;
+	items[items_counter].mask = &icmpv4_mask;
+}
+
+static void
+add_icmpv6(struct rte_flow_item *items,
+	uint8_t items_counter,
+	__rte_unused struct additional_para para)
+{
+	static struct rte_flow_item_icmp6 icmpv6_spec;
+	static struct rte_flow_item_icmp6 icmpv6_mask;
+
+	memset(&icmpv6_spec, 0, sizeof(struct rte_flow_item_icmp6));
+	memset(&icmpv6_mask, 0, sizeof(struct rte_flow_item_icmp6));
+
+	items[items_counter].type = RTE_FLOW_ITEM_TYPE_ICMP6;
+	items[items_counter].spec = &icmpv6_spec;
+	items[items_counter].mask = &icmpv6_mask;
+}
+
 void
 fill_items(struct rte_flow_item *items,
 	uint64_t *flow_items, uint32_t outer_ip_src)
@@ -381,7 +413,14 @@ fill_items(struct rte_flow_item *items,
 			.mask = RTE_FLOW_ITEM_TYPE_GTP,
 			.funct = add_gtp,
 		},
-
+		{
+			.mask = RTE_FLOW_ITEM_TYPE_ICMP,
+			.funct = add_icmpv4,
+		},
+		{
+			.mask = RTE_FLOW_ITEM_TYPE_ICMP6,
+			.funct = add_icmpv6,
+		},
 	};
 
 	for (j = 0; j < MAX_ITEMS_NUM; j++) {
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 18199c6e2e..c420da6a57 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -130,6 +130,8 @@ usage(char *progname)
 	printf("  --gtp: add gtp layer in flow items\n");
 	printf("  --meta: add meta layer in flow items\n");
 	printf("  --tag: add tag layer in flow items\n");
+	printf("  --icmpv4: add icmpv4 layer in flow items\n");
+	printf("  --icmpv6: add icmpv6 layer in flow items\n");
 
 	printf("To set flow actions:\n");
 	printf("  --port-id: add port-id action in flow actions\n");
@@ -284,6 +286,18 @@ args_parse(int argc, char **argv)
 			.map = &flow_items[0],
 			.map_idx = &items_idx
 		},
+		{
+			.str = "icmpv4",
+			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP),
+			.map = &flow_items[0],
+			.map_idx = &items_idx
+		},
+		{
+			.str = "icmpv6",
+			.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP6),
+			.map = &flow_items[0],
+			.map_idx = &items_idx
+		},
 		{
 			.str = "ingress",
 			.mask = INGRESS,
@@ -538,6 +552,8 @@ args_parse(int argc, char **argv)
 		{ "gtp",                        0, 0, 0 },
 		{ "meta",                       0, 0, 0 },
 		{ "tag",                        0, 0, 0 },
+		{ "icmpv4",                     0, 0, 0 },
+		{ "icmpv6",                     0, 0, 0 },
 		/* Actions */
 		{ "port-id",                    0, 0, 0 },
 		{ "rss",                        0, 0, 0 },
diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index b21f0bfb03..03eb4948e0 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -287,6 +287,8 @@ New Features
   * Add new option to set portmask for insertion/deletion:
     ``--portmask=N`` Where N represent the hexadecimal
     bitmask of ports used.
+  * Start supporting icmp and icmp6 matching items.
+
 
 Removed Items
 -------------
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index bbefc978c6..7e5dc0c54b 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -175,6 +175,12 @@ Items:
 	under ``TAG_INDEX`` with full mask, default value = 0.
 	Other fields are open mask.
 
+*	``--icmpv4``
+	Add icmpv4 item to all flows items, This item have open mask.
+
+*	``--icmpv6``
+	Add icmpv6 item to all flows items, This item have open mask.
+
 
 Actions:
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH 13/13] app/flow-perf: allow fixed values for actions
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (11 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 12/13] app/flow-perf: add icmp matching support Wisam Jaddo
@ 2020-08-30 11:15 ` Wisam Jaddo
  2020-09-14 18:15 ` [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Ferruh Yigit
  2020-09-21 21:36 ` Thomas Monjalon
  14 siblings, 0 replies; 16+ messages in thread
From: Wisam Jaddo @ 2020-08-30 11:15 UTC (permalink / raw)
  To: dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

Sometime the user want to have fixed values of
encap/decap or header modify for all flows.

This will introduce the ability to choose from
fixed or dynamic values by setting the flag in
config.h

To use different value for each flow:
config.h: #define FIXED_VALUES 0

To use single value for all flows:
config.h: #define FIXED_VALUES 1

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/actions_gen.c | 131 +++++++++++++++++++++++++++----
 app/test-flow-perf/config.h      |   6 ++
 2 files changed, 120 insertions(+), 17 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 278c0a3004..e3a95d7ab2 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -214,6 +214,10 @@ add_set_src_mac(struct rte_flow_action *actions,
 	uint32_t mac = para.counter;
 	uint16_t i;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		mac = 1;
+
 	/* Mac address to be set is random each time */
 	for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) {
 		set_mac.mac_addr[i] = mac & 0xff;
@@ -233,6 +237,10 @@ add_set_dst_mac(struct rte_flow_action *actions,
 	uint32_t mac = para.counter;
 	uint16_t i;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		mac = 1;
+
 	/* Mac address to be set is random each time */
 	for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) {
 		set_mac.mac_addr[i] = mac & 0xff;
@@ -249,9 +257,14 @@ add_set_src_ipv4(struct rte_flow_action *actions,
 	__rte_unused struct additional_para para)
 {
 	static struct rte_flow_action_set_ipv4 set_ipv4;
+	uint32_t ip = para.counter;
+
+	/* Fixed value */
+	if (FIXED_VALUES)
+		ip = 1;
 
 	/* IPv4 value to be set is random each time */
-	set_ipv4.ipv4_addr = RTE_BE32(para.counter + 1);
+	set_ipv4.ipv4_addr = RTE_BE32(ip + 1);
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC;
 	actions[actions_counter].conf = &set_ipv4;
@@ -263,9 +276,14 @@ add_set_dst_ipv4(struct rte_flow_action *actions,
 	__rte_unused struct additional_para para)
 {
 	static struct rte_flow_action_set_ipv4 set_ipv4;
+	uint32_t ip = para.counter;
+
+	/* Fixed value */
+	if (FIXED_VALUES)
+		ip = 1;
 
 	/* IPv4 value to be set is random each time */
-	set_ipv4.ipv4_addr = RTE_BE32(para.counter + 1);
+	set_ipv4.ipv4_addr = RTE_BE32(ip + 1);
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV4_DST;
 	actions[actions_counter].conf = &set_ipv4;
@@ -280,6 +298,10 @@ add_set_src_ipv6(struct rte_flow_action *actions,
 	uint32_t ipv6 = para.counter;
 	uint8_t i;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		ipv6 = 1;
+
 	/* IPv6 value to set is random each time */
 	for (i = 0; i < 16; i++) {
 		set_ipv6.ipv6_addr[i] = ipv6 & 0xff;
@@ -299,6 +321,10 @@ add_set_dst_ipv6(struct rte_flow_action *actions,
 	uint32_t ipv6 = para.counter;
 	uint8_t i;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		ipv6 = 1;
+
 	/* IPv6 value to set is random each time */
 	for (i = 0; i < 16; i++) {
 		set_ipv6.ipv6_addr[i] = ipv6 & 0xff;
@@ -317,9 +343,12 @@ add_set_src_tp(struct rte_flow_action *actions,
 	static struct rte_flow_action_set_tp set_tp;
 	uint32_t tp = para.counter;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		tp = 100;
+
 	/* TP src port is random each time */
-	if (tp > 0xffff)
-		tp = tp >> 16;
+	tp = tp % 0xffff;
 
 	set_tp.port = RTE_BE16(tp & 0xffff);
 
@@ -335,6 +364,10 @@ add_set_dst_tp(struct rte_flow_action *actions,
 	static struct rte_flow_action_set_tp set_tp;
 	uint32_t tp = para.counter;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		tp = 100;
+
 	/* TP src port is random each time */
 	if (tp > 0xffff)
 		tp = tp >> 16;
@@ -350,7 +383,14 @@ add_inc_tcp_ack(struct rte_flow_action *actions,
 	uint8_t actions_counter,
 	__rte_unused struct additional_para para)
 {
-	static rte_be32_t value = RTE_BE32(1);
+	static rte_be32_t value;
+	uint32_t ack_value = para.counter;
+
+	/* Fixed value */
+	if (FIXED_VALUES)
+		ack_value = 1;
+
+	value = RTE_BE32(ack_value);
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_INC_TCP_ACK;
 	actions[actions_counter].conf = &value;
@@ -361,7 +401,14 @@ add_dec_tcp_ack(struct rte_flow_action *actions,
 	uint8_t actions_counter,
 	__rte_unused struct additional_para para)
 {
-	static rte_be32_t value = RTE_BE32(1);
+	static rte_be32_t value;
+	uint32_t ack_value = para.counter;
+
+	/* Fixed value */
+	if (FIXED_VALUES)
+		ack_value = 1;
+
+	value = RTE_BE32(ack_value);
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK;
 	actions[actions_counter].conf = &value;
@@ -372,7 +419,14 @@ add_inc_tcp_seq(struct rte_flow_action *actions,
 	uint8_t actions_counter,
 	__rte_unused struct additional_para para)
 {
-	static rte_be32_t value = RTE_BE32(1);
+	static rte_be32_t value;
+	uint32_t seq_value = para.counter;
+
+	/* Fixed value */
+	if (FIXED_VALUES)
+		seq_value = 1;
+
+	value = RTE_BE32(seq_value);
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ;
 	actions[actions_counter].conf = &value;
@@ -383,7 +437,14 @@ add_dec_tcp_seq(struct rte_flow_action *actions,
 	uint8_t actions_counter,
 	__rte_unused struct additional_para para)
 {
-	static rte_be32_t value = RTE_BE32(1);
+	static rte_be32_t value;
+	uint32_t seq_value = para.counter;
+
+	/* Fixed value */
+	if (FIXED_VALUES)
+		seq_value = 1;
+
+	value	= RTE_BE32(seq_value);
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ;
 	actions[actions_counter].conf = &value;
@@ -397,9 +458,12 @@ add_set_ttl(struct rte_flow_action *actions,
 	static struct rte_flow_action_set_ttl set_ttl;
 	uint32_t ttl_value = para.counter;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		ttl_value = 1;
+
 	/* Set ttl to random value each time */
-	while (ttl_value > 0xff)
-		ttl_value = ttl_value >> 8;
+	ttl_value = ttl_value % 0xff;
 
 	set_ttl.ttl_value = ttl_value;
 
@@ -423,9 +487,12 @@ add_set_ipv4_dscp(struct rte_flow_action *actions,
 	static struct rte_flow_action_set_dscp set_dscp;
 	uint32_t dscp_value = para.counter;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		dscp_value = 1;
+
 	/* Set dscp to random value each time */
-	while (dscp_value > 0xff)
-		dscp_value = dscp_value >> 8;
+	dscp_value = dscp_value % 0xff;
 
 	set_dscp.dscp = dscp_value;
 
@@ -441,9 +508,12 @@ add_set_ipv6_dscp(struct rte_flow_action *actions,
 	static struct rte_flow_action_set_dscp set_dscp;
 	uint32_t dscp_value = para.counter;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		dscp_value = 1;
+
 	/* Set dscp to random value each time */
-	while (dscp_value > 0xff)
-		dscp_value = dscp_value >> 8;
+	dscp_value = dscp_value % 0xff;
 
 	set_dscp.dscp = dscp_value;
 
@@ -507,13 +577,18 @@ add_ipv4_header(uint8_t **header, uint64_t data,
 	struct additional_para para)
 {
 	struct rte_flow_item_ipv4 ipv4_item;
+	uint32_t ip_dst = para.counter;
 
 	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4)))
 		return;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		ip_dst = 1;
+
 	memset(&ipv4_item, 0, sizeof(struct rte_flow_item_ipv4));
 	ipv4_item.hdr.src_addr = RTE_IPV4(127, 0, 0, 1);
-	ipv4_item.hdr.dst_addr = RTE_BE32(para.counter);
+	ipv4_item.hdr.dst_addr = RTE_BE32(ip_dst);
 	ipv4_item.hdr.version_ihl = RTE_IPV4_VHL_DEF;
 	if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP))
 		ipv4_item.hdr.next_proto_id = RTE_IP_TYPE_UDP;
@@ -574,6 +649,10 @@ add_vxlan_header(uint8_t **header, uint64_t data,
 	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN)))
 		return;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		vni_value = 1;
+
 	memset(&vxlan_item, 0, sizeof(struct rte_flow_item_vxlan));
 
 	for (i = 0; i < 3; i++)
@@ -595,6 +674,10 @@ add_vxlan_gpe_header(uint8_t **header, uint64_t data,
 	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE)))
 		return;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		vni_value = 1;
+
 	memset(&vxlan_gpe_item, 0, sizeof(struct rte_flow_item_vxlan_gpe));
 
 	for (i = 0; i < 3; i++)
@@ -633,6 +716,10 @@ add_geneve_header(uint8_t **header, uint64_t data,
 	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE)))
 		return;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		vni_value = 1;
+
 	memset(&geneve_item, 0, sizeof(struct rte_flow_item_geneve));
 
 	for (i = 0; i < 3; i++)
@@ -647,13 +734,18 @@ add_gtp_header(uint8_t **header, uint64_t data,
 	struct additional_para para)
 {
 	struct rte_flow_item_gtp gtp_item;
+	uint32_t teid_value = para.counter;
 
 	if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP)))
 		return;
 
+	/* Fixed value */
+	if (FIXED_VALUES)
+		teid_value = 1;
+
 	memset(&gtp_item, 0, sizeof(struct rte_flow_item_gtp));
 
-	gtp_item.teid = RTE_BE32(para.counter);
+	gtp_item.teid = RTE_BE32(teid_value);
 	gtp_item.msg_type = 255;
 
 	memcpy(*header, &gtp_item, sizeof(gtp_item));
@@ -764,13 +856,18 @@ add_vxlan_encap(struct rte_flow_action *actions,
 	static struct rte_flow_item_ipv4 item_ipv4;
 	static struct rte_flow_item_udp item_udp;
 	static struct rte_flow_item_vxlan item_vxlan;
+	uint32_t ip_dst = para.counter;
+
+	/* Fixed value */
+	if (FIXED_VALUES)
+		ip_dst = 1;
 
 	items[0].spec = &item_eth;
 	items[0].mask = &item_eth;
 	items[0].type = RTE_FLOW_ITEM_TYPE_ETH;
 
 	item_ipv4.hdr.src_addr = RTE_IPV4(127, 0, 0, 1);
-	item_ipv4.hdr.dst_addr = RTE_IPV4(255, 255, 255, 255);
+	item_ipv4.hdr.dst_addr = RTE_BE32(ip_dst);
 	item_ipv4.hdr.version_ihl = RTE_IPV4_VHL_DEF;
 	items[1].spec = &item_ipv4;
 	items[1].mask = &item_ipv4;
diff --git a/app/test-flow-perf/config.h b/app/test-flow-perf/config.h
index ee1a4a3724..8f42bc589c 100644
--- a/app/test-flow-perf/config.h
+++ b/app/test-flow-perf/config.h
@@ -16,6 +16,12 @@
 #define NR_RXD  256
 #define NR_TXD  256
 
+/* This is used for encap/decap & header modify actions.
+ * When it's 1: it means all actions have fixed values.
+ * When it's 0: it means all actions will have different values.
+ */
+#define FIXED_VALUES 1
+
 /* Items/Actions parameters */
 #define JUMP_ACTION_TABLE 2
 #define VLAN_VALUE 1
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (12 preceding siblings ...)
  2020-08-30 11:15 ` [dpdk-dev] [PATCH 13/13] app/flow-perf: allow fixed values for actions Wisam Jaddo
@ 2020-09-14 18:15 ` Ferruh Yigit
  2020-09-21 21:36 ` Thomas Monjalon
  14 siblings, 0 replies; 16+ messages in thread
From: Ferruh Yigit @ 2020-09-14 18:15 UTC (permalink / raw)
  To: Wisam Jaddo, dev, thomas, asafp, akozyrev, akozyrev, arybchenko, jackmin

On 8/30/2020 12:15 PM, Wisam Jaddo wrote:
> * Some fixes.
> * Add headers modify actions support.
> * Add flag action support.
> * Add raw-encap & raw-decap actions support.
> * Add VXLAN encap & VXLAN decap actions support.
> * Add set portmask option.
> * Add icmp and icmp6 matching items support.
> * Allow installing rte flows with different modify
> headers values and different encap data for each
> rte flow.
> 
> Wisam Jaddo (13):
>   app/flow-perf: fix actions mask macro usage
>   doc/flow-perf: fix app sections
>   app/flow-perf: start supporting user order
>   app/flow-perf: add header modify actions support
>   app/flow-perf: add flag action support
>   app/flow-perf: fix memory leak from RSS action
>   app/flow-perf: add raw encap/decap actions support
>   app/flow-perf: add VXLAN encap/decap actions support
>   app/flow-perf: fix source ipv4 matching
>   app/flow-perf: add random mark id values
>   app/flow-perf: add set port mask to options
>   app/flow-perf: add icmp matching support
>   app/flow-perf: allow fixed values for actions
> 

Series applied to dpdk-next-net/main, thanks.


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

* Re: [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions
  2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
                   ` (13 preceding siblings ...)
  2020-09-14 18:15 ` [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Ferruh Yigit
@ 2020-09-21 21:36 ` Thomas Monjalon
  14 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2020-09-21 21:36 UTC (permalink / raw)
  To: Wisam Jaddo, ferruh.yigit
  Cc: dev, asafp, akozyrev, akozyrev, arybchenko, jackmin

30/08/2020 13:15, Wisam Jaddo:
>  doc/guides/rel_notes/release_20_08.rst |  17 +

It is the wrong release notes.

Ferruh, I will fix while pulling next-net.



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

end of thread, other threads:[~2020-09-21 21:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 01/13] app/flow-perf: fix actions mask macro usage Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 02/13] doc/flow-perf: fix app sections Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 03/13] app/flow-perf: start supporting user order Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 04/13] app/flow-perf: add header modify actions support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 05/13] app/flow-perf: add flag action support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 06/13] app/flow-perf: fix memory leak from RSS action Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 07/13] app/flow-perf: add raw encap/decap actions support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 08/13] app/flow-perf: add VXLAN " Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 09/13] app/flow-perf: fix source ipv4 matching Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 10/13] app/flow-perf: add random mark id values Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 11/13] app/flow-perf: add set port mask to options Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 12/13] app/flow-perf: add icmp matching support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 13/13] app/flow-perf: allow fixed values for actions Wisam Jaddo
2020-09-14 18:15 ` [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Ferruh Yigit
2020-09-21 21:36 ` 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).