eal: fix lcore accessors for non-EAL threads
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 8 Apr 2020 20:24:19 +0000 (13:24 -0700)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 7 Jul 2020 11:45:50 +0000 (13:45 +0200)
commit67ae5936c4fc36863d146acbddfe107e1ad00a13
tree98995a8de030b219f5c6eeafe86daf182e5a6350
parente1c9850f5568abfa2b9143e6ae0e2a1b7bb16d52
eal: fix lcore accessors for non-EAL threads

If rte_lcore_index() is asked to give the index of the
current lcore (argument -1) and is called from a non-EAL thread
then it would invalid result. The result would come
lcore_config[-1].core_index which is some other data in the
per-thread area.

The resolution is to return -1 which is what rte_lcore_index()
returns if handed an invalid lcore.

Same issue existed with rte_lcore_to_cpu_id().

Bugzilla ID: 446
Fixes: 26cc3bbe4dc0 ("eal: add lcore accessors")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Marchand <david.marchand@redhat.com>
lib/librte_eal/common/eal_common_lcore.c