eal: remove sys/queue.h from public headers
authorWilliam Tu <u9012063@gmail.com>
Tue, 24 Aug 2021 16:21:03 +0000 (16:21 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 1 Oct 2021 11:09:43 +0000 (13:09 +0200)
Currently there are some public headers that include 'sys/queue.h', which
is not POSIX, but usually provided by the Linux/BSD system library.
(Not in POSIX.1, POSIX.1-2001, or POSIX.1-2008. Present on the BSDs.)
The file is missing on Windows. During the Windows build, DPDK uses a
bundled copy, so building a DPDK library works fine.  But when OVS or other
applications use DPDK as a library, because some DPDK public headers
include 'sys/queue.h', on Windows, it triggers an error due to no such
file.

One solution is to install the 'lib/eal/windows/include/sys/queue.h' into
Windows environment, such as [1]. However, this means DPDK exports the
functionalities of 'sys/queue.h' into the environment, which might cause
symbols, macros, headers clashing with other applications.

The patch fixes it by removing the "#include <sys/queue.h>" from
DPDK public headers, so programs including DPDK headers don't depend
on the system to provide 'sys/queue.h'. When these public headers use
macros such as TAILQ_xxx, we replace it by the ones with RTE_ prefix.
For Windows, we copy the definitions from <sys/queue.h> to rte_os.h
in Windows EAL. Note that these RTE_ macros are compatible with
<sys/queue.h>, both at the level of API (to use with <sys/queue.h>
macros in C files) and ABI (to avoid breaking it).

Additionally, the TAILQ_FOREACH_SAFE is not part of <sys/queue.h>,
the patch replaces it with RTE_TAILQ_FOREACH_SAFE.

[1] http://mails.dpdk.org/archives/dev/2021-August/216304.html

Suggested-by: Nick Connolly <nick.connolly@mayadata.io>
Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Signed-off-by: William Tu <u9012063@gmail.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
64 files changed:
drivers/bus/auxiliary/private.h
drivers/bus/auxiliary/rte_bus_auxiliary.h
drivers/bus/dpaa/dpaa_bus.c
drivers/bus/fslmc/fslmc_bus.c
drivers/bus/fslmc/fslmc_vfio.c
drivers/bus/ifpga/rte_bus_ifpga.h
drivers/bus/pci/pci_params.c
drivers/bus/pci/rte_bus_pci.h
drivers/bus/pci/windows/pci.c
drivers/bus/pci/windows/pci_netuio.c
drivers/bus/vdev/rte_bus_vdev.h
drivers/bus/vdev/vdev.c
drivers/bus/vmbus/rte_bus_vmbus.h
drivers/net/bnxt/tf_ulp/bnxt_ulp.c
drivers/net/bonding/rte_eth_bond_flow.c
drivers/net/failsafe/failsafe_flow.c
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev.h
drivers/net/i40e/i40e_flow.c
drivers/net/i40e/i40e_hash.c
drivers/net/i40e/rte_pmd_i40e.c
drivers/net/iavf/iavf.h
drivers/net/iavf/iavf_generic_flow.c
drivers/net/ice/ice_dcf_ethdev.c
drivers/net/ice/ice_ethdev.c
drivers/net/ice/ice_generic_flow.c
drivers/net/ipn3ke/ipn3ke_flow.c
drivers/net/mlx5/mlx5_flow_dv.c
drivers/net/mlx5/mlx5_flow_meter.c
drivers/net/softnic/rte_eth_softnic_flow.c
drivers/net/softnic/rte_eth_softnic_swq.c
drivers/raw/dpaa2_qdma/dpaa2_qdma.c
lib/bbdev/rte_bbdev.h
lib/cryptodev/cryptodev_pmd.h
lib/cryptodev/rte_cryptodev.h
lib/eal/common/eal_common_devargs.c
lib/eal/common/eal_common_log.c
lib/eal/common/eal_common_options.c
lib/eal/common/eal_private.h
lib/eal/freebsd/include/rte_os.h
lib/eal/include/rte_bus.h
lib/eal/include/rte_class.h
lib/eal/include/rte_dev.h
lib/eal/include/rte_devargs.h
lib/eal/include/rte_log.h
lib/eal/include/rte_service.h
lib/eal/include/rte_tailq.h
lib/eal/linux/include/rte_os.h
lib/eal/windows/eal_alarm.c
lib/eal/windows/include/rte_os.h
lib/efd/rte_efd.c
lib/ethdev/rte_ethdev_core.h
lib/hash/rte_fbk_hash.h
lib/hash/rte_thash.c
lib/ip_frag/rte_ip_frag.h
lib/mempool/rte_mempool.c
lib/mempool/rte_mempool.h
lib/pci/rte_pci.h
lib/ring/rte_ring_core.h
lib/table/rte_swx_table.h
lib/table/rte_swx_table_selector.h
lib/vhost/iotlb.c
lib/vhost/rte_vdpa_dev.h
lib/vhost/vdpa.c

index 9987e8b..d22e83c 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <stdbool.h>
 #include <stdio.h>
+#include <sys/queue.h>
 
 #include "rte_bus_auxiliary.h"
 
index 2462bad..b1f5610 100644 (file)
@@ -19,7 +19,6 @@ extern "C" {
 #include <stdlib.h>
 #include <limits.h>
 #include <errno.h>
-#include <sys/queue.h>
 #include <stdint.h>
 #include <inttypes.h>
 
@@ -113,7 +112,7 @@ typedef int (rte_auxiliary_dma_unmap_t)(struct rte_auxiliary_device *dev,
  * A structure describing an auxiliary device.
  */
 struct rte_auxiliary_device {
-       TAILQ_ENTRY(rte_auxiliary_device) next;   /**< Next probed device. */
+       RTE_TAILQ_ENTRY(rte_auxiliary_device) next; /**< Next probed device. */
        struct rte_device device;                 /**< Inherit core device */
        char name[RTE_DEV_NAME_MAX_LEN + 1];      /**< ASCII device name */
        struct rte_intr_handle intr_handle;       /**< Interrupt handle */
@@ -124,7 +123,7 @@ struct rte_auxiliary_device {
  * A structure describing an auxiliary driver.
  */
 struct rte_auxiliary_driver {
-       TAILQ_ENTRY(rte_auxiliary_driver) next; /**< Next in list. */
+       RTE_TAILQ_ENTRY(rte_auxiliary_driver) next; /**< Next in list. */
        struct rte_driver driver;             /**< Inherit core driver. */
        struct rte_auxiliary_bus *bus;        /**< Auxiliary bus reference. */
        rte_auxiliary_match_t *match;         /**< Device match function. */
index e499305..6cab2ae 100644 (file)
@@ -105,7 +105,7 @@ dpaa_add_to_device_list(struct rte_dpaa_device *newdev)
        struct rte_dpaa_device *dev = NULL;
        struct rte_dpaa_device *tdev = NULL;
 
-       TAILQ_FOREACH_SAFE(dev, &rte_dpaa_bus.device_list, next, tdev) {
+       RTE_TAILQ_FOREACH_SAFE(dev, &rte_dpaa_bus.device_list, next, tdev) {
                comp = compare_dpaa_devices(newdev, dev);
                if (comp < 0) {
                        TAILQ_INSERT_BEFORE(dev, newdev, next);
@@ -245,7 +245,7 @@ dpaa_clean_device_list(void)
        struct rte_dpaa_device *dev = NULL;
        struct rte_dpaa_device *tdev = NULL;
 
-       TAILQ_FOREACH_SAFE(dev, &rte_dpaa_bus.device_list, next, tdev) {
+       RTE_TAILQ_FOREACH_SAFE(dev, &rte_dpaa_bus.device_list, next, tdev) {
                TAILQ_REMOVE(&rte_dpaa_bus.device_list, dev, next);
                free(dev);
                dev = NULL;
index becc455..8c8f8a2 100644 (file)
@@ -45,7 +45,7 @@ cleanup_fslmc_device_list(void)
        struct rte_dpaa2_device *dev;
        struct rte_dpaa2_device *t_dev;
 
-       TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, t_dev) {
+       RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, t_dev) {
                TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
                free(dev);
                dev = NULL;
@@ -82,7 +82,7 @@ insert_in_device_list(struct rte_dpaa2_device *newdev)
        struct rte_dpaa2_device *dev = NULL;
        struct rte_dpaa2_device *tdev = NULL;
 
-       TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, tdev) {
+       RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, tdev) {
                comp = compare_dpaa2_devname(newdev, dev);
                if (comp < 0) {
                        TAILQ_INSERT_BEFORE(dev, newdev, next);
index c8373e6..852fcfc 100644 (file)
@@ -808,7 +808,8 @@ fslmc_vfio_process_group(void)
        bool is_dpmcp_in_blocklist = false, is_dpio_in_blocklist = false;
        int dpmcp_count = 0, dpio_count = 0, current_device;
 
-       TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+       RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next,
+               dev_temp) {
                if (dev->dev_type == DPAA2_MPORTAL) {
                        dpmcp_count++;
                        if (dev->device.devargs &&
@@ -825,7 +826,8 @@ fslmc_vfio_process_group(void)
 
        /* Search the MCP as that should be initialized first. */
        current_device = 0;
-       TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+       RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next,
+               dev_temp) {
                if (dev->dev_type == DPAA2_MPORTAL) {
                        current_device++;
                        if (dev->device.devargs &&
@@ -872,7 +874,8 @@ fslmc_vfio_process_group(void)
        }
 
        current_device = 0;
-       TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+       RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next,
+               dev_temp) {
                if (dev->dev_type == DPAA2_IO)
                        current_device++;
                if (dev->device.devargs &&
index b430841..a85e90d 100644 (file)
@@ -28,9 +28,9 @@ struct rte_afu_device;
 struct rte_afu_driver;
 
 /** Double linked list of Intel FPGA AFU device. */
-TAILQ_HEAD(ifpga_afu_dev_list, rte_afu_device);
+RTE_TAILQ_HEAD(ifpga_afu_dev_list, rte_afu_device);
 /** Double linked list of Intel FPGA AFU device drivers. */
-TAILQ_HEAD(ifpga_afu_drv_list, rte_afu_driver);
+RTE_TAILQ_HEAD(ifpga_afu_drv_list, rte_afu_driver);
 
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
@@ -71,7 +71,7 @@ struct rte_afu_shared {
  * A structure describing a AFU device.
  */
 struct rte_afu_device {
-       TAILQ_ENTRY(rte_afu_device) next;       /**< Next in device list. */
+       RTE_TAILQ_ENTRY(rte_afu_device) next;       /**< Next in device list. */
        struct rte_device device;               /**< Inherit core device */
        struct rte_rawdev *rawdev;    /**< Point Rawdev */
        struct rte_afu_id id;                   /**< AFU id within FPGA. */
@@ -105,7 +105,7 @@ typedef int (afu_remove_t)(struct rte_afu_device *);
  * A structure describing a AFU device.
  */
 struct rte_afu_driver {
-       TAILQ_ENTRY(rte_afu_driver) next;       /**< Next afu driver. */
+       RTE_TAILQ_ENTRY(rte_afu_driver) next;   /**< Next afu driver. */
        struct rte_driver driver;               /**< Inherit core driver. */
        afu_probe_t *probe;                     /**< Device Probe function. */
        afu_remove_t *remove;                   /**< Device Remove function. */
index 691b5ea..21c2e1d 100644 (file)
@@ -2,6 +2,8 @@
  * Copyright 2018 Gaëtan Rivet
  */
 
+#include <sys/queue.h>
+
 #include <rte_bus.h>
 #include <rte_bus_pci.h>
 #include <rte_dev.h>
index 583470e..673a285 100644 (file)
@@ -19,7 +19,6 @@ extern "C" {
 #include <stdlib.h>
 #include <limits.h>
 #include <errno.h>
-#include <sys/queue.h>
 #include <stdint.h>
 #include <inttypes.h>
 
@@ -37,16 +36,16 @@ struct rte_pci_device;
 struct rte_pci_driver;
 
 /** List of PCI devices */
-TAILQ_HEAD(rte_pci_device_list, rte_pci_device);
+RTE_TAILQ_HEAD(rte_pci_device_list, rte_pci_device);
 /** List of PCI drivers */
-TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
+RTE_TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 
 /* PCI Bus iterators */
 #define FOREACH_DEVICE_ON_PCIBUS(p)    \
-               TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
+               RTE_TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
 
 #define FOREACH_DRIVER_ON_PCIBUS(p)    \
-               TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
+               RTE_TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
 
 struct rte_devargs;
 
@@ -64,7 +63,7 @@ enum rte_pci_kernel_driver {
  * A structure describing a PCI device.
  */
 struct rte_pci_device {
-       TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
+       RTE_TAILQ_ENTRY(rte_pci_device) next;   /**< Next probed PCI device. */
        struct rte_device device;           /**< Inherit core device */
        struct rte_pci_addr addr;           /**< PCI location. */
        struct rte_pci_id id;               /**< PCI ID. */
@@ -160,7 +159,7 @@ typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
  * A structure describing a PCI driver.
  */
 struct rte_pci_driver {
-       TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
+       RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
        struct rte_driver driver;          /**< Inherit core driver. */
        struct rte_pci_bus *bus;           /**< PCI bus reference. */
        rte_pci_probe_t *probe;            /**< Device probe function. */
index 644c452..39ba31b 100644 (file)
@@ -1,6 +1,9 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2020 Mellanox Technologies, Ltd
  */
+
+#include <sys/queue.h>
+
 #include <rte_windows.h>
 #include <rte_errno.h>
 #include <rte_log.h>
index 1bf9133..a0b175a 100644 (file)
@@ -2,6 +2,8 @@
  * Copyright(c) 2020 Intel Corporation.
  */
 
+#include <sys/queue.h>
+
 #include <rte_windows.h>
 #include <rte_errno.h>
 #include <rte_log.h>
index fc315d1..2856799 100644 (file)
 extern "C" {
 #endif
 
-#include <sys/queue.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
 
 struct rte_vdev_device {
-       TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
+       RTE_TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
        struct rte_device device;               /**< Inherit core device */
 };
 
@@ -53,7 +52,7 @@ rte_vdev_device_args(const struct rte_vdev_device *dev)
 }
 
 /** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+RTE_TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
 
 /**
  * Probe function called for each virtual device driver once.
@@ -107,7 +106,7 @@ typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
  * A virtual device driver abstraction.
  */
 struct rte_vdev_driver {
-       TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+       RTE_TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
        struct rte_driver driver;        /**< Inherited general driver. */
        rte_vdev_probe_t *probe;         /**< Virtual device probe function. */
        rte_vdev_remove_t *remove;       /**< Virtual device remove function. */
index 281a2c3..a8d8b23 100644 (file)
@@ -100,7 +100,8 @@ rte_vdev_remove_custom_scan(rte_vdev_scan_callback callback, void *user_arg)
        struct vdev_custom_scan *custom_scan, *tmp_scan;
 
        rte_spinlock_lock(&vdev_custom_scan_lock);
-       TAILQ_FOREACH_SAFE(custom_scan, &vdev_custom_scans, next, tmp_scan) {
+       RTE_TAILQ_FOREACH_SAFE(custom_scan, &vdev_custom_scans, next,
+                               tmp_scan) {
                if (custom_scan->callback != callback ||
                                (custom_scan->user_arg != (void *)-1 &&
                                custom_scan->user_arg != user_arg))
index 4cf73ce..6bcff66 100644 (file)
@@ -20,7 +20,6 @@ extern "C" {
 #include <limits.h>
 #include <stdbool.h>
 #include <errno.h>
-#include <sys/queue.h>
 #include <stdint.h>
 #include <inttypes.h>
 
@@ -38,15 +37,15 @@ struct rte_vmbus_bus;
 struct vmbus_channel;
 struct vmbus_mon_page;
 
-TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
-TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
+RTE_TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
+RTE_TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
 
 /* VMBus iterators */
 #define FOREACH_DEVICE_ON_VMBUS(p)     \
-       TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
+       RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
 
 #define FOREACH_DRIVER_ON_VMBUS(p)     \
-       TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
+       RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
 
 /** Maximum number of VMBUS resources. */
 enum hv_uio_map {
@@ -62,7 +61,7 @@ enum hv_uio_map {
  * A structure describing a VMBUS device.
  */
 struct rte_vmbus_device {
-       TAILQ_ENTRY(rte_vmbus_device) next;    /**< Next probed VMBUS device */
+       RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
        const struct rte_vmbus_driver *driver; /**< Associated driver */
        struct rte_device device;              /**< Inherit core device */
        rte_uuid_t device_id;                  /**< VMBUS device id */
@@ -93,7 +92,7 @@ typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
  * A structure describing a VMBUS driver.
  */
 struct rte_vmbus_driver {
-       TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
+       RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
        struct rte_driver driver;
        struct rte_vmbus_bus *bus;          /**< VM bus reference. */
        vmbus_probe_t *probe;               /**< Device Probe function. */
index 3b86410..bbaa6dc 100644 (file)
@@ -2040,7 +2040,7 @@ bnxt_ulp_cntxt_list_del(struct bnxt_ulp_context *ulp_ctx)
        struct ulp_context_list_entry   *entry, *temp;
 
        rte_spinlock_lock(&bnxt_ulp_ctxt_lock);
-       TAILQ_FOREACH_SAFE(entry, &ulp_cntx_list, next, temp) {
+       RTE_TAILQ_FOREACH_SAFE(entry, &ulp_cntx_list, next, temp) {
                if (entry->ulp_ctx == ulp_ctx) {
                        TAILQ_REMOVE(&ulp_cntx_list, entry, next);
                        rte_free(entry);
index 417f76b..65b77fa 100644 (file)
@@ -157,7 +157,7 @@ bond_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *err)
        /* Destroy all bond flows from its slaves instead of flushing them to
         * keep the LACP flow or any other external flows.
         */
-       TAILQ_FOREACH_SAFE(flow, &internals->flow_list, next, tmp) {
+       RTE_TAILQ_FOREACH_SAFE(flow, &internals->flow_list, next, tmp) {
                lret = bond_flow_destroy(dev, flow, err);
                if (unlikely(lret != 0))
                        ret = lret;
index 5e2b5f7..354f9fe 100644 (file)
@@ -180,7 +180,7 @@ fs_flow_flush(struct rte_eth_dev *dev,
                        return ret;
                }
        }
-       TAILQ_FOREACH_SAFE(flow, &PRIV(dev)->flow_list, next, tmp) {
+       RTE_TAILQ_FOREACH_SAFE(flow, &PRIV(dev)->flow_list, next, tmp) {
                TAILQ_REMOVE(&PRIV(dev)->flow_list, flow, next);
                fs_flow_release(&flow);
        }
index 7a2a828..bd97d93 100644 (file)
@@ -5438,7 +5438,7 @@ i40e_vsi_release(struct i40e_vsi *vsi)
 
        /* VSI has child to attach, release child first */
        if (vsi->veb) {
-               TAILQ_FOREACH_SAFE(vsi_list, &vsi->veb->head, list, temp) {
+               RTE_TAILQ_FOREACH_SAFE(vsi_list, &vsi->veb->head, list, temp) {
                        if (i40e_vsi_release(vsi_list->vsi) != I40E_SUCCESS)
                                return -1;
                }
@@ -5446,7 +5446,8 @@ i40e_vsi_release(struct i40e_vsi *vsi)
        }
 
        if (vsi->floating_veb) {
-               TAILQ_FOREACH_SAFE(vsi_list, &vsi->floating_veb->head, list, temp) {
+               RTE_TAILQ_FOREACH_SAFE(vsi_list, &vsi->floating_veb->head,
+                       list, temp) {
                        if (i40e_vsi_release(vsi_list->vsi) != I40E_SUCCESS)
                                return -1;
                }
@@ -5454,7 +5455,7 @@ i40e_vsi_release(struct i40e_vsi *vsi)
 
        /* Remove all macvlan filters of the VSI */
        i40e_vsi_remove_all_macvlan_filter(vsi);
-       TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp)
+       RTE_TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp)
                rte_free(f);
 
        if (vsi->type != I40E_VSI_MAIN &&
@@ -6057,7 +6058,7 @@ i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on)
        i = 0;
 
        /* Remove all existing mac */
-       TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+       RTE_TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
                mac_filter[i] = f->mac_info;
                ret = i40e_vsi_delete_mac(vsi, &f->mac_info.mac_addr);
                if (ret) {
index cd6deab..374b73e 100644 (file)
@@ -6,6 +6,7 @@
 #define _I40E_ETHDEV_H_
 
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include <rte_time.h>
 #include <rte_kvargs.h>
index 3c1570b..e41a84f 100644 (file)
@@ -4917,7 +4917,7 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf)
                }
 
                /* Delete FDIR flows in flow list. */
-               TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
+               RTE_TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
                        if (flow->filter_type == RTE_ETH_FILTER_FDIR) {
                                TAILQ_REMOVE(&pf->flow_list, flow, node);
                        }
@@ -4972,7 +4972,7 @@ i40e_flow_flush_ethertype_filter(struct i40e_pf *pf)
        }
 
        /* Delete ethertype flows in flow list. */
-       TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
                if (flow->filter_type == RTE_ETH_FILTER_ETHERTYPE) {
                        TAILQ_REMOVE(&pf->flow_list, flow, node);
                        rte_free(flow);
@@ -5000,7 +5000,7 @@ i40e_flow_flush_tunnel_filter(struct i40e_pf *pf)
        }
 
        /* Delete tunnel flows in flow list. */
-       TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
                if (flow->filter_type == RTE_ETH_FILTER_TUNNEL) {
                        TAILQ_REMOVE(&pf->flow_list, flow, node);
                        rte_free(flow);
index 1fb8c9a..6579b1a 100644 (file)
@@ -1366,7 +1366,7 @@ i40e_hash_filter_flush(struct i40e_pf *pf)
 {
        struct rte_flow *flow, *next;
 
-       TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, next) {
+       RTE_TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, next) {
                if (flow->filter_type != RTE_ETH_FILTER_HASH)
                        continue;
 
index 2e34140..ec24046 100644 (file)
@@ -216,7 +216,7 @@ i40e_vsi_rm_mac_filter(struct i40e_vsi *vsi)
        void *temp;
 
        /* remove all the MACs */
-       TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+       RTE_TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
                vlan_num = vsi->vlan_num;
                filter_type = f->mac_info.filter_type;
                if (filter_type == I40E_MACVLAN_PERFECT_MATCH ||
@@ -274,7 +274,7 @@ i40e_vsi_restore_mac_filter(struct i40e_vsi *vsi)
        void *temp;
 
        /* restore all the MACs */
-       TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+       RTE_TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
                if (f->mac_info.filter_type == I40E_MACVLAN_PERFECT_MATCH ||
                    f->mac_info.filter_type == I40E_MACVLAN_HASH_MATCH) {
                        /**
@@ -563,7 +563,7 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,
        rte_ether_addr_copy(mac_addr, &vf->mac_addr);
 
        /* Remove all existing mac */
-       TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp)
+       RTE_TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp)
                if (i40e_vsi_delete_mac(vsi, &f->mac_info.mac_addr)
                                != I40E_SUCCESS)
                        PMD_DRV_LOG(WARNING, "Delete MAC failed");
index 90f80a7..940d4f7 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef _IAVF_ETHDEV_H_
 #define _IAVF_ETHDEV_H_
 
+#include <sys/queue.h>
+
 #include <rte_kvargs.h>
 #include <rte_tm_driver.h>
 
index 1fe270f..b86d99e 100644 (file)
@@ -1637,7 +1637,7 @@ iavf_flow_init(struct iavf_adapter *ad)
        TAILQ_INIT(&vf->dist_parser_list);
        rte_spinlock_init(&vf->flow_ops_lock);
 
-       TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
                if (engine->init == NULL) {
                        PMD_INIT_LOG(ERR, "Invalid engine type (%d)",
                                     engine->type);
@@ -1663,7 +1663,7 @@ iavf_flow_uninit(struct iavf_adapter *ad)
        struct iavf_flow_parser_node *p_parser;
        void *temp;
 
-       TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
                if (engine->uninit)
                        engine->uninit(ad);
        }
@@ -1733,7 +1733,7 @@ iavf_unregister_parser(struct iavf_flow_parser *parser,
        if (list == NULL)
                return;
 
-       TAILQ_FOREACH_SAFE(p_parser, list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(p_parser, list, node, temp) {
                if (p_parser->parser->engine->type == parser->engine->type) {
                        TAILQ_REMOVE(list, p_parser, node);
                        rte_free(p_parser);
@@ -1917,7 +1917,7 @@ iavf_parse_engine_create(struct iavf_adapter *ad,
        void *temp;
        void *meta = NULL;
 
-       TAILQ_FOREACH_SAFE(parser_node, parser_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(parser_node, parser_list, node, temp) {
                if (parser_node->parser->parse_pattern_action(ad,
                                parser_node->parser->array,
                                parser_node->parser->array_len,
@@ -1946,7 +1946,7 @@ iavf_parse_engine_validate(struct iavf_adapter *ad,
        void *temp;
        void *meta = NULL;
 
-       TAILQ_FOREACH_SAFE(parser_node, parser_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(parser_node, parser_list, node, temp) {
                if (parser_node->parser->parse_pattern_action(ad,
                                parser_node->parser->array,
                                parser_node->parser->array_len,
@@ -2089,7 +2089,7 @@ iavf_flow_is_valid(struct rte_flow *flow)
        void *temp;
 
        if (flow && flow->engine) {
-               TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
+               RTE_TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
                        if (engine == flow->engine)
                                return true;
                }
@@ -2142,7 +2142,7 @@ iavf_flow_flush(struct rte_eth_dev *dev,
        void *temp;
        int ret = 0;
 
-       TAILQ_FOREACH_SAFE(p_flow, &vf->flow_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(p_flow, &vf->flow_list, node, temp) {
                ret = iavf_flow_destroy(dev, p_flow, error);
                if (ret) {
                        PMD_DRV_LOG(ERR, "Failed to flush flows");
index f510bad..4e4cdbc 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <errno.h>
 #include <stdbool.h>
+#include <sys/queue.h>
 #include <sys/types.h>
 #include <unistd.h>
 
index e24a3b6..66e33a1 100644 (file)
@@ -1109,7 +1109,7 @@ ice_remove_all_mac_vlan_filters(struct ice_vsi *vsi)
        if (!vsi || !vsi->mac_num)
                return -EINVAL;
 
-       TAILQ_FOREACH_SAFE(m_f, &vsi->mac_list, next, temp) {
+       RTE_TAILQ_FOREACH_SAFE(m_f, &vsi->mac_list, next, temp) {
                ret = ice_remove_mac_filter(vsi, &m_f->mac_info.mac_addr);
                if (ret != ICE_SUCCESS) {
                        ret = -EINVAL;
@@ -1120,7 +1120,7 @@ ice_remove_all_mac_vlan_filters(struct ice_vsi *vsi)
        if (vsi->vlan_num == 0)
                return 0;
 
-       TAILQ_FOREACH_SAFE(v_f, &vsi->vlan_list, next, temp) {
+       RTE_TAILQ_FOREACH_SAFE(v_f, &vsi->vlan_list, next, temp) {
                ret = ice_remove_vlan_filter(vsi, &v_f->vlan_info.vlan);
                if (ret != ICE_SUCCESS) {
                        ret = -EINVAL;
index 13e3734..3e6ed70 100644 (file)
@@ -1820,7 +1820,7 @@ ice_flow_init(struct ice_adapter *ad)
        TAILQ_INIT(&pf->dist_parser_list);
        rte_spinlock_init(&pf->flow_ops_lock);
 
-       TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
                if (engine->init == NULL) {
                        PMD_INIT_LOG(ERR, "Invalid engine type (%d)",
                                        engine->type);
@@ -1846,7 +1846,7 @@ ice_flow_uninit(struct ice_adapter *ad)
        struct ice_flow_parser_node *p_parser;
        void *temp;
 
-       TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) {
                if (engine->uninit)
                        engine->uninit(ad);
        }
@@ -1946,7 +1946,7 @@ ice_unregister_parser(struct ice_flow_parser *parser,
        if (list == NULL)
                return;
 
-       TAILQ_FOREACH_SAFE(p_parser, list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(p_parser, list, node, temp) {
                if (p_parser->parser->engine->type == parser->engine->type) {
                        TAILQ_REMOVE(list, p_parser, node);
                        rte_free(p_parser);
@@ -2276,7 +2276,7 @@ ice_parse_engine_create(struct ice_adapter *ad,
        void *meta = NULL;
        void *temp;
 
-       TAILQ_FOREACH_SAFE(parser_node, parser_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(parser_node, parser_list, node, temp) {
                int ret;
 
                if (parser_node->parser->parse_pattern_action(ad,
@@ -2309,7 +2309,7 @@ ice_parse_engine_validate(struct ice_adapter *ad,
        struct ice_flow_parser_node *parser_node;
        void *temp;
 
-       TAILQ_FOREACH_SAFE(parser_node, parser_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(parser_node, parser_list, node, temp) {
                if (parser_node->parser->parse_pattern_action(ad,
                                parser_node->parser->array,
                                parser_node->parser->array_len,
@@ -2481,7 +2481,7 @@ ice_flow_flush(struct rte_eth_dev *dev,
        void *temp;
        int ret = 0;
 
-       TAILQ_FOREACH_SAFE(p_flow, &pf->flow_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(p_flow, &pf->flow_list, node, temp) {
                ret = ice_flow_destroy(dev, p_flow, error);
                if (ret) {
                        PMD_DRV_LOG(ERR, "Failed to flush flows");
@@ -2546,7 +2546,7 @@ ice_flow_redirect(struct ice_adapter *ad,
 
        rte_spinlock_lock(&pf->flow_ops_lock);
 
-       TAILQ_FOREACH_SAFE(p_flow, &pf->flow_list, node, temp) {
+       RTE_TAILQ_FOREACH_SAFE(p_flow, &pf->flow_list, node, temp) {
                if (!p_flow->engine->redirect)
                        continue;
                ret = p_flow->engine->redirect(ad, p_flow, rd);
index c702e19..f5867ca 100644 (file)
@@ -1231,7 +1231,7 @@ ipn3ke_flow_flush(struct rte_eth_dev *dev,
        struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
        struct rte_flow *flow, *temp;
 
-       TAILQ_FOREACH_SAFE(flow, &hw->flow_list, next, temp) {
+       RTE_TAILQ_FOREACH_SAFE(flow, &hw->flow_list, next, temp) {
                TAILQ_REMOVE(&hw->flow_list, flow, next);
                rte_free(flow);
        }
index b610ad3..c6370cd 100644 (file)
@@ -15132,7 +15132,7 @@ __flow_dv_destroy_sub_policy_rules(struct rte_eth_dev *dev,
                    policy->act_cnt[i].fate_action == MLX5_FLOW_FATE_MTR)
                        next_fm = mlx5_flow_meter_find(priv,
                                        policy->act_cnt[i].next_mtr_id, NULL);
-               TAILQ_FOREACH_SAFE(color_rule, &sub_policy->color_rules[i],
+               RTE_TAILQ_FOREACH_SAFE(color_rule, &sub_policy->color_rules[i],
                                   next_port, tmp) {
                        claim_zero(mlx5_flow_os_destroy_flow(color_rule->rule));
                        tbl = container_of(color_rule->matcher->tbl,
index a24bd9c..ba4e9fc 100644 (file)
@@ -2168,7 +2168,7 @@ mlx5_flow_meter_flush(struct rte_eth_dev *dev, struct rte_mtr_error *error)
                        priv->mtr_idx_tbl = NULL;
                }
        } else {
-               TAILQ_FOREACH_SAFE(legacy_fm, fms, next, tmp) {
+               RTE_TAILQ_FOREACH_SAFE(legacy_fm, fms, next, tmp) {
                        fm = &legacy_fm->fm;
                        if (mlx5_flow_meter_params_flush(dev, fm, 0))
                                return -rte_mtr_error_set(error, EINVAL,
index 27eaf38..7d054c3 100644 (file)
@@ -2207,7 +2207,8 @@ pmd_flow_flush(struct rte_eth_dev *dev,
                        void *temp;
                        int status;
 
-                       TAILQ_FOREACH_SAFE(flow, &table->flows, node, temp) {
+                       RTE_TAILQ_FOREACH_SAFE(flow, &table->flows, node,
+                               temp) {
                                /* Rule delete. */
                                status = softnic_pipeline_table_rule_delete
                                                (softnic,
index 2083d0a..afe6f05 100644 (file)
@@ -39,7 +39,7 @@ softnic_softnic_swq_free_keep_rxq_txq(struct pmd_internals *p)
 {
        struct softnic_swq *swq, *tswq;
 
-       TAILQ_FOREACH_SAFE(swq, &p->swq_list, node, tswq) {
+       RTE_TAILQ_FOREACH_SAFE(swq, &p->swq_list, node, tswq) {
                if ((strncmp(swq->name, "RXQ", strlen("RXQ")) == 0) ||
                        (strncmp(swq->name, "TXQ", strlen("TXQ")) == 0))
                        continue;
index c961e18..7b80370 100644 (file)
@@ -1606,7 +1606,7 @@ remove_hw_queues_from_list(struct dpaa2_dpdmai_dev *dpdmai_dev)
 
        DPAA2_QDMA_FUNC_TRACE();
 
-       TAILQ_FOREACH_SAFE(queue, &qdma_queue_list, next, tqueue) {
+       RTE_TAILQ_FOREACH_SAFE(queue, &qdma_queue_list, next, tqueue) {
                if (queue->dpdmai_dev == dpdmai_dev) {
                        TAILQ_REMOVE(&qdma_queue_list, queue, next);
                        rte_free(queue);
index 7017124..3ebf62e 100644 (file)
@@ -434,7 +434,7 @@ struct rte_bbdev_callback;
 struct rte_intr_handle;
 
 /** Structure to keep track of registered callbacks */
-TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback);
+RTE_TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback);
 
 /**
  * @internal The data structure associated with a device. Drivers can access
index ae3aac5..8cc9051 100644 (file)
@@ -62,7 +62,7 @@ struct rte_cryptodev_global {
 
 /* Cryptodev driver, containing the driver ID */
 struct cryptodev_driver {
-       TAILQ_ENTRY(cryptodev_driver) next; /**< Next in list. */
+       RTE_TAILQ_ENTRY(cryptodev_driver) next; /**< Next in list. */
        const struct rte_driver *driver;
        uint8_t id;
 };
index bb01f0f..d43905c 100644 (file)
@@ -879,7 +879,7 @@ typedef uint16_t (*enqueue_pkt_burst_t)(void *qp,
 struct rte_cryptodev_callback;
 
 /** Structure to keep track of registered callbacks */
-TAILQ_HEAD(rte_cryptodev_cb_list, rte_cryptodev_callback);
+RTE_TAILQ_HEAD(rte_cryptodev_cb_list, rte_cryptodev_callback);
 
 /**
  * Structure used to hold information about the callbacks to be called for a
index 7ab9e71..411dd6a 100644 (file)
@@ -330,7 +330,7 @@ rte_devargs_insert(struct rte_devargs **da)
        if (*da == NULL || (*da)->bus == NULL)
                return -1;
 
-       TAILQ_FOREACH_SAFE(listed_da, &devargs_list, next, tmp) {
+       RTE_TAILQ_FOREACH_SAFE(listed_da, &devargs_list, next, tmp) {
                if (listed_da == *da)
                        /* devargs already in the list */
                        return 0;
@@ -397,7 +397,7 @@ rte_devargs_remove(struct rte_devargs *devargs)
        if (devargs == NULL || devargs->bus == NULL)
                return -1;
 
-       TAILQ_FOREACH_SAFE(d, &devargs_list, next, tmp) {
+       RTE_TAILQ_FOREACH_SAFE(d, &devargs_list, next, tmp) {
                if (strcmp(d->bus->name, devargs->bus->name) == 0 &&
                    strcmp(d->name, devargs->name) == 0) {
                        TAILQ_REMOVE(&devargs_list, d, next);
index ec8fe23..1be35f5 100644 (file)
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <regex.h>
 #include <fnmatch.h>
+#include <sys/queue.h>
 
 #include <rte_eal.h>
 #include <rte_log.h>
index eaef573..1802e3d 100644 (file)
@@ -277,7 +277,7 @@ eal_option_device_parse(void)
        void *tmp;
        int ret = 0;
 
-       TAILQ_FOREACH_SAFE(devopt, &devopt_list, next, tmp) {
+       RTE_TAILQ_FOREACH_SAFE(devopt, &devopt_list, next, tmp) {
                if (ret == 0) {
                        ret = rte_devargs_add(devopt->type, devopt->arg);
                        if (ret)
index 64cf4e8..86dab1f 100644 (file)
@@ -8,6 +8,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <sys/queue.h>
 
 #include <rte_dev.h>
 #include <rte_lcore.h>
index 627f048..9d8a690 100644 (file)
  */
 
 #include <pthread_np.h>
+#include <sys/queue.h>
+
+/* These macros are compatible with system's sys/queue.h. */
+#define RTE_TAILQ_HEAD(name, type) TAILQ_HEAD(name, type)
+#define RTE_TAILQ_ENTRY(type) TAILQ_ENTRY(type)
+#define RTE_TAILQ_FOREACH(var, head, field) TAILQ_FOREACH(var, head, field)
+#define RTE_TAILQ_FIRST(head) TAILQ_FIRST(head)
+#define RTE_TAILQ_NEXT(elem, field) TAILQ_NEXT(elem, field)
+#define RTE_STAILQ_HEAD(name, type) STAILQ_HEAD(name, type)
+#define RTE_STAILQ_ENTRY(type) STAILQ_ENTRY(type)
 
 typedef cpuset_t rte_cpuset_t;
 #define RTE_HAS_CPUSET
index 8816e40..bbbb6ef 100644 (file)
@@ -19,13 +19,12 @@ extern "C" {
 #endif
 
 #include <stdio.h>
-#include <sys/queue.h>
 
 #include <rte_log.h>
 #include <rte_dev.h>
 
 /** Double linked list of buses */
-TAILQ_HEAD(rte_bus_list, rte_bus);
+RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
 
 
 /**
@@ -260,7 +259,7 @@ typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
  * A structure describing a generic bus.
  */
 struct rte_bus {
-       TAILQ_ENTRY(rte_bus) next;   /**< Next bus object in linked list */
+       RTE_TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */
        const char *name;            /**< Name of the bus */
        rte_bus_scan_t scan;         /**< Scan for devices attached to bus */
        rte_bus_probe_t probe;       /**< Probe devices on bus */
index 856d09b..d560339 100644 (file)
 extern "C" {
 #endif
 
-#include <sys/queue.h>
-
 #include <rte_dev.h>
 
 /** Double linked list of classes */
-TAILQ_HEAD(rte_class_list, rte_class);
+RTE_TAILQ_HEAD(rte_class_list, rte_class);
 
 /**
  * A structure describing a generic device class.
  */
 struct rte_class {
-       TAILQ_ENTRY(rte_class) next; /**< Next device class in linked list */
+       RTE_TAILQ_ENTRY(rte_class) next; /**< Next device class in linked list */
        const char *name; /**< Name of the class */
        rte_dev_iterate_t dev_iterate; /**< Device iterator. */
 };
index aec7030..6c3f774 100644 (file)
@@ -18,7 +18,6 @@ extern "C" {
 #endif
 
 #include <stdio.h>
-#include <sys/queue.h>
 
 #include <rte_config.h>
 #include <rte_compat.h>
@@ -69,7 +68,7 @@ struct rte_mem_resource {
  * A structure describing a device driver.
  */
 struct rte_driver {
-       TAILQ_ENTRY(rte_driver) next;  /**< Next in list. */
+       RTE_TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
        const char *name;                   /**< Driver name. */
        const char *alias;              /**< Driver alias. */
 };
@@ -84,7 +83,7 @@ struct rte_driver {
  * A structure describing a generic device.
  */
 struct rte_device {
-       TAILQ_ENTRY(rte_device) next; /**< Next device */
+       RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
        const char *name;             /**< Device name */
        const struct rte_driver *driver; /**< Driver assigned after probing */
        const struct rte_bus *bus;    /**< Bus handle assigned on scan */
index 665f4aa..71c8af9 100644 (file)
@@ -21,7 +21,6 @@ extern "C" {
 #endif
 
 #include <stdio.h>
-#include <sys/queue.h>
 #include <rte_compat.h>
 #include <rte_bus.h>
 
@@ -70,7 +69,7 @@ enum rte_devtype {
  */
 struct rte_devargs {
        /** Next in list. */
-       TAILQ_ENTRY(rte_devargs) next;
+       RTE_TAILQ_ENTRY(rte_devargs) next;
        /** Type of device. */
        enum rte_devtype type;
        /** Device policy. */
index b706bb8..bb35234 100644 (file)
@@ -21,7 +21,6 @@ extern "C" {
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdbool.h>
-#include <sys/queue.h>
 
 #include <rte_common.h>
 #include <rte_config.h>
index c7d037d..1c9275c 100644 (file)
@@ -29,7 +29,6 @@ extern "C" {
 
 #include<stdio.h>
 #include <stdint.h>
-#include <sys/queue.h>
 
 #include <rte_config.h>
 #include <rte_lcore.h>
index b6fe4e5..0f67f9e 100644 (file)
 extern "C" {
 #endif
 
-#include <sys/queue.h>
 #include <stdio.h>
 #include <rte_debug.h>
 
 /** dummy structure type used by the rte_tailq APIs */
 struct rte_tailq_entry {
-       TAILQ_ENTRY(rte_tailq_entry) next; /**< Pointer entries for a tailq list */
+       RTE_TAILQ_ENTRY(rte_tailq_entry) next; /**< Pointer entries for a tailq list */
        void *data; /**< Pointer to the data referenced by this tailq entry */
 };
 /** dummy */
-TAILQ_HEAD(rte_tailq_entry_head, rte_tailq_entry);
+RTE_TAILQ_HEAD(rte_tailq_entry_head, rte_tailq_entry);
 
 #define RTE_TAILQ_NAMESIZE 32
 
@@ -48,7 +47,7 @@ struct rte_tailq_elem {
         * rte_eal_tailqs_init()
         */
        struct rte_tailq_head *head;
-       TAILQ_ENTRY(rte_tailq_elem) next;
+       RTE_TAILQ_ENTRY(rte_tailq_elem) next;
        const char name[RTE_TAILQ_NAMESIZE];
 };
 
@@ -126,12 +125,10 @@ RTE_INIT(tailqinitfn_ ##t) \
 }
 
 /* This macro permits both remove and free var within the loop safely.*/
-#ifndef TAILQ_FOREACH_SAFE
-#define TAILQ_FOREACH_SAFE(var, head, field, tvar)             \
-       for ((var) = TAILQ_FIRST((head));                       \
-           (var) && ((tvar) = TAILQ_NEXT((var), field), 1);    \
+#define RTE_TAILQ_FOREACH_SAFE(var, head, field, tvar) \
+       for ((var) = RTE_TAILQ_FIRST((head)); \
+           (var) && ((tvar) = RTE_TAILQ_NEXT((var), field), 1); \
            (var) = (tvar))
-#endif
 
 #ifdef __cplusplus
 }
index 1618b4d..35c07c7 100644 (file)
  */
 
 #include <sched.h>
+#include <sys/queue.h>
+
+/* These macros are compatible with system's sys/queue.h. */
+#define RTE_TAILQ_HEAD(name, type) TAILQ_HEAD(name, type)
+#define RTE_TAILQ_ENTRY(type) TAILQ_ENTRY(type)
+#define RTE_TAILQ_FOREACH(var, head, field) TAILQ_FOREACH(var, head, field)
+#define RTE_TAILQ_FIRST(head) TAILQ_FIRST(head)
+#define RTE_TAILQ_NEXT(elem, field) TAILQ_NEXT(elem, field)
+#define RTE_STAILQ_HEAD(name, type) STAILQ_HEAD(name, type)
+#define RTE_STAILQ_ENTRY(type) STAILQ_ENTRY(type)
 
 #ifdef CPU_SETSIZE /* may require _GNU_SOURCE */
 typedef cpu_set_t rte_cpuset_t;
index e5dc54e..103c1f9 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <stdatomic.h>
 #include <stdbool.h>
+#include <sys/queue.h>
 
 #include <rte_alarm.h>
 #include <rte_spinlock.h>
index 66c711d..a0a3114 100644 (file)
 extern "C" {
 #endif
 
+/* These macros are compatible with bundled sys/queue.h. */
+#define RTE_TAILQ_HEAD(name, type) \
+struct name { \
+       struct type *tqh_first; \
+       struct type **tqh_last; \
+}
+#define RTE_TAILQ_ENTRY(type) \
+struct { \
+       struct type *tqe_next; \
+       struct type **tqe_prev; \
+}
+#define RTE_TAILQ_FOREACH(var, head, field) \
+       for ((var) = RTE_TAILQ_FIRST((head)); \
+           (var); \
+           (var) = RTE_TAILQ_NEXT((var), field))
+#define RTE_TAILQ_FIRST(head) ((head)->tqh_first)
+#define RTE_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+#define RTE_STAILQ_HEAD(name, type) \
+struct name { \
+       struct type *stqh_first; \
+       struct type **stqh_last; \
+}
+#define RTE_STAILQ_ENTRY(type) \
+struct { \
+       struct type *stqe_next; \
+}
+
 /* cpu_set macros implementation */
 #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
 #define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
index 77f4680..5bf517f 100644 (file)
@@ -759,7 +759,7 @@ rte_efd_free(struct rte_efd_table *table)
        efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list);
        rte_mcfg_tailq_write_lock();
 
-       TAILQ_FOREACH_SAFE(te, efd_list, next, temp) {
+       RTE_TAILQ_FOREACH_SAFE(te, efd_list, next, temp) {
                if (te->data == (void *) table) {
                        TAILQ_REMOVE(efd_list, te, next);
                        rte_free(te);
index edf96de..d2c9ec4 100644 (file)
@@ -21,7 +21,7 @@
 
 struct rte_eth_dev_callback;
 /** @internal Structure to keep track of registered callbacks */
-TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
+RTE_TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
 
 struct rte_eth_dev;
 
index c4d6976..9c3a61c 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <stdint.h>
 #include <errno.h>
-#include <sys/queue.h>
 
 #ifdef __cplusplus
 extern "C" {
index d5a95a6..696a112 100644 (file)
@@ -2,6 +2,8 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
+#include <sys/queue.h>
+
 #include <rte_thash.h>
 #include <rte_tailq.h>
 #include <rte_random.h>
index 0bfe64b..08555fd 100644 (file)
@@ -62,7 +62,7 @@ struct ip_frag_key {
  * First two entries in the frags[] array are for the last and first fragments.
  */
 struct ip_frag_pkt {
-       TAILQ_ENTRY(ip_frag_pkt) lru;   /**< LRU list */
+       RTE_TAILQ_ENTRY(ip_frag_pkt) lru; /**< LRU list */
        struct ip_frag_key key;           /**< fragmentation key */
        uint64_t             start;       /**< creation timestamp */
        uint32_t             total_size;  /**< expected reassembled size */
@@ -83,7 +83,7 @@ struct rte_ip_frag_death_row {
        /**< mbufs to be freed */
 };
 
-TAILQ_HEAD(ip_pkt_list, ip_frag_pkt); /**< @internal fragments tailq */
+RTE_TAILQ_HEAD(ip_pkt_list, ip_frag_pkt); /**< @internal fragments tailq */
 
 /** fragmentation table statistics */
 struct ip_frag_tbl_stat {
index 59a5884..c5f859a 100644 (file)
@@ -1337,7 +1337,7 @@ void rte_mempool_walk(void (*func)(struct rte_mempool *, void *),
 
        rte_mcfg_mempool_read_lock();
 
-       TAILQ_FOREACH_SAFE(te, mempool_list, next, tmp_te) {
+       RTE_TAILQ_FOREACH_SAFE(te, mempool_list, next, tmp_te) {
                (*func)((struct rte_mempool *) te->data, arg);
        }
 
index 4235d6f..f57ecbd 100644 (file)
@@ -38,7 +38,6 @@
 #include <stdint.h>
 #include <errno.h>
 #include <inttypes.h>
-#include <sys/queue.h>
 
 #include <rte_config.h>
 #include <rte_spinlock.h>
@@ -141,7 +140,7 @@ struct rte_mempool_objsz {
  * double-frees.
  */
 struct rte_mempool_objhdr {
-       STAILQ_ENTRY(rte_mempool_objhdr) next; /**< Next in list. */
+       RTE_STAILQ_ENTRY(rte_mempool_objhdr) next; /**< Next in list. */
        struct rte_mempool *mp;          /**< The mempool owning the object. */
        rte_iova_t iova;                 /**< IO address of the object. */
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
@@ -152,7 +151,7 @@ struct rte_mempool_objhdr {
 /**
  * A list of object headers type
  */
-STAILQ_HEAD(rte_mempool_objhdr_list, rte_mempool_objhdr);
+RTE_STAILQ_HEAD(rte_mempool_objhdr_list, rte_mempool_objhdr);
 
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
 
@@ -171,7 +170,7 @@ struct rte_mempool_objtlr {
 /**
  * A list of memory where objects are stored
  */
-STAILQ_HEAD(rte_mempool_memhdr_list, rte_mempool_memhdr);
+RTE_STAILQ_HEAD(rte_mempool_memhdr_list, rte_mempool_memhdr);
 
 /**
  * Callback used to free a memory chunk
@@ -186,7 +185,7 @@ typedef void (rte_mempool_memchunk_free_cb_t)(struct rte_mempool_memhdr *memhdr,
  * and physically contiguous.
  */
 struct rte_mempool_memhdr {
-       STAILQ_ENTRY(rte_mempool_memhdr) next; /**< Next in list. */
+       RTE_STAILQ_ENTRY(rte_mempool_memhdr) next; /**< Next in list. */
        struct rte_mempool *mp;  /**< The mempool owning the chunk */
        void *addr;              /**< Virtual address of the chunk */
        rte_iova_t iova;         /**< IO address of the chunk */
index 1f33d68..71cbd44 100644 (file)
@@ -18,7 +18,6 @@ extern "C" {
 
 #include <stdio.h>
 #include <limits.h>
-#include <sys/queue.h>
 #include <inttypes.h>
 #include <sys/types.h>
 
index 16718ca..43ce1a2 100644 (file)
@@ -26,7 +26,6 @@ extern "C" {
 #include <stdio.h>
 #include <stdint.h>
 #include <string.h>
-#include <sys/queue.h>
 #include <errno.h>
 #include <rte_common.h>
 #include <rte_config.h>
index e23f230..f93e5f3 100644 (file)
@@ -16,7 +16,8 @@ extern "C" {
  */
 
 #include <stdint.h>
-#include <sys/queue.h>
+
+#include <rte_os.h>
 
 /** Match type. */
 enum rte_swx_table_match_type {
@@ -68,7 +69,7 @@ struct rte_swx_table_entry {
        /** Used to facilitate the membership of this table entry to a
         * linked list.
         */
-       TAILQ_ENTRY(rte_swx_table_entry) node;
+       RTE_TAILQ_ENTRY(rte_swx_table_entry) node;
 
        /** Key value for the current entry. Array of *key_size* bytes or NULL
         * if the *key_size* for the current table is 0.
@@ -111,7 +112,7 @@ struct rte_swx_table_entry {
 };
 
 /** List of table entries. */
-TAILQ_HEAD(rte_swx_table_entry_list, rte_swx_table_entry);
+RTE_TAILQ_HEAD(rte_swx_table_entry_list, rte_swx_table_entry);
 
 /**
  * Table memory footprint get
index 71b6a74..62988d2 100644 (file)
@@ -16,7 +16,6 @@ extern "C" {
  */
 
 #include <stdint.h>
-#include <sys/queue.h>
 
 #include <rte_compat.h>
 
@@ -56,7 +55,7 @@ struct rte_swx_table_selector_params {
 /** Group member parameters. */
 struct rte_swx_table_selector_member {
        /** Linked list connectivity. */
-       TAILQ_ENTRY(rte_swx_table_selector_member) node;
+       RTE_TAILQ_ENTRY(rte_swx_table_selector_member) node;
 
        /** Member ID. */
        uint32_t member_id;
@@ -66,7 +65,7 @@ struct rte_swx_table_selector_member {
 };
 
 /** List of group members. */
-TAILQ_HEAD(rte_swx_table_selector_member_list, rte_swx_table_selector_member);
+RTE_TAILQ_HEAD(rte_swx_table_selector_member_list, rte_swx_table_selector_member);
 
 /** Group parameters. */
 struct rte_swx_table_selector_group {
index e0b6772..e4a445e 100644 (file)
@@ -32,7 +32,7 @@ vhost_user_iotlb_pending_remove_all(struct vhost_virtqueue *vq)
 
        rte_rwlock_write_lock(&vq->iotlb_pending_lock);
 
-       TAILQ_FOREACH_SAFE(node, &vq->iotlb_pending_list, next, temp_node) {
+       RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_pending_list, next, temp_node) {
                TAILQ_REMOVE(&vq->iotlb_pending_list, node, next);
                rte_mempool_put(vq->iotlb_pool, node);
        }
@@ -100,7 +100,8 @@ vhost_user_iotlb_pending_remove(struct vhost_virtqueue *vq,
 
        rte_rwlock_write_lock(&vq->iotlb_pending_lock);
 
-       TAILQ_FOREACH_SAFE(node, &vq->iotlb_pending_list, next, temp_node) {
+       RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_pending_list, next,
+                               temp_node) {
                if (node->iova < iova)
                        continue;
                if (node->iova >= iova + size)
@@ -121,7 +122,7 @@ vhost_user_iotlb_cache_remove_all(struct vhost_virtqueue *vq)
 
        rte_rwlock_write_lock(&vq->iotlb_lock);
 
-       TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
+       RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
                TAILQ_REMOVE(&vq->iotlb_list, node, next);
                rte_mempool_put(vq->iotlb_pool, node);
        }
@@ -141,7 +142,7 @@ vhost_user_iotlb_cache_random_evict(struct vhost_virtqueue *vq)
 
        entry_idx = rte_rand() % vq->iotlb_cache_nr;
 
-       TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
+       RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
                if (!entry_idx) {
                        TAILQ_REMOVE(&vq->iotlb_list, node, next);
                        rte_mempool_put(vq->iotlb_pool, node);
@@ -218,7 +219,7 @@ vhost_user_iotlb_cache_remove(struct vhost_virtqueue *vq,
 
        rte_rwlock_write_lock(&vq->iotlb_lock);
 
-       TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
+       RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
                /* Sorted list */
                if (unlikely(iova + size < node->iova))
                        break;
index bfada38..b0f4948 100644 (file)
@@ -71,7 +71,7 @@ struct rte_vdpa_dev_ops {
  * vdpa device structure includes device address and device operations.
  */
 struct rte_vdpa_device {
-       TAILQ_ENTRY(rte_vdpa_device) next;
+       RTE_TAILQ_ENTRY(rte_vdpa_device) next;
        /** Generic device information */
        struct rte_device *device;
        /** vdpa device operations */
index 99a926a..6dd9185 100644 (file)
@@ -115,7 +115,7 @@ rte_vdpa_unregister_device(struct rte_vdpa_device *dev)
        int ret = -1;
 
        rte_spinlock_lock(&vdpa_device_list_lock);
-       TAILQ_FOREACH_SAFE(cur_dev, &vdpa_device_list, next, tmp_dev) {
+       RTE_TAILQ_FOREACH_SAFE(cur_dev, &vdpa_device_list, next, tmp_dev) {
                if (dev != cur_dev)
                        continue;