The per-lcore PRNG was not initializing the rand_state of all the lcores. Any usage of rte_random by a non-EAL lcore would use rand_states[RTE_MAX_LCORE] which was never initialized.
Fix by using RTE_DIM() which will get all lcores. Fixes: 3f002f069612 ("eal: replace libc-based random generation with LFSR") Cc: mattias.ronnb...@ericsson.com Acked-by: Morten Brørup <m...@smartsharesystems.com> Signed-off-by: Stephen Hemminger <step...@networkplumber.org> --- lib/eal/common/rte_random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/common/rte_random.c b/lib/eal/common/rte_random.c index 53636331a27b..812e5b4757b5 100644 --- a/lib/eal/common/rte_random.c +++ b/lib/eal/common/rte_random.c @@ -84,7 +84,7 @@ rte_srand(uint64_t seed) unsigned int lcore_id; /* add lcore_id to seed to avoid having the same sequence */ - for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) + for (lcore_id = 0; lcore_id < RTE_DIM(rand_states); lcore_id++) __rte_srand_lfsr258(seed + lcore_id, &rand_states[lcore_id]); } -- 2.39.2