[PATCH v3 12/44] drivers/bus: replace use of sys/queue.h

Stephen Hemminger
2025-11-03T16:50:49Z

Prefer just using rte_tailq.h when TAILQ macro's are used.
Other places eliminate sys/queue.h if possible.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/bus/auxiliary/auxiliary_common.c | 2 +-
drivers/bus/auxiliary/private.h | 2 +-
drivers/bus/fslmc/bus_fslmc_driver.h | 1 -
drivers/bus/fslmc/fslmc_vfio.c | 1 +
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 11 ++---------
drivers/bus/ifpga/ifpga_bus.c | 2 +-
drivers/bus/pci/bsd/pci.c | 2 +-
drivers/bus/pci/pci_common.c | 1 -
drivers/bus/pci/pci_params.c | 2 --
drivers/bus/pci/windows/pci.c | 3 +--
drivers/bus/pci/windows/pci_netuio.c | 2 --
drivers/bus/platform/platform.c | 2 +-
drivers/bus/vdev/vdev.c | 1 -
drivers/bus/vmbus/vmbus_common.c | 1 -
14 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index ac766e283e..4edc621268 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -8,7 +8,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
-#include <sys/queue.h>
+
#include <eal_export.h>
#include <rte_errno.h>
#include <rte_interrupts.h>
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 4604f6f4a7..bd519c1091 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -7,9 +7,9 @@

#include <stdbool.h>
#include <stdio.h>
-#include <sys/queue.h>

#include <bus_driver.h>
+#include <rte_bsd_queue.h>

#include "bus_auxiliary_driver.h"

diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index b6a6238a01..88c9ce88a9 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -17,7 +17,6 @@
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
-#include <sys/queue.h>
#include <stdint.h>
#include <inttypes.h>

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 550d4e0e8d..cf6b4c6ab4 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -23,6 +23,7 @@
#include <sys/eventfd.h>
#include <ctype.h>

+#include <rte_bsd_queue.h>
#include <eal_export.h>
#include <eal_filesystem.h>
#include <rte_mbuf.h>
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 2a9e519668..ac7cbd3a1f 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -17,7 +17,6 @@
#include <signal.h>
#include <pthread.h>
#include <sys/types.h>
-#include <sys/queue.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/mman.h>
@@ -34,6 +33,7 @@
#include <rte_cycles.h>
#include <rte_kvargs.h>
#include <dev_driver.h>
+#include <rte_tailq.h>

#include <fslmc_logs.h>
#include <bus_fslmc_driver.h>
@@ -41,13 +41,6 @@
#include "dpaa2_hw_dpio.h"
#include <mc/fsl_dpmng.h>

-#ifndef TAILQ_FOREACH_SAFE
-#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = TAILQ_FIRST((head)); \
- (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
- (var) = (tvar))
-#endif
-
#define NUM_HOST_CPUS RTE_MAX_LCORE

RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_io_portal)
@@ -107,7 +100,7 @@ static struct dpaa2_dpio_dev *get_dpio_dev_from_id(int32_t dpio_id)
struct dpaa2_dpio_dev *dpio_dev = NULL;

/* Get DPIO dev handle from list using index */
- TAILQ_FOREACH(dpio_dev, &dpio_dev_list, next) {
+ RTE_TAILQ_FOREACH(dpio_dev, &dpio_dev_list, next) {
if (dpio_dev->hw_id == dpio_id)
break;
}
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index ca9e49f548..3af95921a7 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -7,7 +7,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
-#include <sys/queue.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
@@ -26,6 +25,7 @@
#include <rte_alarm.h>
#include <rte_string_fns.h>
#include <rte_debug.h>
+#include <rte_tailq.h>

#include "rte_rawdev.h"
#include "rte_rawdev_pmd.h"
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 3f13e1d6ac..97214ea049 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -15,7 +15,6 @@
#include <errno.h>
#include <dirent.h>
#include <limits.h>
-#include <sys/queue.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/pciio.h>
@@ -38,6 +37,7 @@
#include <rte_string_fns.h>
#include <rte_debug.h>
#include <rte_devargs.h>
+#include <rte_tailq.h>

#include <eal_export.h>
#include "eal_filesystem.h"
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index bf5df3d94e..fd535967dd 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -9,7 +9,6 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_errno.h>
#include <rte_interrupts.h>
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 087ec38bb9..0b6d944118 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -2,8 +2,6 @@
* Copyright 2018 Gaëtan Rivet
*/

-#include <sys/queue.h>
-
#include <bus_driver.h>
#include <rte_bus_pci.h>
#include <dev_driver.h>
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 6f6f368cb7..1f74d81af5 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -2,8 +2,6 @@
* Copyright 2020 Mellanox Technologies, Ltd
*/

-#include <sys/queue.h>
-
#include <eal_export.h>
#include <rte_windows.h>
#include <rte_errno.h>
@@ -11,6 +9,7 @@
#include <rte_eal.h>
#include <rte_memory.h>
#include <rte_bus_pci.h>
+#include <rte_tailq.h>

/* DEVPKEY_Device_Numa_Node should be defined in devpkey.h */
#include <devpkey.h>
diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c
index 346b2f4c0a..d3d7e1f504 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -2,8 +2,6 @@
* Copyright(c) 2020 Intel Corporation.
*/

-#include <sys/queue.h>
-
#include <rte_windows.h>
#include <rte_errno.h>
#include <rte_log.h>
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index f6673cf181..edad25e759 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -10,7 +10,6 @@
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <sys/queue.h>
#include <unistd.h>

#include <bus_driver.h>
@@ -23,6 +22,7 @@
#include <rte_log.h>
#include <rte_memory.h>
#include <rte_string_fns.h>
+#include <rte_tailq.h>
#include <rte_vfio.h>

#include "private.h"
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index be375f63dc..85df5f02c6 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -8,7 +8,6 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
-#include <sys/queue.h>

#include <eal_export.h>
#include <rte_eal.h>
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index a787d8b18d..8a987a7d0e 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -7,7 +7,6 @@
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
-#include <sys/queue.h>
#include <sys/mman.h>

#include <eal_export.h>
--
2.51.0