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)
commitf1f6ebc0eaf68a825c6175f5e6a436f7d91660c3
tree4ad60c2547f4c4c926c128680f9ea2e84bbfdc72
parent6787d0af945e880a553d571ff4b09b6d5c2a2338
eal: remove sys/queue.h from public headers

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