X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fos.h;h=cd3b4289da66e6dc101297b2beabe8ef1ea0dfb9;hb=a690fdbfe179e0ea65818c03b52535bf9210efd0;hp=a5c74f8ce72d9b5587867640828fa60e22807e2a;hpb=7cd468a3d7dee7d6c92f69a0bb7061ae208ec727;p=vpp.git diff --git a/src/vppinfra/os.h b/src/vppinfra/os.h index a5c74f8ce72..cd3b4289da6 100644 --- a/src/vppinfra/os.h +++ b/src/vppinfra/os.h @@ -44,7 +44,7 @@ /* External panic function. */ void os_panic (void); -/* External exit function analagous to unix exit. */ +/* External exit function analogous to unix exit. */ void os_exit (int code); /* External function to print a line. */ @@ -56,8 +56,43 @@ void os_out_of_memory (void); /* Estimate, measure or divine CPU timestamp clock frequency. */ f64 os_cpu_clock_frequency (void); -uword os_get_cpu_number (void); -uword os_get_ncpus (void); +extern __thread uword __os_thread_index; +extern __thread uword __os_numa_index; + +static_always_inline uword +os_get_thread_index (void) +{ + return __os_thread_index; +} + +static_always_inline void +os_set_thread_index (uword thread_index) +{ + __os_thread_index = thread_index; +} + +static_always_inline uword +os_get_numa_index (void) +{ + return __os_numa_index; +} + +static_always_inline void +os_set_numa_index (uword numa_index) +{ + __os_numa_index = numa_index; +} + +static_always_inline uword +os_get_cpu_number (void) __attribute__ ((deprecated)); + +static_always_inline uword +os_get_cpu_number (void) +{ + return __os_thread_index; +} + +uword os_get_nthreads (void); #include