[5/5] app/flow-perf: fix the incremental IPv6 src set

Message ID 20210307091202.586-6-wisamm@nvidia.com (mailing list archive)
State New, archived
Delegated to: Thomas Monjalon
Headers
Series New flow-perf fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success travis build: passed
ci/github-robot success github build: passed

Commit Message

Wisam Monther March 7, 2021, 9:12 a.m. UTC
  Currently the memset() will not set a correct src ip that represent
the incremental value of the counter.

This commit will fix this and each flow will have correct IPv6.src
that it's incremental from previous flow and equal to the decimal
values.

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

Signed-off-by: Wisam Jaddo <wisamm@nvidia.com>
---
 app/test-flow-perf/items_gen.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
  

Patch

diff --git a/app/test-flow-perf/items_gen.c b/app/test-flow-perf/items_gen.c
index ccebc08b39..a73de9031f 100644
--- a/app/test-flow-perf/items_gen.c
+++ b/app/test-flow-perf/items_gen.c
@@ -72,14 +72,15 @@  add_ipv6(struct rte_flow_item *items,
 	static struct rte_flow_item_ipv6 ipv6_specs[RTE_MAX_LCORE] __rte_cache_aligned;
 	static struct rte_flow_item_ipv6 ipv6_masks[RTE_MAX_LCORE] __rte_cache_aligned;
 	uint8_t ti = para.core_idx;
+	uint8_t i;
 
 	/** Set ipv6 src **/
-	memset(&ipv6_specs[ti].hdr.src_addr, para.src_ip,
-		sizeof(ipv6_specs->hdr.src_addr) / 2);
-
-	/** Full mask **/
-	memset(&ipv6_masks[ti].hdr.src_addr, 0xff,
-		sizeof(ipv6_specs->hdr.src_addr));
+	for (i = 0; i < 16; i++) {
+		/* Currently src_ip is limited to 32 bit */
+		if (i < 4)
+			ipv6_specs[ti].hdr.src_addr[15 - i] = para.src_ip >> (i * 8);
+		ipv6_masks[ti].hdr.src_addr[15 - i] = 0xff;
+	}
 
 	items[items_counter].type = RTE_FLOW_ITEM_TYPE_IPV6;
 	items[items_counter].spec = &ipv6_specs[ti];