eal: new function to create control threads
[dpdk.git] / lib / librte_eal / common / eal_common_thread.c
index f4d9892..f1a88f8 100644 (file)
 
 #include "eal_thread.h"
 
+RTE_DECLARE_PER_LCORE(unsigned , _socket_id);
+
+unsigned rte_socket_id(void)
+{
+       return RTE_PER_LCORE(_socket_id);
+}
+
+int
+rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role)
+{
+       struct rte_config *cfg = rte_eal_get_configuration();
+
+       if (lcore_id >= RTE_MAX_LCORE)
+               return -EINVAL;
+
+       if (cfg->lcore_role[lcore_id] == role)
+               return 0;
+
+       return -EINVAL;
+}
+
 int eal_cpuset_socket_id(rte_cpuset_t *cpusetp)
 {
        unsigned cpu = 0;
@@ -148,3 +169,10 @@ exit:
 
        return ret;
 }
+
+int rte_ctrl_thread_create(pthread_t *thread,
+                       const pthread_attr_t *attr,
+                       void *(*start_routine)(void *), void *arg)
+{
+       return pthread_create(thread, attr, start_routine, arg);
+}