[2/5] eal: set lcore config thread for lcore main

Message ID 1670439617-9054-3-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series add lcore set name and get name API |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Dec. 7, 2022, 7 p.m. UTC
  Set the lcore_config[].thread_id for lcore_main during initialization.
This allows the new rte_lcore_{set,get}_name() APIs to work with
lcore_main consistent with other worker lcores.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/common/eal_common_thread.c | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/lib/eal/common/eal_common_thread.c b/lib/eal/common/eal_common_thread.c
index 91066e6..fb1dfc9 100644
--- a/lib/eal/common/eal_common_thread.c
+++ b/lib/eal/common/eal_common_thread.c
@@ -151,6 +151,9 @@  unsigned rte_socket_id(void)
 
 	/* acquire system unique id */
 	rte_gettid();
+	if (lcore_id == rte_get_main_lcore())
+		lcore_config[lcore_id].thread_id =
+			(pthread_t)(rte_thread_self()).opaque_id;
 
 	thread_update_affinity(cpuset);