From 6194cb2e15923b3a46054459d3806b816235c86e Mon Sep 17 00:00:00 2001 From: Xiaodong Liu Date: Thu, 14 May 2020 03:27:49 -0400 Subject: [PATCH] thread: add spdk_env_get_primary_core Change-Id: I5b337477e41da7d424cccc48366ca6018b776ee2 Signed-off-by: Xiaodong Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2448 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Paul Luse Reviewed-by: Jim Harris Reviewed-by: Changpeng Liu Reviewed-by: Shuhei Matsumoto --- include/spdk/env.h | 7 +++++++ lib/env_dpdk/spdk_env_dpdk.map | 1 + lib/env_dpdk/threads.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/include/spdk/env.h b/include/spdk/env.h index f8cb058dd..78ac29acb 100644 --- a/include/spdk/env.h +++ b/include/spdk/env.h @@ -467,6 +467,13 @@ uint32_t spdk_env_get_core_count(void); */ uint32_t spdk_env_get_current_core(void); +/** + * Get the index of the primary dedicated CPU core for this application. + * + * \return the index of the primary dedicated CPU core. + */ +uint32_t spdk_env_get_primary_core(void); + /** * Get the index of the first dedicated CPU core for this application. * diff --git a/lib/env_dpdk/spdk_env_dpdk.map b/lib/env_dpdk/spdk_env_dpdk.map index 028796e1c..e899ad326 100644 --- a/lib/env_dpdk/spdk_env_dpdk.map +++ b/lib/env_dpdk/spdk_env_dpdk.map @@ -33,6 +33,7 @@ spdk_mempool_lookup; spdk_env_get_core_count; spdk_env_get_current_core; + spdk_env_get_primary_core; spdk_env_get_first_core; spdk_env_get_last_core; spdk_env_get_next_core; diff --git a/lib/env_dpdk/threads.c b/lib/env_dpdk/threads.c index 01c7b8d9f..8831b8c38 100644 --- a/lib/env_dpdk/threads.c +++ b/lib/env_dpdk/threads.c @@ -48,6 +48,12 @@ spdk_env_get_current_core(void) return rte_lcore_id(); } +uint32_t +spdk_env_get_primary_core(void) +{ + return rte_get_master_lcore(); +} + uint32_t spdk_env_get_first_core(void) {