DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbox@nvidia.com>
Subject: [RFC 6/7] vhost: replace open coded TAILQ_FOREACH_SAFE
Date: Mon, 27 Jan 2025 10:04:00 -0800	[thread overview]
Message-ID: <20250127180842.97907-7-stephen@networkplumber.org> (raw)
In-Reply-To: <20250127180842.97907-1-stephen@networkplumber.org>

Proper macro is now in EAL rte_queue.h use it instead.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/vhost/socket.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 05a7e5902f..625ed08b7c 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -10,10 +10,10 @@
 #include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <sys/queue.h>
 #include <errno.h>
 #include <fcntl.h>
 
+#include <rte_queue.h>
 #include <rte_thread.h>
 #include <rte_log.h>
 
@@ -458,14 +458,7 @@ vhost_user_client_reconnect(void *arg __rte_unused)
 	while (1) {
 		pthread_mutex_lock(&reconn_list.mutex);
 
-		/*
-		 * An equal implementation of TAILQ_FOREACH_SAFE,
-		 * which does not exist on all platforms.
-		 */
-		for (reconn = TAILQ_FIRST(&reconn_list.head);
-		     reconn != NULL; reconn = next) {
-			next = TAILQ_NEXT(reconn, next);
-
+		TAILQ_FOREACH_SAFE(reconn, &reconn_list.head, next, next) {
 			ret = vhost_user_connect_nonblock(reconn->vsocket->path, reconn->fd,
 						(struct sockaddr *)&reconn->un,
 						sizeof(reconn->un));
-- 
2.45.2


  parent reply	other threads:[~2025-01-27 18:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27 18:03 [RFC 0/7] Introduce FreeBSD macros for SAFE iteration Stephen Hemminger
2025-01-27 18:03 ` [RFC 1/7] eal: add queue macro extensions from FreeBSD Stephen Hemminger
2025-01-27 18:03 ` [RFC 2/7] net/qede: fix use after free Stephen Hemminger
2025-01-27 18:03 ` [RFC 3/7] bus/fslmc: " Stephen Hemminger
2025-01-27 18:03 ` [RFC 4/7] net/bnxt: " Stephen Hemminger
2025-01-27 19:25   ` Ajit Khaparde
2025-01-27 18:03 ` [RFC 5/7] net/iavf: replace local version of TAILQ_FOREACH_SAFE Stephen Hemminger
2025-01-27 18:04 ` Stephen Hemminger [this message]
2025-01-27 18:04 ` [RFC 7/7] raw/ifpga: use EAL " Stephen Hemminger
2025-01-27 18:16 ` [RFC 0/7] Introduce FreeBSD macros for SAFE iteration Bruce Richardson
2025-01-27 18:43   ` Stephen Hemminger
2025-01-27 19:29     ` Morten Brørup
2025-01-27 23:14       ` Stephen Hemminger

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=20250127180842.97907-7-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=chenbox@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    /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).