vppinfra: Stub out get_current_cpu and get_current_numa on FreeBSD 62/40262/4
authorTom Jones <thj@freebsd.org>
Fri, 26 Jan 2024 13:48:49 +0000 (13:48 +0000)
committerDamjan Marion <dmarion@0xa5.net>
Mon, 19 Feb 2024 18:11:34 +0000 (18:11 +0000)
FreeBSD has its own set of syscalls for getting current CPU and NUMA
domain information. Stub out these calls and return CPU 0 and NUMA domain
0 as placeholders until we bring in FreeBSD specific calls.

Type: improvement
Change-Id: Id61df0273b0bcc6acf4844ee626e4f246f9f217b
Signed-off-by: Tom Jones <thj@freebsd.org>
src/vppinfra/cpu.c

index 79e7dc0..385a4e2 100644 (file)
@@ -252,17 +252,25 @@ format_cpu_flags (u8 *s, va_list *args)
 __clib_export u32
 clib_get_current_cpu_id ()
 {
+#ifdef __linux__
   unsigned cpu, node;
   syscall (__NR_getcpu, &cpu, &node, 0);
   return cpu;
+#else
+  return 0;
+#endif /* __linux__ */
 }
 
 __clib_export u32
 clib_get_current_numa_node ()
 {
+#ifdef __linux__
   unsigned cpu, node;
   syscall (__NR_getcpu, &cpu, &node, 0);
   return node;
+#else
+  return 0;
+#endif /* __linux__ */
 }
 
 __clib_export u8 *