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: sta...@dpdk.org Reported-by: Phanendra Vukkisala <pvukkis...@marvell.com> Signed-off-by: Konstantin Ananyev <konstantin.anan...@huawei.com> Acked-by: Morten Brørup <m...@smartsharesystems.com> Acked-by: Stephen Hemminger <step...@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