From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6B214A00C3;
	Wed,  7 Dec 2022 20:00:27 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 9D91B42D1D;
	Wed,  7 Dec 2022 20:00:21 +0100 (CET)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id DAE51410FB
 for <dev@dpdk.org>; Wed,  7 Dec 2022 20:00:19 +0100 (CET)
Received: by linux.microsoft.com (Postfix, from userid 1086)
 id 353D920B83E5; Wed,  7 Dec 2022 11:00:19 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 353D920B83E5
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1670439619;
 bh=Em4fUYC6ZCDwSrQGlc2E3eKzdYj/rxPsPWp+7LAFo+8=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=X5iuChtXBgSGRRCXhoU2BChuY9W064Kk9kjxrPvZMPAEG/moUDBRUVLyz+zIvYilD
 DbcDJsnAYC7g65UVEibv1G+F21qUqT0NSvOp0FBf48PZhVyzUmHip7ytVCH9eb5Itq
 qcXEH3RpbJRLXd8Rhav+bELsE717Krgp8XGukXIU=
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, david.marchand@redhat.com, olivier.matz@6wind.com,
 stephen@networkplumber.org, Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH 2/5] eal: set lcore config thread for lcore main
Date: Wed,  7 Dec 2022 11:00:14 -0800
Message-Id: <1670439617-9054-3-git-send-email-roretzla@linux.microsoft.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1670439617-9054-1-git-send-email-roretzla@linux.microsoft.com>
References: <1670439617-9054-1-git-send-email-roretzla@linux.microsoft.com>
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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(+)

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);
 
-- 
1.8.3.1