+static void
+vlib_get_thread_core_socket (vlib_worker_thread_t * w, unsigned cpu_id)
+{
+ const char *sys_cpu_path = "/sys/devices/system/cpu/cpu";
+ u8 *p = 0;
+ int core_id = -1, socket_id = -1;
+
+ p = format (p, "%s%u/topology/core_id%c", sys_cpu_path, cpu_id, 0);
+ clib_sysfs_read ((char *) p, "%d", &core_id);
+ vec_reset_length (p);
+ p =
+ format (p, "%s%u/topology/physical_package_id%c", sys_cpu_path, cpu_id,
+ 0);
+ clib_sysfs_read ((char *) p, "%d", &socket_id);
+ vec_free (p);
+
+ w->core_id = core_id;
+ w->socket_id = socket_id;
+}
+