Code Review
/
deb_dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Imported Upstream version 17.05
[deb_dpdk.git]
/
lib
/
librte_eal
/
bsdapp
/
eal
/
eal_lcore.c
diff --git
a/lib/librte_eal/bsdapp/eal/eal_lcore.c
b/lib/librte_eal/bsdapp/eal/eal_lcore.c
index
b8bfafd
..
bc584dd
100644
(file)
--- a/
lib/librte_eal/bsdapp/eal/eal_lcore.c
+++ b/
lib/librte_eal/bsdapp/eal/eal_lcore.c
@@
-53,12
+53,14
@@
eal_cpu_core_id(__rte_unused unsigned lcore_id)
static int
eal_get_ncpus(void)
{
static int
eal_get_ncpus(void)
{
+ static int ncpu = -1;
int mib[2] = {CTL_HW, HW_NCPU};
int mib[2] = {CTL_HW, HW_NCPU};
- int ncpu;
size_t len = sizeof(ncpu);
size_t len = sizeof(ncpu);
- sysctl(mib, 2, &ncpu, &len, NULL, 0);
- RTE_LOG(INFO, EAL, "Sysctl reports %d cpus\n", ncpu);
+ if (ncpu < 0) {
+ sysctl(mib, 2, &ncpu, &len, NULL, 0);
+ RTE_LOG(INFO, EAL, "Sysctl reports %d cpus\n", ncpu);
+ }
return ncpu;
}
return ncpu;
}