On Tue, 17 Dec 2024 09:59:49 +0100 David Marchand <david.march...@redhat.com> wrote:
> The RNG is documented as being seeded as part of EAL init. > > Move the initialisation (seeding) helper out of a constructor and > call it explicitly from rte_eal_init() as it was done before commit > 3f002f069612 ("eal: replace libc-based random generation with LFSR"). > > This also moves the unconditional lcore variable allocation out of a > constructor. > > While at it, mark local symbol rand_state as static. > > Fixes: 29c39cd3d54d ("random: keep PRNG state in lcore variable") > Cc: sta...@dpdk.org > > Signed-off-by: David Marchand <david.march...@redhat.com> > Reviewed-by: Mattias Rönnblom <mattias.ronnb...@ericsson.com> > Acked-by: Anatoly Burakov <anatoly.bura...@intel.com> Probably need to add a check to rte_random() so it crashes if called before initialization, rather than returning an un-random number which could be a hidden long term bug.