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(-)
@@ -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
@@ -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.
@@ -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;
}
/*
@@ -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);