From 0a78fa17cbbeec8137ae823d3c5da8c6bec5ac6e Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sat, 19 Jan 2019 23:45:36 +0100 Subject: Store numa-noda and cpu-index in vlib_main_t Change-Id: If88ccd965122b9318a39a8d71b53334cd1fd81e4 Signed-off-by: Damjan Marion --- src/vppinfra/cpu.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/vppinfra') diff --git a/src/vppinfra/cpu.h b/src/vppinfra/cpu.h index 6dc0a23e467..8341eaf0e54 100644 --- a/src/vppinfra/cpu.h +++ b/src/vppinfra/cpu.h @@ -16,6 +16,7 @@ #ifndef included_clib_cpu_h #define included_clib_cpu_h +#include #include /* @@ -99,6 +100,22 @@ _ (asimddp, 20) \ _ (sha512, 21) \ _ (sve, 22) +static inline u32 +clib_get_current_cpu_index () +{ + unsigned cpu, node; + syscall (__NR_getcpu, &cpu, &node, 0); + return cpu; +} + +static inline u32 +clib_get_current_numa_node () +{ + unsigned cpu, node; + syscall (__NR_getcpu, &cpu, &node, 0); + return node; +} + #if defined(__x86_64__) #include "cpuid.h" -- cgit 1.2.3-korg