[dpdk-stable] patch 'app/flow-perf: simplify objects initialization' has been queued to stable release 20.11.1

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 5 12:14:56 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/07/21. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/1d2f869e7c690437489ff76e2fa08e26e14439c0

Thanks.

Luca Boccassi

---
>From 1d2f869e7c690437489ff76e2fa08e26e14439c0 Mon Sep 17 00:00:00 2001
From: Wisam Jaddo <wisamm at nvidia.com>
Date: Thu, 26 Nov 2020 13:15:43 +0200
Subject: [PATCH] app/flow-perf: simplify objects initialization

[ upstream commit 97544f85bd269d4be9e6e9b022a3682e1eb61a7b ]

Since items are static then the default values will be zero,
thus the memset to zero value is just a redundant code.

Also remove the all not needed variables, that can be replaced
with direct set to the structure itself.

Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation")

Signed-off-by: Wisam Jaddo <wisamm at nvidia.com>
Reviewed-by: Alexander Kozyrev <akozyrev at nvidia.com>
Reviewed-by: Suanming Mou <suanmingm at nvidia.com>
---
 app/test-flow-perf/actions_gen.c |  30 +++-----
 app/test-flow-perf/items_gen.c   | 123 ++++++++-----------------------
 2 files changed, 44 insertions(+), 109 deletions(-)

diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index ac525f6fdb..f265894247 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -145,12 +145,10 @@ add_set_meta(struct rte_flow_action *actions,
 	uint8_t actions_counter,
 	__rte_unused struct additional_para para)
 {
-	static struct rte_flow_action_set_meta meta_action;
-
-	do {
-		meta_action.data = RTE_BE32(META_DATA);
-		meta_action.mask = RTE_BE32(0xffffffff);
-	} while (0);
+	static struct rte_flow_action_set_meta meta_action = {
+		.data = RTE_BE32(META_DATA),
+		.mask = RTE_BE32(0xffffffff),
+	};
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_META;
 	actions[actions_counter].conf = &meta_action;
@@ -161,13 +159,11 @@ add_set_tag(struct rte_flow_action *actions,
 	uint8_t actions_counter,
 	__rte_unused struct additional_para para)
 {
-	static struct rte_flow_action_set_tag tag_action;
-
-	do {
-		tag_action.data = RTE_BE32(META_DATA);
-		tag_action.mask = RTE_BE32(0xffffffff);
-		tag_action.index = TAG_INDEX;
-	} while (0);
+	static struct rte_flow_action_set_tag tag_action = {
+		.data = RTE_BE32(META_DATA),
+		.mask = RTE_BE32(0xffffffff),
+		.index = TAG_INDEX,
+	};
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_TAG;
 	actions[actions_counter].conf = &tag_action;
@@ -178,11 +174,9 @@ add_port_id(struct rte_flow_action *actions,
 	uint8_t actions_counter,
 	__rte_unused struct additional_para para)
 {
-	static struct rte_flow_action_port_id port_id;
-
-	do {
-		port_id.id = PORT_ID_DST;
-	} while (0);
+	static struct rte_flow_action_port_id port_id = {
+		.id = PORT_ID_DST,
+	};
 
 	actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID;
 	actions[actions_counter].conf = &port_id;
diff --git a/app/test-flow-perf/items_gen.c b/app/test-flow-perf/items_gen.c
index 2b1ab41467..aaa243a7c4 100644
--- a/app/test-flow-perf/items_gen.c
+++ b/app/test-flow-perf/items_gen.c
@@ -25,9 +25,6 @@ add_ether(struct rte_flow_item *items,
 	static struct rte_flow_item_eth eth_spec;
 	static struct rte_flow_item_eth eth_mask;
 
-	memset(&eth_spec, 0, sizeof(struct rte_flow_item_eth));
-	memset(&eth_mask, 0, sizeof(struct rte_flow_item_eth));
-
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_ETH;
 	items[items_counter].spec = &eth_spec;
 	items[items_counter].mask = &eth_mask;
@@ -38,16 +35,12 @@ add_vlan(struct rte_flow_item *items,
 	uint8_t items_counter,
 	__rte_unused struct additional_para para)
 {
-	static struct rte_flow_item_vlan vlan_spec;
-	static struct rte_flow_item_vlan vlan_mask;
-
-	uint16_t vlan_value = VLAN_VALUE;
-
-	memset(&vlan_spec, 0, sizeof(struct rte_flow_item_vlan));
-	memset(&vlan_mask, 0, sizeof(struct rte_flow_item_vlan));
-
-	vlan_spec.tci = RTE_BE16(vlan_value);
-	vlan_mask.tci = RTE_BE16(0xffff);
+	static struct rte_flow_item_vlan vlan_spec = {
+		.tci = RTE_BE16(VLAN_VALUE),
+	};
+	static struct rte_flow_item_vlan vlan_mask = {
+		.tci = RTE_BE16(0xffff),
+	};
 
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_VLAN;
 	items[items_counter].spec = &vlan_spec;
@@ -61,9 +54,6 @@ add_ipv4(struct rte_flow_item *items,
 	static struct rte_flow_item_ipv4 ipv4_spec;
 	static struct rte_flow_item_ipv4 ipv4_mask;
 
-	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 = RTE_BE32(para.src_ip);
 	ipv4_mask.hdr.src_addr = RTE_BE32(0xffffffff);
 
@@ -80,9 +70,6 @@ add_ipv6(struct rte_flow_item *items,
 	static struct rte_flow_item_ipv6 ipv6_spec;
 	static struct rte_flow_item_ipv6 ipv6_mask;
 
-	memset(&ipv6_spec, 0, sizeof(struct rte_flow_item_ipv6));
-	memset(&ipv6_mask, 0, sizeof(struct rte_flow_item_ipv6));
-
 	/** Set ipv6 src **/
 	memset(&ipv6_spec.hdr.src_addr, para.src_ip,
 		sizeof(ipv6_spec.hdr.src_addr) / 2);
@@ -104,9 +91,6 @@ add_tcp(struct rte_flow_item *items,
 	static struct rte_flow_item_tcp tcp_spec;
 	static struct rte_flow_item_tcp tcp_mask;
 
-	memset(&tcp_spec, 0, sizeof(struct rte_flow_item_tcp));
-	memset(&tcp_mask, 0, sizeof(struct rte_flow_item_tcp));
-
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_TCP;
 	items[items_counter].spec = &tcp_spec;
 	items[items_counter].mask = &tcp_mask;
@@ -120,9 +104,6 @@ add_udp(struct rte_flow_item *items,
 	static struct rte_flow_item_udp udp_spec;
 	static struct rte_flow_item_udp udp_mask;
 
-	memset(&udp_spec, 0, sizeof(struct rte_flow_item_udp));
-	memset(&udp_mask, 0, sizeof(struct rte_flow_item_udp));
-
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_UDP;
 	items[items_counter].spec = &udp_spec;
 	items[items_counter].mask = &udp_mask;
@@ -141,9 +122,6 @@ add_vxlan(struct rte_flow_item *items,
 
 	vni_value = VNI_VALUE;
 
-	memset(&vxlan_spec, 0, sizeof(struct rte_flow_item_vxlan));
-	memset(&vxlan_mask, 0, sizeof(struct rte_flow_item_vxlan));
-
 	/* Set standard vxlan vni */
 	for (i = 0; i < 3; i++) {
 		vxlan_spec.vni[2 - i] = vni_value >> (i * 8);
@@ -171,9 +149,6 @@ add_vxlan_gpe(struct rte_flow_item *items,
 
 	vni_value = VNI_VALUE;
 
-	memset(&vxlan_gpe_spec, 0, sizeof(struct rte_flow_item_vxlan_gpe));
-	memset(&vxlan_gpe_mask, 0, sizeof(struct rte_flow_item_vxlan_gpe));
-
 	/* Set vxlan-gpe vni */
 	for (i = 0; i < 3; i++) {
 		vxlan_gpe_spec.vni[2 - i] = vni_value >> (i * 8);
@@ -193,18 +168,12 @@ add_gre(struct rte_flow_item *items,
 	uint8_t items_counter,
 	__rte_unused struct additional_para para)
 {
-	static struct rte_flow_item_gre gre_spec;
-	static struct rte_flow_item_gre gre_mask;
-
-	uint16_t proto;
-
-	proto = RTE_ETHER_TYPE_TEB;
-
-	memset(&gre_spec, 0, sizeof(struct rte_flow_item_gre));
-	memset(&gre_mask, 0, sizeof(struct rte_flow_item_gre));
-
-	gre_spec.protocol = RTE_BE16(proto);
-	gre_mask.protocol = RTE_BE16(0xffff);
+	static struct rte_flow_item_gre gre_spec = {
+		.protocol = RTE_BE16(RTE_ETHER_TYPE_TEB),
+	};
+	static struct rte_flow_item_gre gre_mask = {
+		.protocol = RTE_BE16(0xffff),
+	};
 
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_GRE;
 	items[items_counter].spec = &gre_spec;
@@ -224,9 +193,6 @@ add_geneve(struct rte_flow_item *items,
 
 	vni_value = VNI_VALUE;
 
-	memset(&geneve_spec, 0, sizeof(struct rte_flow_item_geneve));
-	memset(&geneve_mask, 0, sizeof(struct rte_flow_item_geneve));
-
 	for (i = 0; i < 3; i++) {
 		geneve_spec.vni[2 - i] = vni_value >> (i * 8);
 		geneve_mask.vni[2 - i] = 0xff;
@@ -242,18 +208,12 @@ add_gtp(struct rte_flow_item *items,
 	uint8_t items_counter,
 	__rte_unused struct additional_para para)
 {
-	static struct rte_flow_item_gtp gtp_spec;
-	static struct rte_flow_item_gtp gtp_mask;
-
-	uint32_t teid_value;
-
-	teid_value = TEID_VALUE;
-
-	memset(&gtp_spec, 0, sizeof(struct rte_flow_item_gtp));
-	memset(&gtp_mask, 0, sizeof(struct rte_flow_item_gtp));
-
-	gtp_spec.teid = RTE_BE32(teid_value);
-	gtp_mask.teid = RTE_BE32(0xffffffff);
+	static struct rte_flow_item_gtp gtp_spec = {
+		.teid = RTE_BE32(TEID_VALUE),
+	};
+	static struct rte_flow_item_gtp gtp_mask = {
+		.teid = RTE_BE32(0xffffffff),
+	};
 
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_GTP;
 	items[items_counter].spec = &gtp_spec;
@@ -265,18 +225,12 @@ add_meta_data(struct rte_flow_item *items,
 	uint8_t items_counter,
 	__rte_unused struct additional_para para)
 {
-	static struct rte_flow_item_meta meta_spec;
-	static struct rte_flow_item_meta meta_mask;
-
-	uint32_t data;
-
-	data = META_DATA;
-
-	memset(&meta_spec, 0, sizeof(struct rte_flow_item_meta));
-	memset(&meta_mask, 0, sizeof(struct rte_flow_item_meta));
-
-	meta_spec.data = RTE_BE32(data);
-	meta_mask.data = RTE_BE32(0xffffffff);
+	static struct rte_flow_item_meta meta_spec = {
+		.data = RTE_BE32(META_DATA),
+	};
+	static struct rte_flow_item_meta meta_mask = {
+		.data = RTE_BE32(0xffffffff),
+	};
 
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_META;
 	items[items_counter].spec = &meta_spec;
@@ -289,21 +243,14 @@ add_meta_tag(struct rte_flow_item *items,
 	uint8_t items_counter,
 	__rte_unused struct additional_para para)
 {
-	static struct rte_flow_item_tag tag_spec;
-	static struct rte_flow_item_tag tag_mask;
-	uint32_t data;
-	uint8_t index;
-
-	data = META_DATA;
-	index = TAG_INDEX;
-
-	memset(&tag_spec, 0, sizeof(struct rte_flow_item_tag));
-	memset(&tag_mask, 0, sizeof(struct rte_flow_item_tag));
-
-	tag_spec.data = RTE_BE32(data);
-	tag_mask.data = RTE_BE32(0xffffffff);
-	tag_spec.index = index;
-	tag_mask.index = 0xff;
+	static struct rte_flow_item_tag tag_spec = {
+		.data = RTE_BE32(META_DATA),
+		.index = TAG_INDEX,
+	};
+	static struct rte_flow_item_tag tag_mask = {
+		.data = RTE_BE32(0xffffffff),
+		.index = 0xff,
+	};
 
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_TAG;
 	items[items_counter].spec = &tag_spec;
@@ -318,9 +265,6 @@ add_icmpv4(struct rte_flow_item *items,
 	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;
@@ -334,9 +278,6 @@ add_icmpv6(struct rte_flow_item *items,
 	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;
-- 
2.29.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-02-05 11:18:29.781714435 +0000
+++ 0010-app-flow-perf-simplify-objects-initialization.patch	2021-02-05 11:18:28.590687000 +0000
@@ -1 +1 @@
-From 97544f85bd269d4be9e6e9b022a3682e1eb61a7b Mon Sep 17 00:00:00 2001
+From 1d2f869e7c690437489ff76e2fa08e26e14439c0 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 97544f85bd269d4be9e6e9b022a3682e1eb61a7b ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index 1364407056..c3545ba32f 100644
+index ac525f6fdb..f265894247 100644
@@ -27 +28 @@
-@@ -143,12 +143,10 @@ add_set_meta(struct rte_flow_action *actions,
+@@ -145,12 +145,10 @@ add_set_meta(struct rte_flow_action *actions,
@@ -44 +45 @@
-@@ -159,13 +157,11 @@ add_set_tag(struct rte_flow_action *actions,
+@@ -161,13 +159,11 @@ add_set_tag(struct rte_flow_action *actions,
@@ -63 +64 @@
-@@ -176,11 +172,9 @@ add_port_id(struct rte_flow_action *actions,
+@@ -178,11 +174,9 @@ add_port_id(struct rte_flow_action *actions,
@@ -79 +80 @@
-index 0950023608..ccebc08b39 100644
+index 2b1ab41467..aaa243a7c4 100644
@@ -82 +83 @@
-@@ -26,9 +26,6 @@ add_ether(struct rte_flow_item *items,
+@@ -25,9 +25,6 @@ add_ether(struct rte_flow_item *items,
@@ -92 +93 @@
-@@ -39,16 +36,12 @@ add_vlan(struct rte_flow_item *items,
+@@ -38,16 +35,12 @@ add_vlan(struct rte_flow_item *items,
@@ -115,13 +116,13 @@
-@@ -63,9 +56,6 @@ add_ipv4(struct rte_flow_item *items,
- 	static struct rte_flow_item_ipv4 ipv4_masks[RTE_MAX_LCORE] __rte_cache_aligned;
- 	uint8_t ti = para.core_idx;
- 
--	memset(&ipv4_specs[ti], 0, sizeof(struct rte_flow_item_ipv4));
--	memset(&ipv4_masks[ti], 0, sizeof(struct rte_flow_item_ipv4));
--
- 	ipv4_specs[ti].hdr.src_addr = RTE_BE32(para.src_ip);
- 	ipv4_masks[ti].hdr.src_addr = RTE_BE32(0xffffffff);
- 
-@@ -83,9 +73,6 @@ add_ipv6(struct rte_flow_item *items,
- 	static struct rte_flow_item_ipv6 ipv6_masks[RTE_MAX_LCORE] __rte_cache_aligned;
- 	uint8_t ti = para.core_idx;
+@@ -61,9 +54,6 @@ add_ipv4(struct rte_flow_item *items,
+ 	static struct rte_flow_item_ipv4 ipv4_spec;
+ 	static struct rte_flow_item_ipv4 ipv4_mask;
+ 
+-	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 = RTE_BE32(para.src_ip);
+ 	ipv4_mask.hdr.src_addr = RTE_BE32(0xffffffff);
+ 
+@@ -80,9 +70,6 @@ add_ipv6(struct rte_flow_item *items,
+ 	static struct rte_flow_item_ipv6 ipv6_spec;
+ 	static struct rte_flow_item_ipv6 ipv6_mask;
@@ -129,2 +130,2 @@
--	memset(&ipv6_specs[ti], 0, sizeof(struct rte_flow_item_ipv6));
--	memset(&ipv6_masks[ti], 0, sizeof(struct rte_flow_item_ipv6));
+-	memset(&ipv6_spec, 0, sizeof(struct rte_flow_item_ipv6));
+-	memset(&ipv6_mask, 0, sizeof(struct rte_flow_item_ipv6));
@@ -133,3 +134,3 @@
- 	memset(&ipv6_specs[ti].hdr.src_addr, para.src_ip,
- 		sizeof(ipv6_specs->hdr.src_addr) / 2);
-@@ -107,9 +94,6 @@ add_tcp(struct rte_flow_item *items,
+ 	memset(&ipv6_spec.hdr.src_addr, para.src_ip,
+ 		sizeof(ipv6_spec.hdr.src_addr) / 2);
+@@ -104,9 +91,6 @@ add_tcp(struct rte_flow_item *items,
@@ -145 +146 @@
-@@ -123,9 +107,6 @@ add_udp(struct rte_flow_item *items,
+@@ -120,9 +104,6 @@ add_udp(struct rte_flow_item *items,
@@ -155 +156 @@
-@@ -144,9 +125,6 @@ add_vxlan(struct rte_flow_item *items,
+@@ -141,9 +122,6 @@ add_vxlan(struct rte_flow_item *items,
@@ -159,2 +160,2 @@
--	memset(&vxlan_specs[ti], 0, sizeof(struct rte_flow_item_vxlan));
--	memset(&vxlan_masks[ti], 0, sizeof(struct rte_flow_item_vxlan));
+-	memset(&vxlan_spec, 0, sizeof(struct rte_flow_item_vxlan));
+-	memset(&vxlan_mask, 0, sizeof(struct rte_flow_item_vxlan));
@@ -164,2 +165,2 @@
- 		vxlan_specs[ti].vni[2 - i] = vni_value >> (i * 8);
-@@ -174,9 +152,6 @@ add_vxlan_gpe(struct rte_flow_item *items,
+ 		vxlan_spec.vni[2 - i] = vni_value >> (i * 8);
+@@ -171,9 +149,6 @@ add_vxlan_gpe(struct rte_flow_item *items,
@@ -169,2 +170,2 @@
--	memset(&vxlan_gpe_specs[ti], 0, sizeof(struct rte_flow_item_vxlan_gpe));
--	memset(&vxlan_gpe_masks[ti], 0, sizeof(struct rte_flow_item_vxlan_gpe));
+-	memset(&vxlan_gpe_spec, 0, sizeof(struct rte_flow_item_vxlan_gpe));
+-	memset(&vxlan_gpe_mask, 0, sizeof(struct rte_flow_item_vxlan_gpe));
@@ -174,2 +175,2 @@
- 		vxlan_gpe_specs[ti].vni[2 - i] = vni_value >> (i * 8);
-@@ -196,18 +171,12 @@ add_gre(struct rte_flow_item *items,
+ 		vxlan_gpe_spec.vni[2 - i] = vni_value >> (i * 8);
+@@ -193,18 +168,12 @@ add_gre(struct rte_flow_item *items,
@@ -200 +201 @@
-@@ -227,9 +196,6 @@ add_geneve(struct rte_flow_item *items,
+@@ -224,9 +193,6 @@ add_geneve(struct rte_flow_item *items,
@@ -204,2 +205,2 @@
--	memset(&geneve_specs[ti], 0, sizeof(struct rte_flow_item_geneve));
--	memset(&geneve_masks[ti], 0, sizeof(struct rte_flow_item_geneve));
+-	memset(&geneve_spec, 0, sizeof(struct rte_flow_item_geneve));
+-	memset(&geneve_mask, 0, sizeof(struct rte_flow_item_geneve));
@@ -208,3 +209,3 @@
- 		geneve_specs[ti].vni[2 - i] = vni_value >> (i * 8);
- 		geneve_masks[ti].vni[2 - i] = 0xff;
-@@ -245,18 +211,12 @@ add_gtp(struct rte_flow_item *items,
+ 		geneve_spec.vni[2 - i] = vni_value >> (i * 8);
+ 		geneve_mask.vni[2 - i] = 0xff;
+@@ -242,18 +208,12 @@ add_gtp(struct rte_flow_item *items,
@@ -235 +236 @@
-@@ -268,18 +228,12 @@ add_meta_data(struct rte_flow_item *items,
+@@ -265,18 +225,12 @@ add_meta_data(struct rte_flow_item *items,
@@ -260 +261 @@
-@@ -292,21 +246,14 @@ add_meta_tag(struct rte_flow_item *items,
+@@ -289,21 +243,14 @@ add_meta_tag(struct rte_flow_item *items,
@@ -290 +291 @@
-@@ -321,9 +268,6 @@ add_icmpv4(struct rte_flow_item *items,
+@@ -318,9 +265,6 @@ add_icmpv4(struct rte_flow_item *items,
@@ -300 +301 @@
-@@ -337,9 +281,6 @@ add_icmpv6(struct rte_flow_item *items,
+@@ -334,9 +278,6 @@ add_icmpv6(struct rte_flow_item *items,


More information about the stable mailing list