[PATCH v11 1/7] test/ring: fix failure with custom number of lcores
Konstantin Ananyev
konstantin.ananyev at huawei.com
Fri Dec 6 19:35:54 CET 2024
ring_stress_autotest fails to initialize the ring when RTE_MAX_LCORE value
is not a number of 2.
There is a flaw in calculation required number of elements in the ring.
Fix it by aligning number of elements to next power of 2.
Fixes: bf28df24e915 ("test/ring: add contention stress test")
Cc: stable at dpdk.org
Reported-by: Phanendra Vukkisala <pvukkisala at marvell.com>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
Acked-by: Morten Brørup <mb at smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
app/test/test_ring_stress_impl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress_impl.h
index 8b0bfb11fe..ee5274aeef 100644
--- a/app/test/test_ring_stress_impl.h
+++ b/app/test/test_ring_stress_impl.h
@@ -297,7 +297,7 @@ mt1_init(struct rte_ring **rng, void **data, uint32_t num)
*data = elm;
/* alloc ring */
- nr = 2 * num;
+ nr = rte_align32pow2(2 * num);
sz = rte_ring_get_memsize(nr);
r = rte_zmalloc(NULL, sz, alignof(typeof(*r)));
if (r == NULL) {
--
2.35.3
More information about the dev
mailing list