eal: use sizeof to avoid a double use of a define
[dpdk.git] / lib / librte_eal / linuxapp / eal / eal_thread.c
index 18bd8e0..082d091 100644 (file)
 #include <rte_launch.h>
 #include <rte_log.h>
 #include <rte_memory.h>
-#include <rte_memzone.h>
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
-#include <rte_per_lcore.h>
 #include <rte_lcore.h>
 
 #include "eal_private.h"
@@ -150,7 +148,7 @@ eal_thread_loop(__attribute__((unused)) void *arg)
        if (eal_thread_set_affinity() < 0)
                rte_panic("cannot set affinity\n");
 
-       ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
+       ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset));
 
        RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%x;cpuset=[%s%s])\n",
                lcore_id, (int)thread_id, cpuset, ret == 0 ? "" : "...");
@@ -184,7 +182,14 @@ eal_thread_loop(__attribute__((unused)) void *arg)
                ret = lcore_config[lcore_id].f(fct_arg);
                lcore_config[lcore_id].ret = ret;
                rte_wmb();
-               lcore_config[lcore_id].state = FINISHED;
+
+               /* when a service core returns, it should go directly to WAIT
+                * state, because the application will not lcore_wait() for it.
+                */
+               if (lcore_config[lcore_id].core_role == ROLE_SERVICE)
+                       lcore_config[lcore_id].state = WAIT;
+               else
+                       lcore_config[lcore_id].state = FINISHED;
        }
 
        /* never reached */
@@ -197,3 +202,16 @@ int rte_sys_gettid(void)
 {
        return (int)syscall(SYS_gettid);
 }
+
+int rte_thread_setname(pthread_t id, const char *name)
+{
+       int ret = -1;
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2, 12)
+       ret = pthread_setname_np(id, name);
+#endif
+#endif
+       RTE_SET_USED(id);
+       RTE_SET_USED(name);
+       return ret;
+}