sched: add pipe config params to subport struct
[dpdk.git] / lib / librte_eal / common / eal_common_lcore.c
index 1cbac42..59a2fd1 100644 (file)
 #include "eal_private.h"
 #include "eal_thread.h"
 
+int rte_lcore_index(int lcore_id)
+{
+       if (unlikely(lcore_id >= RTE_MAX_LCORE))
+               return -1;
+
+       if (lcore_id < 0)
+               lcore_id = (int)rte_lcore_id();
+
+       return lcore_config[lcore_id].core_index;
+}
+
+int rte_lcore_to_cpu_id(int lcore_id)
+{
+       if (unlikely(lcore_id >= RTE_MAX_LCORE))
+               return -1;
+
+       if (lcore_id < 0)
+               lcore_id = (int)rte_lcore_id();
+
+       return lcore_config[lcore_id].core_id;
+}
+
+rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id)
+{
+       return lcore_config[lcore_id].cpuset;
+}
+
+unsigned int
+rte_lcore_to_socket_id(unsigned int lcore_id)
+{
+       return lcore_config[lcore_id].socket_id;
+}
+
 static int
 socket_id_cmp(const void *a, const void *b)
 {
@@ -56,15 +89,6 @@ rte_eal_cpu_init(void)
 
                /* find socket first */
                socket_id = eal_cpu_socket_id(lcore_id);
-               if (socket_id >= RTE_MAX_NUMA_NODES) {
-#ifdef RTE_EAL_ALLOW_INV_SOCKET_ID
-                       socket_id = 0;
-#else
-                       RTE_LOG(ERR, EAL, "Socket ID (%u) is greater than RTE_MAX_NUMA_NODES (%d)\n",
-                                       socket_id, RTE_MAX_NUMA_NODES);
-                       return -1;
-#endif
-               }
                lcore_to_socket_id[lcore_id] = socket_id;
 
                /* in 1:1 mapping, record related cpu detected state */
@@ -114,14 +138,14 @@ rte_eal_cpu_init(void)
        return 0;
 }
 
-unsigned int __rte_experimental
+unsigned int
 rte_socket_count(void)
 {
        const struct rte_config *config = rte_eal_get_configuration();
        return config->numa_node_count;
 }
 
-int __rte_experimental
+int
 rte_socket_id_by_idx(unsigned int idx)
 {
        const struct rte_config *config = rte_eal_get_configuration();