From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C3CD42588; Wed, 13 Sep 2023 13:46:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E16240608; Wed, 13 Sep 2023 13:46:00 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id 5A97540A8A for ; Wed, 13 Sep 2023 13:45:58 +0200 (CEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id EBEF4320089C; Wed, 13 Sep 2023 07:45:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 13 Sep 2023 07:45:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1694605556; x=1694691956; bh=yuYb/FScGlE53o8sIBUUC4AbBWAHIA9MsQv NXxUbr+k=; b=ON1wjjCEj5kJMxuNWXeZtdgRPqO9GFWT4QH9J6SJCmHzbwQY+3R O1MGwbakbM5kd/McGO8BihXVdyed/beVLsqf5iuoXhXwuXSpML2lPSDMH7V4Ce4P AeRG+a3GIW/gzrSq3LCF0PgOyeUkImGg6gogJXfhXmJEEP6QIleerZQFOOkCJ+Qw hhtKCEBrnnCwIPuAQeLtpyJzEOSabaPKrAa25UEiVChv0r04lUsgk3wfcuuzjwLQ DWFGk35Ik1zMXbVvE+aV3sYpWVwvLYF/A4JRVqoBhTPkplnTp8zyT0E/hPy8nMcK HPxq15UtpIVrI6xUh1LptCsA6L6+cVNys+Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1694605556; x=1694691956; bh=yuYb/FScGlE53o8sIBUUC4AbBWAHIA9MsQv NXxUbr+k=; b=oX7z0iA78dzB2LCXHw5oW+aF/jlwQFQkRj/imw0TKFrwzeR9Jtf dquWOfqTrjizPaIveIfReQVuXgTJS8qm/DYO8lGNgJWp1V5HgrkFeaZL6JVaeQT8 OwKpC4FPmlkwGh9uo0fAQBPokneW19d0ZTvl0RUXA+Rx9+PkkmRbN3NCnPYnVxKX VSebqE83BMy1U2+9dy5B+M/EtpesF+waSMJbGlgj9V7abTykwmcRTFhl3vqpiMsN vbzd5Oy4eW/jpIzWlIoi4tPSt9vn8YBROsKZaoCz5Sp0CC9XMHZg0uhivlbfwxPb EZnWGmlVKDBs/SMzEerWpuL2cVekVvHFmEQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpefvhhho mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne cuggftrfgrthhtvghrnheptdeiffffgeefteelhfekueetueduffejgfelvedtieejudek gfevheetheehgeejnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Sep 2023 07:45:55 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: Tyler Retzlaff , David Marchand , Ferruh Yigit , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Reshma Pattan , Stephen Hemminger Subject: [PATCH v3 09/11] test: convert threads creation Date: Wed, 13 Sep 2023 13:28:22 +0200 Message-ID: <20230913114351.1940459-10-thomas@monjalon.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230913114351.1940459-1-thomas@monjalon.net> References: <20230906162226.1618088-1-thomas@monjalon.net> <20230913114351.1940459-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Calls to pthread for thread creation are replaced with the rte_thread API. Signed-off-by: Thomas Monjalon Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- app/test/process.h | 10 +++++----- app/test/test_lcores.c | 9 ++++----- app/test/test_pdump.c | 6 +++--- app/test/test_pdump.h | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/app/test/process.h b/app/test/process.h index 1f073b9c5c..af7bc3e0de 100644 --- a/app/test/process.h +++ b/app/test/process.h @@ -28,8 +28,8 @@ #ifdef RTE_LIB_PDUMP #ifdef RTE_NET_RING -#include -extern void *send_pkts(void *empty); +#include +extern uint32_t send_pkts(void *empty); extern uint16_t flag_for_send_pkts; #endif #endif @@ -49,7 +49,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value) char path[32]; #ifdef RTE_LIB_PDUMP #ifdef RTE_NET_RING - pthread_t thread; + rte_thread_t thread; int rc; #endif #endif @@ -136,7 +136,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value) #ifdef RTE_LIB_PDUMP #ifdef RTE_NET_RING if ((strcmp(env_value, "run_pdump_server_tests") == 0)) { - rc = pthread_create(&thread, NULL, &send_pkts, NULL); + rc = rte_thread_create(&thread, NULL, send_pkts, NULL); if (rc != 0) { rte_panic("Cannot start send pkts thread: %s\n", strerror(rc)); @@ -151,7 +151,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value) #ifdef RTE_NET_RING if ((strcmp(env_value, "run_pdump_server_tests") == 0)) { flag_for_send_pkts = 0; - pthread_join(thread, NULL); + rte_thread_join(thread, NULL); } #endif #endif diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c index 0c96faa4cb..22225a9fd3 100644 --- a/app/test/test_lcores.c +++ b/app/test/test_lcores.c @@ -2,7 +2,6 @@ * Copyright (c) 2020 Red Hat, Inc. */ -#include #include #include @@ -341,7 +340,7 @@ test_non_eal_lcores_callback(unsigned int eal_threads_count) return -1; } -static void *ctrl_thread_loop(void *arg) +static uint32_t ctrl_thread_loop(void *arg) { struct thread_context *t = arg; @@ -350,7 +349,7 @@ static void *ctrl_thread_loop(void *arg) /* Set the thread state to DONE */ t->state = Thread_DONE; - return NULL; + return 0; } static int @@ -362,8 +361,8 @@ test_ctrl_thread(void) /* Create one control thread */ t = &ctrl_thread_context; t->state = Thread_INIT; - if (rte_ctrl_thread_create((pthread_t *)&t->id, "dpdk-test-ctrlt", - NULL, ctrl_thread_loop, t) != 0) + if (rte_thread_create_control(&t->id, "dpdk-test-ctrlt", + ctrl_thread_loop, t) != 0) return -1; /* Wait till the control thread exits. diff --git a/app/test/test_pdump.c b/app/test/test_pdump.c index ea03056b47..adf49f0b54 100644 --- a/app/test/test_pdump.c +++ b/app/test/test_pdump.c @@ -136,8 +136,8 @@ test_pdump_uninit(void) return ret; } -void * -send_pkts(void *empty) +uint32_t +send_pkts(void *empty __rte_unused) { int ret = 0; struct rte_mbuf *pbuf[NUM_PACKETS] = { }; @@ -161,7 +161,7 @@ send_pkts(void *empty) rte_eth_dev_stop(portid); test_put_mbuf_to_pool(mp, pbuf); - return empty; + return 0; } /* diff --git a/app/test/test_pdump.h b/app/test/test_pdump.h index abef9a85ec..8746d61269 100644 --- a/app/test/test_pdump.h +++ b/app/test/test_pdump.h @@ -9,7 +9,7 @@ #define NUM_ITR 3 /* sample test to send packets to the pdump client recursively */ -void *send_pkts(void *port); +uint32_t send_pkts(void *empty); /* Sample test to create setup for the pdump server tests */ int test_pdump_init(void); -- 2.42.0