X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Finclude%2Frte_lcore.h;h=0d85a91a84c150f8f41a335928f4be2d76ffe32b;hb=4cd789c43ff35c4a4cd05a187f078be671f8332d;hp=4c7d6bb110ca34007bb1b0a08968ad2fc19fccdc;hpb=798a71d703352b3f78e882e068d46fb7ec09a3b2;p=dpdk.git diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index 4c7d6bb110..0d85a91a84 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -48,7 +48,7 @@ extern "C" { #endif -#define LCORE_ID_ANY -1 /**< Any lcore. */ +#define LCORE_ID_ANY UINT32_MAX /**< Any lcore. */ #if defined(__linux__) typedef cpu_set_t rte_cpuset_t; @@ -73,6 +73,7 @@ struct lcore_config { unsigned core_id; /**< core number on socket for this lcore */ int core_index; /**< relative index, starting from 0 */ rte_cpuset_t cpuset; /**< cpu set which the lcore affinity to */ + uint8_t core_role; /**< role of core eg: OFF, RTE, SERVICE */ }; /** @@ -80,12 +81,13 @@ struct lcore_config { */ extern struct lcore_config lcore_config[RTE_MAX_LCORE]; -RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per core "core id". */ +RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */ +RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */ /** * Return the ID of the execution unit we are running on. * @return - * Logical core ID + * Logical core ID (in EAL thread) or LCORE_ID_ANY (in non-EAL thread) */ static inline unsigned rte_lcore_id(void) @@ -143,11 +145,7 @@ rte_lcore_index(int lcore_id) * @return * the ID of current lcoreid's physical socket */ -static inline unsigned -rte_socket_id(void) -{ - return lcore_config[rte_lcore_id()].socket_id; -} +unsigned rte_socket_id(void); /** * Get the ID of the physical socket of the specified lcore @@ -178,7 +176,7 @@ rte_lcore_is_enabled(unsigned lcore_id) struct rte_config *cfg = rte_eal_get_configuration(); if (lcore_id >= RTE_MAX_LCORE) return 0; - return (cfg->lcore_role[lcore_id] != ROLE_OFF); + return cfg->lcore_role[lcore_id] == ROLE_RTE; } /** @@ -229,6 +227,80 @@ rte_get_next_lcore(unsigned i, int skip_master, int wrap) i