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 AF98742588; Wed, 13 Sep 2023 12:38:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D540940A73; Wed, 13 Sep 2023 12:38:02 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id 66B794064A for <dev@dpdk.org>; Wed, 13 Sep 2023 12:38:00 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id F357F3200413; Wed, 13 Sep 2023 06:37:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 13 Sep 2023 06:37:59 -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= 1694601478; x=1694687878; bh=yuYb/FScGlE53o8sIBUUC4AbBWAHIA9MsQv NXxUbr+k=; b=SsHTuO/ctEtEqbs58CbNHRl8pR4D5YbMhiVtAmSq/+cQDlMvs6c wHXAOrcwCRJseSkpp6t0DVoMhlQgEw/NajWAy9kGL9F9uHKsGIPN4FJlSltOHJzY mcVPLMs3MEDR5pX1+aMPDF1I3lG1Oid25UNLeOh1YgQEJkTq+UWVTRjEAj7YjXxT WhsksrX7bQSLIfSOYP1WyNoUeLHp+3rYRLkhu7Jrzu2IBo1kipoDEgwXOfgP3h3L xMS6kgBDJyNhS0gGmkM3bjwdc4jaO8pjBLU/N97ay9ljCNB9fOIRE596Hl1jHhpC Qr2/zjHad1u83UT1s4Ma30jqCdG/+iamwow== 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= 1694601478; x=1694687878; bh=yuYb/FScGlE53o8sIBUUC4AbBWAHIA9MsQv NXxUbr+k=; b=pLoMKEeEd71/ug/91NS/zEfwfGj1Gi+OTyIAdTQGNam9a8+lz7L fJHvdL2UhNbNtkZcaZhqbb3QO6i2gLv+LHao2RL8VYYn+SpoamtH0WzOgSneO1Hc H5okxwcXsIB1Gm6iH2jny88blTD4hWBXJT4PpB4M/1Hq1ao/htWpNEI2CIshEPEx HMlBapq+/pPdBEYzRRIsky5ON+bYWoOaBYtgqvoVRvqTMMqq/KyrLgFMWwn8pKxv 0qkJNvYTJBi1x71vbLRy4GD778JsnDCwfmhp+g8jD+3vnhIgiwfwKu6Hqc8Vlu0K Gz4MX8wDqyNvsoGrufD7+UGTDtvoOOxfDWQ== X-ME-Sender: <xms:BpEBZTzEMtwEDIV0mHzbh4S9yrDIlGDgwhgPoV1j8NGvDXMxIAZrzg> <xme:BpEBZbSRMZUJy46dRVBCe5sqBBaycZ5h4A6SjAXy5dwHX5qaTeGwGVnYASEwNmccG Lne9yXmY6aRcFg31w> X-ME-Received: <xmr:BpEBZdUZU3CnS5pgHAFeOOQDMMGgFuIAh0LsLQzcjDlo6uEn0bKHtkCiDXd457n8qSlnnQ> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpefvhhho mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne cuggftrfgrthhtvghrnheptdeiffffgeefteelhfekueetueduffejgfelvedtieejudek gfevheetheehgeejnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: <xmx:BpEBZdjJ1keL0In9sD-nW_-e-m4IDJqbTKEBZ8U5yVrnltpCjzkMCw> <xmx:BpEBZVDFLy9YhKn0A5hfWwCR-8WXCk4WTxcZ-o_M91NrrY5B9dDCqQ> <xmx:BpEBZWJ_Q8mybf6sJpc05clX5QeooUF5v-ZBiA7lOKhFqb-Ff9OM_A> <xmx:BpEBZY6T86QKEJpCXhHMNKXX7b6m6AGobuImF_Owe1vod79fczR6Wg> Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Sep 2023 06:37:56 -0400 (EDT) From: Thomas Monjalon <thomas@monjalon.net> To: dev@dpdk.org Cc: Tyler Retzlaff <roretzla@linux.microsoft.com>, David Marchand <david.marchand@redhat.com>, Ferruh Yigit <ferruh.yigit@amd.com>, =?UTF-8?q?Morten=20Br=C3=B8rup?= <mb@smartsharesystems.com>, Reshma Pattan <reshma.pattan@intel.com>, Stephen Hemminger <stephen@networkplumber.org> Subject: [PATCH v2 09/11] test: convert threads creation Date: Wed, 13 Sep 2023 12:34:28 +0200 Message-ID: <20230913103600.1935292-10-thomas@monjalon.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230913103600.1935292-1-thomas@monjalon.net> References: <20230906162226.1618088-1-thomas@monjalon.net> <20230913103600.1935292-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 <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 Calls to pthread for thread creation are replaced with the rte_thread API. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> --- 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 <pthread.h> -extern void *send_pkts(void *empty); +#include <rte_thread.h> +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 <pthread.h> #include <string.h> #include <rte_common.h> @@ -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