DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH 4/6] net/iavf: use rte thread API
Date: Fri, 17 Mar 2023 15:34:18 -0700	[thread overview]
Message-ID: <1679092460-9930-5-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1679092460-9930-1-git-send-email-roretzla@linux.microsoft.com>

Update driver to use rte thread API where available instead of pthread
as a prerequisite to removing pthread stubs on Windows.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/iavf/iavf_vchnl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 9adaadb..7a2be22 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -42,7 +42,7 @@ struct iavf_event_element {
 
 struct iavf_event_handler {
 	uint32_t ndev;
-	pthread_t tid;
+	rte_thread_t tid;
 	int fd[2];
 	pthread_mutex_t lock;
 	TAILQ_HEAD(event_list, iavf_event_element) pending;
@@ -59,7 +59,7 @@ struct iavf_event_handler {
 	(var) = (tvar))
 #endif
 
-static void *
+static uint32_t
 iavf_dev_event_handle(void *param __rte_unused)
 {
 	struct iavf_event_handler *handler = &event_handler;
@@ -84,7 +84,7 @@ struct iavf_event_handler {
 		}
 	}
 
-	return NULL;
+	return 0;
 }
 
 static void
@@ -135,7 +135,7 @@ struct iavf_event_handler {
 	TAILQ_INIT(&handler->pending);
 	pthread_mutex_init(&handler->lock, NULL);
 
-	if (rte_ctrl_thread_create(&handler->tid, "iavf-event-thread",
+	if (rte_thread_create_control(&handler->tid, "iavf-event-thread",
 				NULL, iavf_dev_event_handle, NULL)) {
 		__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED);
 		return -1;
@@ -152,14 +152,14 @@ struct iavf_event_handler {
 	if (__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED) != 0)
 		return;
 
-	int unused = pthread_cancel(handler->tid);
+	int unused = pthread_cancel((pthread_t)handler->tid.opaque_id);
 	RTE_SET_USED(unused);
 	close(handler->fd[0]);
 	close(handler->fd[1]);
 	handler->fd[0] = -1;
 	handler->fd[1] = -1;
 
-	pthread_join(handler->tid, NULL);
+	rte_thread_join(handler->tid, NULL);
 	pthread_mutex_destroy(&handler->lock);
 
 	struct iavf_event_element *pos, *save_next;
-- 
1.8.3.1


  parent reply	other threads:[~2023-03-17 22:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 22:34 [PATCH 0/6] windows: remove most pthread lifetime shim functions Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 1/6] dma/skeleton: use rte thread API Tyler Retzlaff
2023-04-18  9:19   ` Bruce Richardson
2023-04-18 15:04     ` Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 2/6] net/ixgbe: " Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 3/6] net/ice: " Tyler Retzlaff
2023-03-17 22:34 ` Tyler Retzlaff [this message]
2023-03-17 22:34 ` [PATCH 5/6] eal: " Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 6/6] windows: remove most pthread lifetime shim functions Tyler Retzlaff
2023-04-03  5:34 ` [PATCH 0/6] " Tyler Retzlaff
2023-04-18  9:21   ` Bruce Richardson
2023-06-01  8:49     ` David Marchand
2023-06-01 12:23       ` Zhang, Qi Z
2023-06-02 16:22         ` Tyler Retzlaff
2023-06-09 12:38           ` David Marchand
2023-04-17 16:46 ` Tyler Retzlaff
2023-06-09 12:39 ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1679092460-9930-5-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).