[v8,1/7] test/ring: fix failure with custom number of lcores
Checks
Commit Message
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@dpdk.org
Reported-by: Phanendra Vukkisala <pvukkisala@marvell.com>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/test_ring_stress_impl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -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) {