Test lpm6_perf_autotest was hitting a stack overflow on Windows
with both MSVC and Clang.

The fix is to move some of the data from the stack to the heap.

Signed-off-by: Andre Muezerie <andre...@linux.microsoft.com>
---
 app/test/test_lpm6_perf.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c
index 1860a99ed6..a09e8611ce 100644
--- a/app/test/test_lpm6_perf.c
+++ b/app/test/test_lpm6_perf.c
@@ -10,6 +10,7 @@
 
 #include <rte_cycles.h>
 #include <rte_random.h>
+#include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_lpm6.h>
 
@@ -117,8 +118,14 @@ test_lpm6_perf(void)
        total_time = 0;
        count = 0;
 
-       struct rte_ipv6_addr ip_batch[NUM_IPS_ENTRIES];
-       int32_t next_hops[NUM_IPS_ENTRIES];
+       struct rte_ipv6_addr *ip_batch =
+                       (struct rte_ipv6_addr *)rte_malloc("ip_batch",
+                       sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES, 0);
+       TEST_LPM_ASSERT(ip_batch != NULL);
+
+       int32_t *next_hops = (int32_t *)rte_malloc("next_hops",
+                       sizeof(int32_t) * NUM_IPS_ENTRIES, 0);
+       TEST_LPM_ASSERT(next_hops != NULL);
 
        for (i = 0; i < NUM_IPS_ENTRIES; i++)
                ip_batch[i] = large_ips_table[i].ip;
@@ -153,6 +160,9 @@ test_lpm6_perf(void)
        printf("Average LPM Delete: %g cycles\n",
                        (double)total_time / NUM_ROUTE_ENTRIES);
 
+       rte_free(next_hops);
+       rte_free(ip_batch);
+
        rte_lpm6_delete_all(lpm);
        rte_lpm6_free(lpm);
 
-- 
2.47.0.vfs.0.3

Reply via email to