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 2C9E04613A;
	Mon, 27 Jan 2025 19:09:28 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D26B940DCE;
	Mon, 27 Jan 2025 19:09:03 +0100 (CET)
Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com
 [209.85.214.178])
 by mails.dpdk.org (Postfix) with ESMTP id 31F7840A84
 for <dev@dpdk.org>; Mon, 27 Jan 2025 19:08:59 +0100 (CET)
Received: by mail-pl1-f178.google.com with SMTP id
 d9443c01a7336-2164b662090so92757045ad.1
 for <dev@dpdk.org>; Mon, 27 Jan 2025 10:08:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1738001338;
 x=1738606138; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=aWhn84AfKM0OcNNaAHnwDfGv2ymxXYmX8+xaGZgMySo=;
 b=bZ0VgcNvU+UXgqR8kZyV5ykIa6fLHXwHhxjBIRU8rIpTYtBwUIUEHJuc+aw3YvyyVh
 ncdBm9wxjLLIEB8bmQROurms/HfatfWJhkp87n4hI6MQL4aNcvXr5JCZ8sZV2N+PbB/G
 Vz+ZhThiPbgGVoduioEPFBJ8sQd7rqKf0i9UID03d92H4PTV1759LEdCNid6UfYBj+sc
 2+AzHcfhYyxS/DGFVcrnPxkxVtfIZXyAbbqh7mMdHIZybcmE+JqqMosuul28u+6E9ROE
 CGqvH/TkUVWfw63Thgw0xCIFJfJfonWzqB2XSF+9MIPcjfvMkDM1fDTpugtXRkNNKpQO
 H8Mw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1738001338; x=1738606138;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=aWhn84AfKM0OcNNaAHnwDfGv2ymxXYmX8+xaGZgMySo=;
 b=dCuYlCw9AJbUvFv9s1BDaGe2AZT/6VwIqoKy0/RIivHgUI4dX8+bdIMNJ3ua8wfPms
 r8ELA2Zslf2i6UHmL03CqN3TcVDqKjPi9tAP0YDGhOuaRZBeRqltw3U1RBzCGnOKcDBO
 edu/2Tgonyrdu8/EOx/mcSG7wE92LdOVQ4DWzTqVSLyt9kvIHHQVz+u9GY9jOseEj2sx
 8SwIxfCk9QlMrmPYCjdHEUpxLODBikDizIxwILtgIdQevrVakfYC4syGeNyq0uBIJlrV
 CdRTG9DHNSwBC82h08wFxCcgY+6DGzIORhXnc1C/ozLlmDIVnlCB+/Yuqc+2iLeClDh8
 0/yg==
X-Gm-Message-State: AOJu0YxpSXSTW+4OIl5tJsoUwgSSp0J4ELNvTsX6CnT2aBaYOWGo/oV9
 j/t5czs1x18bBpm1bEO+v//JdADk/N356D4p9GZhwx8iP8YQ+mF11qIgxSVxKCtvcxuKUJBWKJH
 /
X-Gm-Gg: ASbGncsvBgrEsclKUMmsHt7cg2+p87PE7zBpw64Www94QOKbJwkamh3XZRY7szunyoI
 ACK9I2DozPAoYv/kTqghXBcN8YR377NT+AZAE9gfojZUXTy1QQe/szTP67VyiLChu9yrwVa4Pvj
 izZeCtGGhaC0msLYwww6F9AcBTMFP9pXMxK0ms9jaqaOEdpROi5Z2P2FS2f7sVAhU98TN5ZTer3
 zmzCnLHWdO27+bgXIfBngZ9K3rH688eCxADkASI9mQwGjA0useVVZQ/zZRsTl+HtX9NCOGTwrTc
 zJGze/4wHwsrKEFNJEN+FzZKAojEhJErGt5L76n4uTRCCx1mQt0HubNDdA==
X-Google-Smtp-Source: AGHT+IH+lyfoPToji8w5B8nXA6kUNAigKaN8Br6aNUBoqYk7KPDcYGcDgBzASOp/F/a5kuAP8LTjAA==
X-Received: by 2002:a17:902:f690:b0:216:2a5a:89d3 with SMTP id
 d9443c01a7336-21c35558fabmr559902125ad.25.1738001338178; 
 Mon, 27 Jan 2025 10:08:58 -0800 (PST)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-21da41413absm66166665ad.123.2025.01.27.10.08.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 27 Jan 2025 10:08:57 -0800 (PST)
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
Message-ID: <20250127180842.97907-7-stephen@networkplumber.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20250127180842.97907-1-stephen@networkplumber.org>
References: <20250127180842.97907-1-stephen@networkplumber.org>
MIME-Version: 1.0
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

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