eal: fix PRNG init with HPET enabled
authorTonghao Zhang <xiangxia.m.yue@gmail.com>
Wed, 15 Apr 2020 17:41:06 +0000 (01:41 +0800)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 21 Apr 2020 16:13:34 +0000 (18:13 +0200)
commit9b41c276fd35fe3c0ed3fb0d9cf98a83a58b31b2
tree1a65627c2238905aab6dda021cd8c2a504a5bcf3
parent56b27c4b36c676cc42ae1644e7487fbc902bf6a5
eal: fix PRNG init with HPET enabled

When rte_rand_init is invoked, and the kernel running dpdk does not
support *getentropy, at the same time, the cpu does not support rdseed,
then rte_rand_init invoked rte_get_timer_cycles.

If HPET was enabled in the DPDK build (CONFIG_RTE_LIBEAL_USE_HPET=y) and
the system, rte_get_timer_cycles will invoke rte_get_hpet_cycles while
*eal_hpet is not available.

To fix that, use rte_get_tsc_cycles instead of rte_get_timer_cycles.

Fixes: 3f002f069612 ("eal: replace libc-based random generation with LFSR")
Cc: stable@dpdk.org
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
lib/librte_eal/common/rte_random.c