* [RFC 00/47] resolve issues with sys/queue.h
@ 2025-08-18 23:27 Stephen Hemminger
2025-08-18 23:27 ` [RFC 01/47] eal: add BSD version of queue.h Stephen Hemminger
` (46 more replies)
0 siblings, 47 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
This patchset cleans up the queue.h macro problems in DPDK.
The root cause is that sys/queue.h in Linux is an old version
from early BSD; my best guess is that it is a BSD GPL license
issue that it never got updated. The Linux version is missing
several useful macros which leads to redefiniton, bugs, etc.
The patch starts out by introducing a version of the current
FreeBSD queue.h named as bsd_queue.h, then uses it across all
of DPDK. The file sys/queue.h is no longer used.
Ends up doing one line change on lots of files.
Stephen Hemminger (47):
eal: add BSD version of queue.h
net/nfp: fix use after free
eal: use bsd_queue.h
test: remove unnecessary inclusion of sys/queue.h
testpmd: use bsd_queue.h
dumpcap: use bsd_queue.h
proc-info: remove unnecessary sys/queue.h
doc: suggest bsd_queue.h
test-pipeline: remove unnecessary use of sys/queue.h
test-eventdev: use bsd_queue.h
test-bbdev, test-cmdline, test-mldev: don't use sys/queue.h
examples: replace use of sys/queue.h
hash: do not include sys/queue.h
lpm: do not include sys/queue.h
log: replace use of sys/queue.h
ethdev: replace use of sys/queue.h
bpf: replace use of sys/queue.h
mempool: do not need sys/queue.h
lib: remove use of sys/queue.h
bus/fslmc: use rte_tailq.h
drivers/bus: replace use of sys/queue.h
net/qede: use bsd_queue.h
net/bnxt: remove use of sys/queue.h
net/intel: remove use of sys/queue.h
net/mlx5: remove unnecessary include of sys/queue.h
net/tap: remove unnecessary include of sys/queue.h
net/axgbe: replace use of sys/queue.h
net/bnx2x: replace use of sys/queue.h
net/bonding: replace use of sys/queue.h
net/cxgbe: replace use of sys/queue.h
net/enic: replace use of sys/queue.h
net/failsafe: replace use of sys/queue.h
net/memif: replace use of sys/queue.h
net/mlx4: replace use of sys/queue.h
net/ngbe: replace use of sys/queue.h
net/ntnic: replace use of sys/queue.h
net/sfc: replace use of sys/queue.h
net/softnic: replace use of sys/queue.h
net/thunderx: replace use of sys/queue.h
net/txgbe: replace use of sys/queue.h
net/vdev_netvsc: replace use of sys/queue.h
net/vmxnet3: replace use of sys/queue.h
net/zxdh: replace use of sys/queue.h
net/dpaa2: replace use of sys/queue.h
eal: remove no longer used windows version of queue.h
net/mvpp2: replace local definition of FOREACH_SAFE
drivers/raw: replace with TAILQ_FOREACH_SAFE
app/dumpcap/main.c | 2 +-
app/proc-info/main.c | 1 -
app/test-bbdev/main.h | 1 -
app/test-cmdline/cmdline_test.c | 1 -
app/test-eventdev/evt_test.c | 2 +-
app/test-eventdev/evt_test.h | 1 -
app/test-mldev/ml_test.h | 1 -
app/test-pipeline/config.c | 1 -
app/test-pipeline/init.c | 1 -
app/test-pipeline/main.c | 1 -
app/test-pipeline/runtime.c | 1 -
app/test-pmd/5tswap.c | 2 -
app/test-pmd/cmdline.c | 2 +-
app/test-pmd/config.c | 2 +-
app/test-pmd/csumonly.c | 1 -
app/test-pmd/flowgen.c | 1 -
app/test-pmd/hairpin.c | 1 -
app/test-pmd/icmpecho.c | 1 -
app/test-pmd/iofwd.c | 1 -
app/test-pmd/macfwd.c | 1 -
app/test-pmd/macswap.c | 1 -
app/test-pmd/noisy_vnf.c | 1 -
app/test-pmd/parameters.c | 1 -
app/test-pmd/rxonly.c | 1 -
app/test-pmd/testpmd.c | 1 -
app/test-pmd/testpmd.h | 2 +-
app/test-pmd/txonly.c | 1 -
app/test/commands.c | 2 +-
app/test/test.c | 1 -
app/test/test.h | 2 +-
app/test/test_atomic.c | 1 -
app/test/test_cmdline_lib.c | 1 -
app/test/test_func_reentrancy.c | 1 -
app/test/test_hash.c | 1 -
app/test/test_hash_functions.c | 1 -
app/test/test_link_bonding.c | 1 -
app/test/test_link_bonding_mode4.c | 1 -
app/test/test_link_bonding_rssconf.c | 1 -
app/test/test_logs.c | 1 -
app/test/test_malloc.c | 1 -
app/test/test_mbuf.c | 1 -
app/test/test_mcslock.c | 1 -
app/test/test_mempool.c | 1 -
app/test/test_mempool_perf.c | 1 -
app/test/test_memzone.c | 1 -
app/test/test_mp_secondary.c | 1 -
app/test/test_per_lcore.c | 1 -
app/test/test_pflock.c | 1 -
app/test/test_ring.c | 1 -
app/test/test_rwlock.c | 1 -
app/test/test_soring.c | 1 -
app/test/test_spinlock.c | 1 -
app/test/test_tailq.c | 1 -
app/test/test_ticketlock.c | 1 -
app/test/test_timer.c | 1 -
doc/guides/contributing/coding_style.rst | 4 +-
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 -
drivers/net/axgbe/axgbe_common.h | 1 -
drivers/net/bnx2x/bnx2x_ethdev.h | 1 -
drivers/net/bnxt/bnxt.h | 1 -
drivers/net/bnxt/bnxt_filter.c | 7 +-
drivers/net/bnxt/bnxt_flow.c | 1 -
drivers/net/bnxt/bnxt_vnic.h | 1 -
drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 1 -
drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c | 1 -
drivers/net/bonding/eth_bond_private.h | 1 -
drivers/net/bonding/rte_eth_bond_flow.c | 1 -
drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 1 -
drivers/net/cxgbe/sge.c | 1 -
drivers/net/dpaa2/dpaa2_flow.c | 1 -
drivers/net/dpaa2/dpaa2_mux.c | 1 -
drivers/net/dpaa2/dpaa2_ptp.c | 1 -
drivers/net/enic/enic.h | 1 -
drivers/net/failsafe/failsafe_flow.c | 1 -
drivers/net/failsafe/failsafe_private.h | 2 +-
drivers/net/intel/cpfl/cpfl_flow_engine_fxp.c | 1 -
drivers/net/intel/e1000/e1000_ethdev.h | 1 -
drivers/net/intel/e1000/em_ethdev.c | 1 -
drivers/net/intel/e1000/em_rxtx.c | 1 -
drivers/net/intel/e1000/igb_ethdev.c | 2 +-
drivers/net/intel/e1000/igb_flow.c | 2 +-
drivers/net/intel/e1000/igb_rxtx.c | 1 -
drivers/net/intel/i40e/i40e_ethdev.c | 9 +-
drivers/net/intel/i40e/i40e_ethdev.h | 1 -
drivers/net/intel/i40e/i40e_fdir.c | 2 +-
drivers/net/intel/i40e/i40e_flow.c | 1 -
drivers/net/intel/i40e/i40e_hash.c | 1 -
drivers/net/intel/i40e/i40e_pf.c | 1 -
drivers/net/intel/i40e/i40e_rxtx.c | 1 -
drivers/net/intel/iavf/iavf.h | 1 -
drivers/net/intel/iavf/iavf_ethdev.c | 1 -
drivers/net/intel/iavf/iavf_fdir.c | 1 -
drivers/net/intel/iavf/iavf_fsub.c | 1 -
drivers/net/intel/iavf/iavf_generic_flow.c | 1 -
drivers/net/intel/iavf/iavf_hash.c | 1 -
drivers/net/intel/iavf/iavf_rxtx.c | 1 -
drivers/net/intel/iavf/iavf_vchnl.c | 7 -
drivers/net/intel/ice/base/ice_osdep.h | 2 +-
drivers/net/intel/ice/ice_acl_filter.c | 1 -
drivers/net/intel/ice/ice_dcf.c | 2 +-
drivers/net/intel/ice/ice_dcf_ethdev.c | 1 -
drivers/net/intel/ice/ice_ethdev.c | 8 +-
drivers/net/intel/ice/ice_generic_flow.c | 1 -
drivers/net/intel/ice/ice_hash.c | 1 -
drivers/net/intel/ice/ice_switch_filter.c | 1 -
drivers/net/intel/idpf/base/idpf_osdep.h | 9 +-
drivers/net/intel/ipn3ke/ipn3ke_ethdev.h | 1 -
drivers/net/intel/ipn3ke/ipn3ke_flow.c | 1 -
drivers/net/intel/ixgbe/ixgbe_ethdev.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_ethdev.h | 1 -
drivers/net/intel/ixgbe/ixgbe_fdir.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_flow.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_rxtx.c | 1 -
drivers/net/memif/memif_socket.h | 1 -
drivers/net/memif/rte_eth_memif.h | 1 -
drivers/net/mlx4/mlx4.h | 1 -
drivers/net/mlx4/mlx4_flow.c | 2 +-
drivers/net/mlx4/mlx4_flow.h | 1 -
drivers/net/mlx4/mlx4_mr.h | 1 -
drivers/net/mlx4/mlx4_rxtx.h | 1 -
drivers/net/mlx5/hws/mlx5dr_internal.h | 1 -
drivers/net/mlx5/linux/mlx5_verbs.c | 1 -
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_devx.c | 1 -
drivers/net/mlx5/mlx5_flow.c | 2 +-
drivers/net/mlx5/mlx5_flow.h | 2 +-
drivers/net/mlx5/mlx5_flow_dv.c | 1 -
drivers/net/mlx5/mlx5_flow_verbs.c | 2 +-
drivers/net/mlx5/mlx5_rx.h | 1 -
drivers/net/mlx5/mlx5_rxq.c | 2 +-
drivers/net/mlx5/mlx5_rxtx.h | 1 -
drivers/net/mlx5/mlx5_tx.h | 1 -
drivers/net/mvpp2/mrvl_mtr.c | 8 +-
drivers/net/nfp/nfp_mtr.c | 12 +-
drivers/net/ngbe/ngbe_ethdev_vf.c | 1 -
drivers/net/ngbe/ngbe_rxtx.c | 1 -
drivers/net/ntnic/ntnic_ethdev.c | 1 -
drivers/net/qede/qede_ethdev.h | 3 +-
drivers/net/qede/qede_filter.c | 6 -
drivers/net/sfc/sfc_dp.c | 2 +-
drivers/net/sfc/sfc_dp.h | 1 -
.../net/softnic/rte_eth_softnic_internals.h | 1 -
drivers/net/tap/rte_eth_tap.h | 1 -
drivers/net/tap/tap_flow.c | 1 -
drivers/net/thunderx/base/nicvf_bsvf.h | 2 +-
drivers/net/thunderx/base/nicvf_plat.h | 1 +
drivers/net/thunderx/nicvf_ethdev.c | 1 -
drivers/net/txgbe/txgbe_ethdev_vf.c | 1 -
drivers/net/txgbe/txgbe_fdir.c | 2 +-
drivers/net/txgbe/txgbe_flow.c | 2 +-
drivers/net/txgbe/txgbe_rxtx.c | 1 -
drivers/net/vdev_netvsc/vdev_netvsc.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 -
drivers/net/vmxnet3/vmxnet3_rxtx.c | 1 -
drivers/net/zxdh/zxdh_mtr.h | 1 -
drivers/raw/ifpga/base/ifpga_enumerate.c | 6 +-
drivers/raw/ifpga/base/opae_intel_max10.c | 8 +-
examples/bbdev_app/main.c | 2 +-
examples/bond/main.c | 2 +-
examples/cmdline/main.c | 1 -
examples/cmdline/parse_obj_list.h | 2 +-
examples/flow_filtering/main.c | 1 -
examples/helloworld/main.c | 2 +-
examples/ip_fragmentation/main.c | 2 +-
examples/ip_pipeline/action.h | 2 +-
examples/ip_pipeline/cryptodev.h | 2 +-
examples/ip_pipeline/link.h | 2 +-
examples/ip_pipeline/mempool.h | 2 +-
examples/ip_pipeline/pipeline.h | 2 +-
examples/ip_pipeline/swq.h | 2 +-
examples/ip_pipeline/tap.h | 2 +-
examples/ip_pipeline/tmgr.h | 2 +-
examples/ip_reassembly/main.c | 2 +-
examples/ipsec-secgw/ipsec-secgw.c | 2 +-
examples/ipv4_multicast/main.c | 2 +-
examples/l2fwd-crypto/main.c | 2 +-
examples/l2fwd-event/l2fwd_common.h | 1 -
examples/l2fwd-keepalive/ka-agent/main.c | 1 -
examples/l2fwd-keepalive/main.c | 2 +-
examples/l2fwd-macsec/main.c | 2 +-
examples/l2fwd/main.c | 2 +-
examples/l3fwd-graph/main.c | 2 +-
examples/l3fwd-power/main.c | 2 +-
examples/l3fwd/l3fwd_em.c | 1 -
examples/l3fwd/l3fwd_lpm.c | 1 -
examples/l3fwd/main.c | 2 +-
examples/link_status_interrupt/main.c | 2 +-
.../client_server_mp/mp_client/client.c | 1 -
.../client_server_mp/mp_server/init.c | 1 -
.../client_server_mp/mp_server/main.c | 2 +-
examples/multi_process/hotplug_mp/main.c | 1 -
examples/multi_process/simple_mp/main.c | 2 +-
examples/multi_process/symmetric_mp/main.c | 2 +-
examples/server_node_efd/efd_node/node.c | 1 -
examples/server_node_efd/efd_server/init.c | 1 -
examples/server_node_efd/efd_server/main.c | 1 -
examples/service_cores/main.c | 1 -
examples/timer/main.c | 2 +-
examples/vhost/main.h | 2 +-
examples/vm_power_manager/channel_manager.c | 2 +-
examples/vm_power_manager/channel_monitor.c | 2 +-
examples/vm_power_manager/main.c | 2 +-
examples/vmdq/main.c | 2 +-
examples/vmdq_dcb/main.c | 2 +-
lib/acl/rte_acl_osdep.h | 1 -
lib/bbdev/rte_bbdev.c | 2 +-
lib/bpf/bpf_load_elf.c | 1 -
lib/bpf/bpf_pkt.c | 3 +-
lib/cryptodev/cryptodev_pmd.c | 1 -
lib/cryptodev/rte_cryptodev.c | 1 -
lib/distributor/rte_distributor.c | 2 +-
lib/distributor/rte_distributor_single.c | 2 +-
lib/eal/common/eal_common_bus.c | 2 +-
lib/eal/common/eal_common_class.c | 2 +-
lib/eal/common/eal_common_dev.c | 2 +-
lib/eal/common/eal_common_tailqs.c | 2 +-
lib/eal/common/eal_common_trace.c | 2 +-
lib/eal/common/eal_private.h | 2 +-
lib/eal/common/malloc_elem.c | 2 +-
lib/eal/common/malloc_heap.c | 2 +-
lib/eal/common/malloc_heap.h | 2 +-
lib/eal/common/rte_malloc.c | 2 +-
lib/eal/freebsd/eal.c | 2 +-
lib/eal/freebsd/eal_interrupts.c | 2 +-
lib/eal/freebsd/eal_thread.c | 2 +-
lib/eal/freebsd/include/rte_os.h | 6 +-
.../sys/queue.h => include/bsd_queue.h} | 683 ++++++++++++------
lib/eal/linux/eal_alarm.c | 2 +-
lib/eal/linux/eal_interrupts.c | 2 +-
lib/eal/linux/include/rte_os.h | 3 +-
lib/eal/windows/eal_alarm.c | 2 +-
lib/efd/rte_efd.c | 1 -
lib/ethdev/ethdev_private.h | 3 +-
lib/ethdev/rte_ethdev.c | 2 +-
lib/fib/rte_fib.c | 1 -
lib/fib/rte_fib6.c | 1 -
lib/gpudev/gpudev_driver.h | 1 -
lib/graph/graph_private.h | 1 -
lib/hash/rte_cuckoo_hash.c | 1 -
lib/hash/rte_fbk_hash.c | 1 -
lib/hash/rte_thash.c | 1 -
lib/ip_frag/ip_frag_common.h | 3 +-
lib/log/log.c | 2 +-
lib/lpm/rte_lpm.c | 1 -
lib/lpm/rte_lpm6.c | 1 -
lib/mbuf/rte_mbuf_dyn.c | 1 -
lib/mempool/rte_mempool.c | 1 -
lib/pipeline/rte_swx_ctl.c | 1 -
lib/pipeline/rte_swx_pipeline_internal.h | 3 +-
lib/pmu/pmu.c | 1 -
lib/reorder/rte_reorder.c | 1 -
lib/rib/rte_rib.c | 1 -
lib/rib/rte_rib6.c | 1 -
lib/ring/rte_ring.c | 1 -
lib/stack/rte_stack.c | 1 -
lib/vhost/fd_man.h | 1 -
lib/vhost/socket.c | 2 +-
lib/vhost/vdpa.c | 2 -
lib/vhost/vhost.h | 2 +-
273 files changed, 589 insertions(+), 562 deletions(-)
rename lib/eal/{windows/include/sys/queue.h => include/bsd_queue.h} (52%)
--
2.47.2
Stephen Hemminger (47):
eal: add BSD version of queue.h
net/nfp: fix use after free
eal: use bsd_queue.h
test: remove unnecessary inclusion of sys/queue.h
testpmd: use bsd_queue.h
dumpcap: use bsd_queue.h
proc-info: remove unnecessary sys/queue.h
doc: suggest bsd_queue.h
test-pipeline: remove unnecessary use of sys/queue.h
test-eventdev: use bsd_queue.h
test-bbdev, test-cmdline, test-mldev: don't use sys/queue.h
examples: replace use of sys/queue.h
hash: do not include sys/queue.h
lpm: do not include sys/queue.h
log: replace use of sys/queue.h
ethdev: replace use of sys/queue.h
bpf: replace use of sys/queue.h
mempool: do not need sys/queue.h
lib: remove use of sys/queue.h
bus/fslmc: use rte_tailq.h
drivers/bus: replace use of sys/queue.h
net/qede: use bsd_queue.h
net/bnxt: remove use of sys/queue.h
net/intel: remove use of sys/queue.h
net/mlx5: remove unnecessary include of sys/queue.h
net/tap: remove unnecessary include of sys/queue.h
net/axgbe: replace use of sys/queue.h
net/bnx2x: replace use of sys/queue.h
net/bonding: replace use of sys/queue.h
net/cxgbe: replace use of sys/queue.h
net/enic: replace use of sys/queue.h
net/failsafe: replace use of sys/queue.h
net/memif: replace use of sys/queue.h
net/mlx4: replace use of sys/queue.h
net/ngbe: replace use of sys/queue.h
net/ntnic: replace use of sys/queue.h
net/sfc: replace use of sys/queue.h
net/softnic: replace use of sys/queue.h
net/thunderx: replace use of sys/queue.h
net/txgbe: replace use of sys/queue.h
net/vdev_netvsc: replace use of sys/queue.h
net/vmxnet3: replace use of sys/queue.h
net/zxdh: replace use of sys/queue.h
net/dpaa2: replace use of sys/queue.h
eal: remove no longer used windows version of queue.h
net/mvpp2: replace local definition of FOREACH_SAFE
drivers/raw: replace with TAILQ_FOREACH_SAFE
app/dumpcap/main.c | 2 +-
app/proc-info/main.c | 1 -
app/test-bbdev/main.h | 1 -
app/test-cmdline/cmdline_test.c | 1 -
app/test-eventdev/evt_test.c | 2 +-
app/test-eventdev/evt_test.h | 1 -
app/test-mldev/ml_test.h | 1 -
app/test-pipeline/config.c | 1 -
app/test-pipeline/init.c | 1 -
app/test-pipeline/main.c | 1 -
app/test-pipeline/runtime.c | 1 -
app/test-pmd/5tswap.c | 2 -
app/test-pmd/cmdline.c | 2 +-
app/test-pmd/config.c | 2 +-
app/test-pmd/csumonly.c | 1 -
app/test-pmd/flowgen.c | 1 -
app/test-pmd/hairpin.c | 1 -
app/test-pmd/icmpecho.c | 1 -
app/test-pmd/iofwd.c | 1 -
app/test-pmd/macfwd.c | 1 -
app/test-pmd/macswap.c | 1 -
app/test-pmd/noisy_vnf.c | 1 -
app/test-pmd/parameters.c | 1 -
app/test-pmd/rxonly.c | 1 -
app/test-pmd/testpmd.c | 1 -
app/test-pmd/testpmd.h | 2 +-
app/test-pmd/txonly.c | 1 -
app/test/commands.c | 2 +-
app/test/test.c | 1 -
app/test/test.h | 2 +-
app/test/test_atomic.c | 1 -
app/test/test_cmdline_lib.c | 1 -
app/test/test_func_reentrancy.c | 1 -
app/test/test_hash.c | 1 -
app/test/test_hash_functions.c | 1 -
app/test/test_link_bonding.c | 1 -
app/test/test_link_bonding_mode4.c | 1 -
app/test/test_link_bonding_rssconf.c | 1 -
app/test/test_logs.c | 1 -
app/test/test_malloc.c | 1 -
app/test/test_mbuf.c | 1 -
app/test/test_mcslock.c | 1 -
app/test/test_mempool.c | 1 -
app/test/test_mempool_perf.c | 1 -
app/test/test_memzone.c | 1 -
app/test/test_mp_secondary.c | 1 -
app/test/test_per_lcore.c | 1 -
app/test/test_pflock.c | 1 -
app/test/test_ring.c | 1 -
app/test/test_rwlock.c | 1 -
app/test/test_soring.c | 1 -
app/test/test_spinlock.c | 1 -
app/test/test_tailq.c | 1 -
app/test/test_ticketlock.c | 1 -
app/test/test_timer.c | 1 -
doc/guides/contributing/coding_style.rst | 4 +-
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 -
drivers/net/axgbe/axgbe_common.h | 1 -
drivers/net/bnx2x/bnx2x_ethdev.h | 1 -
drivers/net/bnxt/bnxt.h | 1 -
drivers/net/bnxt/bnxt_filter.c | 7 +-
drivers/net/bnxt/bnxt_flow.c | 1 -
drivers/net/bnxt/bnxt_vnic.h | 1 -
drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 1 -
drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c | 1 -
drivers/net/bonding/eth_bond_private.h | 1 -
drivers/net/bonding/rte_eth_bond_flow.c | 1 -
drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 1 -
drivers/net/cxgbe/sge.c | 1 -
drivers/net/dpaa2/dpaa2_flow.c | 1 -
drivers/net/dpaa2/dpaa2_mux.c | 1 -
drivers/net/dpaa2/dpaa2_ptp.c | 1 -
drivers/net/enic/enic.h | 1 -
drivers/net/failsafe/failsafe_flow.c | 1 -
drivers/net/failsafe/failsafe_private.h | 2 +-
drivers/net/intel/cpfl/cpfl_flow_engine_fxp.c | 1 -
drivers/net/intel/e1000/e1000_ethdev.h | 1 -
drivers/net/intel/e1000/em_ethdev.c | 1 -
drivers/net/intel/e1000/em_rxtx.c | 1 -
drivers/net/intel/e1000/igb_ethdev.c | 2 +-
drivers/net/intel/e1000/igb_flow.c | 2 +-
drivers/net/intel/e1000/igb_rxtx.c | 1 -
drivers/net/intel/i40e/i40e_ethdev.c | 9 +-
drivers/net/intel/i40e/i40e_ethdev.h | 1 -
drivers/net/intel/i40e/i40e_fdir.c | 2 +-
drivers/net/intel/i40e/i40e_flow.c | 1 -
drivers/net/intel/i40e/i40e_hash.c | 1 -
drivers/net/intel/i40e/i40e_pf.c | 1 -
drivers/net/intel/i40e/i40e_rxtx.c | 1 -
drivers/net/intel/iavf/iavf.h | 1 -
drivers/net/intel/iavf/iavf_ethdev.c | 1 -
drivers/net/intel/iavf/iavf_fdir.c | 1 -
drivers/net/intel/iavf/iavf_fsub.c | 1 -
drivers/net/intel/iavf/iavf_generic_flow.c | 1 -
drivers/net/intel/iavf/iavf_hash.c | 1 -
drivers/net/intel/iavf/iavf_rxtx.c | 1 -
drivers/net/intel/iavf/iavf_vchnl.c | 7 -
drivers/net/intel/ice/base/ice_osdep.h | 2 +-
drivers/net/intel/ice/ice_acl_filter.c | 1 -
drivers/net/intel/ice/ice_dcf.c | 2 +-
drivers/net/intel/ice/ice_dcf_ethdev.c | 1 -
drivers/net/intel/ice/ice_ethdev.c | 8 +-
drivers/net/intel/ice/ice_generic_flow.c | 1 -
drivers/net/intel/ice/ice_hash.c | 1 -
drivers/net/intel/ice/ice_switch_filter.c | 1 -
drivers/net/intel/idpf/base/idpf_osdep.h | 9 +-
drivers/net/intel/ipn3ke/ipn3ke_ethdev.h | 1 -
drivers/net/intel/ipn3ke/ipn3ke_flow.c | 1 -
drivers/net/intel/ixgbe/ixgbe_ethdev.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_ethdev.h | 1 -
drivers/net/intel/ixgbe/ixgbe_fdir.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_flow.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_rxtx.c | 1 -
drivers/net/memif/memif_socket.h | 1 -
drivers/net/memif/rte_eth_memif.h | 1 -
drivers/net/mlx4/mlx4.h | 1 -
drivers/net/mlx4/mlx4_flow.c | 2 +-
drivers/net/mlx4/mlx4_flow.h | 1 -
drivers/net/mlx4/mlx4_mr.h | 1 -
drivers/net/mlx4/mlx4_rxtx.h | 1 -
drivers/net/mlx5/hws/mlx5dr_internal.h | 1 -
drivers/net/mlx5/linux/mlx5_verbs.c | 1 -
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_devx.c | 1 -
drivers/net/mlx5/mlx5_flow.c | 2 +-
drivers/net/mlx5/mlx5_flow.h | 2 +-
drivers/net/mlx5/mlx5_flow_dv.c | 1 -
drivers/net/mlx5/mlx5_flow_verbs.c | 2 +-
drivers/net/mlx5/mlx5_rx.h | 1 -
drivers/net/mlx5/mlx5_rxq.c | 2 +-
drivers/net/mlx5/mlx5_rxtx.h | 1 -
drivers/net/mlx5/mlx5_tx.h | 1 -
drivers/net/mvpp2/mrvl_mtr.c | 8 +-
drivers/net/nfp/nfp_mtr.c | 12 +-
drivers/net/ngbe/ngbe_ethdev_vf.c | 1 -
drivers/net/ngbe/ngbe_rxtx.c | 1 -
drivers/net/ntnic/ntnic_ethdev.c | 1 -
drivers/net/qede/qede_ethdev.h | 3 +-
drivers/net/qede/qede_filter.c | 6 -
drivers/net/sfc/sfc_dp.c | 2 +-
drivers/net/sfc/sfc_dp.h | 1 -
.../net/softnic/rte_eth_softnic_internals.h | 1 -
drivers/net/tap/rte_eth_tap.h | 1 -
drivers/net/tap/tap_flow.c | 1 -
drivers/net/thunderx/base/nicvf_bsvf.h | 2 +-
drivers/net/thunderx/base/nicvf_plat.h | 1 +
drivers/net/thunderx/nicvf_ethdev.c | 1 -
drivers/net/txgbe/txgbe_ethdev_vf.c | 1 -
drivers/net/txgbe/txgbe_fdir.c | 2 +-
drivers/net/txgbe/txgbe_flow.c | 2 +-
drivers/net/txgbe/txgbe_rxtx.c | 1 -
drivers/net/vdev_netvsc/vdev_netvsc.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 -
drivers/net/vmxnet3/vmxnet3_rxtx.c | 1 -
drivers/net/zxdh/zxdh_mtr.h | 1 -
drivers/raw/ifpga/base/ifpga_enumerate.c | 6 +-
drivers/raw/ifpga/base/opae_intel_max10.c | 8 +-
examples/bbdev_app/main.c | 2 +-
examples/bond/main.c | 2 +-
examples/cmdline/main.c | 1 -
examples/cmdline/parse_obj_list.h | 2 +-
examples/flow_filtering/main.c | 1 -
examples/helloworld/main.c | 2 +-
examples/ip_fragmentation/main.c | 2 +-
examples/ip_pipeline/action.h | 2 +-
examples/ip_pipeline/cryptodev.h | 2 +-
examples/ip_pipeline/link.h | 2 +-
examples/ip_pipeline/mempool.h | 2 +-
examples/ip_pipeline/pipeline.h | 2 +-
examples/ip_pipeline/swq.h | 2 +-
examples/ip_pipeline/tap.h | 2 +-
examples/ip_pipeline/tmgr.h | 2 +-
examples/ip_reassembly/main.c | 2 +-
examples/ipsec-secgw/ipsec-secgw.c | 2 +-
examples/ipv4_multicast/main.c | 2 +-
examples/l2fwd-crypto/main.c | 2 +-
examples/l2fwd-event/l2fwd_common.h | 1 -
examples/l2fwd-keepalive/ka-agent/main.c | 1 -
examples/l2fwd-keepalive/main.c | 2 +-
examples/l2fwd-macsec/main.c | 2 +-
examples/l2fwd/main.c | 2 +-
examples/l3fwd-graph/main.c | 2 +-
examples/l3fwd-power/main.c | 2 +-
examples/l3fwd/l3fwd_em.c | 1 -
examples/l3fwd/l3fwd_lpm.c | 1 -
examples/l3fwd/main.c | 2 +-
examples/link_status_interrupt/main.c | 2 +-
.../client_server_mp/mp_client/client.c | 1 -
.../client_server_mp/mp_server/init.c | 1 -
.../client_server_mp/mp_server/main.c | 2 +-
examples/multi_process/hotplug_mp/main.c | 1 -
examples/multi_process/simple_mp/main.c | 2 +-
examples/multi_process/symmetric_mp/main.c | 2 +-
examples/server_node_efd/efd_node/node.c | 1 -
examples/server_node_efd/efd_server/init.c | 1 -
examples/server_node_efd/efd_server/main.c | 1 -
examples/service_cores/main.c | 1 -
examples/timer/main.c | 2 +-
examples/vhost/main.h | 2 +-
examples/vm_power_manager/channel_manager.c | 2 +-
examples/vm_power_manager/channel_monitor.c | 2 +-
examples/vm_power_manager/main.c | 2 +-
examples/vmdq/main.c | 2 +-
examples/vmdq_dcb/main.c | 2 +-
lib/acl/rte_acl_osdep.h | 1 -
lib/bbdev/rte_bbdev.c | 2 +-
lib/bpf/bpf_load_elf.c | 1 -
lib/bpf/bpf_pkt.c | 3 +-
lib/cryptodev/cryptodev_pmd.c | 1 -
lib/cryptodev/rte_cryptodev.c | 1 -
lib/distributor/rte_distributor.c | 2 +-
lib/distributor/rte_distributor_single.c | 2 +-
lib/eal/common/eal_common_bus.c | 2 +-
lib/eal/common/eal_common_class.c | 2 +-
lib/eal/common/eal_common_dev.c | 2 +-
lib/eal/common/eal_common_tailqs.c | 2 +-
lib/eal/common/eal_common_trace.c | 2 +-
lib/eal/common/eal_private.h | 2 +-
lib/eal/common/malloc_elem.c | 2 +-
lib/eal/common/malloc_heap.c | 2 +-
lib/eal/common/malloc_heap.h | 2 +-
lib/eal/common/rte_malloc.c | 2 +-
lib/eal/freebsd/eal.c | 2 +-
lib/eal/freebsd/eal_interrupts.c | 2 +-
lib/eal/freebsd/eal_thread.c | 2 +-
lib/eal/freebsd/include/rte_os.h | 6 +-
.../sys/queue.h => include/bsd_queue.h} | 683 ++++++++++++------
lib/eal/include/meson.build | 1 +
lib/eal/linux/eal_alarm.c | 2 +-
lib/eal/linux/eal_interrupts.c | 2 +-
lib/eal/linux/include/rte_os.h | 3 +-
lib/eal/windows/eal_alarm.c | 2 +-
lib/efd/rte_efd.c | 1 -
lib/ethdev/ethdev_private.h | 3 +-
lib/ethdev/rte_ethdev.c | 2 +-
lib/fib/rte_fib.c | 1 -
lib/fib/rte_fib6.c | 1 -
lib/gpudev/gpudev_driver.h | 1 -
lib/graph/graph_private.h | 1 -
lib/hash/rte_cuckoo_hash.c | 1 -
lib/hash/rte_fbk_hash.c | 1 -
lib/hash/rte_thash.c | 1 -
lib/ip_frag/ip_frag_common.h | 3 +-
lib/log/log.c | 2 +-
lib/lpm/rte_lpm.c | 1 -
lib/lpm/rte_lpm6.c | 1 -
lib/mbuf/rte_mbuf_dyn.c | 1 -
lib/mempool/rte_mempool.c | 1 -
lib/pipeline/rte_swx_ctl.c | 1 -
lib/pipeline/rte_swx_pipeline_internal.h | 3 +-
lib/pmu/pmu.c | 1 -
lib/reorder/rte_reorder.c | 1 -
lib/rib/rte_rib.c | 1 -
lib/rib/rte_rib6.c | 1 -
lib/ring/rte_ring.c | 1 -
lib/stack/rte_stack.c | 1 -
lib/vhost/fd_man.h | 1 -
lib/vhost/socket.c | 2 +-
lib/vhost/vdpa.c | 2 -
lib/vhost/vhost.h | 2 +-
274 files changed, 590 insertions(+), 562 deletions(-)
rename lib/eal/{windows/include/sys/queue.h => include/bsd_queue.h} (52%)
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 01/47] eal: add BSD version of queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 02/47] net/nfp: fix use after free Stephen Hemminger
` (45 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff
The version of sys/queue.h on Linux from glibc was derived
from an older version of BSD and is missing several key macros
such as LIST_FOREACH_SAFE. This leads to drivers re-implementing
the macros (sometimes badly) and other bugs.
Introduce a version of queue.h derived from the current FreeBSD
header (only comments changed).
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/include/bsd_queue.h | 1075 +++++++++++++++++++++++++++++++++++
lib/eal/include/meson.build | 1 +
2 files changed, 1076 insertions(+)
create mode 100644 lib/eal/include/bsd_queue.h
diff --git a/lib/eal/include/bsd_queue.h b/lib/eal/include/bsd_queue.h
new file mode 100644
index 0000000000..d67eccd8de
--- /dev/null
+++ b/lib/eal/include/bsd_queue.h
@@ -0,0 +1,1075 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This is a copy of sys/queue.h which is used to overcome
+ * missing parts in the glibc version (and Windows).
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define _SYS_QUEUE_H_
+
+#include <sys/cdefs.h>
+
+/*
+ * This file defines four types of data structures: singly-linked lists,
+ * singly-linked tail queues, lists and tail queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The elements
+ * are singly linked for minimum space and pointer manipulation overhead at
+ * the expense of O(n) removal for arbitrary elements. New elements can be
+ * added to the list after an existing element or at the head of the list.
+ * Elements being removed from the head of the list should use the explicit
+ * macro for this purpose for optimum efficiency. A singly-linked list may
+ * only be traversed in the forward direction. Singly-linked lists are ideal
+ * for applications with large datasets and few or no removals or for
+ * implementing a LIFO queue.
+ *
+ * A singly-linked tail queue is headed by a pair of pointers, one to the
+ * head of the list and the other to the tail of the list. The elements are
+ * singly linked for minimum space and pointer manipulation overhead at the
+ * expense of O(n) removal for arbitrary elements. New elements can be added
+ * to the list after an existing element, at the head of the list, or at the
+ * end of the list. Elements being removed from the head of the tail queue
+ * should use the explicit macro for this purpose for optimum efficiency.
+ * A singly-linked tail queue may only be traversed in the forward direction.
+ * Singly-linked tail queues are ideal for applications with large datasets
+ * and few or no removals or for implementing a FIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may be traversed in either direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ *
+ * Below is a summary of implemented functions where:
+ * + means the macro is available
+ * - means the macro is not available
+ * s means the macro is available but is slow (runs in O(n) time)
+ *
+ * SLIST LIST STAILQ TAILQ
+ * _HEAD + + + +
+ * _CLASS_HEAD + + + +
+ * _HEAD_INITIALIZER + + + +
+ * _ENTRY + + + +
+ * _CLASS_ENTRY + + + +
+ * _INIT + + + +
+ * _EMPTY + + + +
+ * _END + + + +
+ * _FIRST + + + +
+ * _NEXT + + + +
+ * _PREV - + - +
+ * _LAST - - + +
+ * _LAST_FAST - - - +
+ * _FOREACH + + + +
+ * _FOREACH_FROM + + + +
+ * _FOREACH_SAFE + + + +
+ * _FOREACH_FROM_SAFE + + + +
+ * _FOREACH_REVERSE - - - +
+ * _FOREACH_REVERSE_FROM - - - +
+ * _FOREACH_REVERSE_SAFE - - - +
+ * _FOREACH_REVERSE_FROM_SAFE - - - +
+ * _INSERT_HEAD + + + +
+ * _INSERT_BEFORE - + - +
+ * _INSERT_AFTER + + + +
+ * _INSERT_TAIL - - + +
+ * _CONCAT s s + +
+ * _REMOVE_AFTER + - + -
+ * _REMOVE_HEAD + + + +
+ * _REMOVE s + s +
+ * _REPLACE - + - +
+ * _SPLIT_AFTER + + + +
+ * _SWAP + + + +
+ *
+ */
+#ifdef QUEUE_MACRO_DEBUG
+#warn Use QUEUE_MACRO_DEBUG_xxx instead (TRACE, TRASH and/or ASSERTIONS)
+#define QUEUE_MACRO_DEBUG_TRACE
+#define QUEUE_MACRO_DEBUG_TRASH
+#endif
+#ifdef QUEUE_MACRO_DEBUG_TRACE
+/* Store the last 2 places the queue element or head was altered */
+struct qm_trace {
+ unsigned long lastline;
+ unsigned long prevline;
+ const char *lastfile;
+ const char *prevfile;
+};
+
+#define TRACEBUF struct qm_trace trace;
+#define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } ,
+
+#define QMD_TRACE_HEAD(head) do { \
+ (head)->trace.prevline = (head)->trace.lastline; \
+ (head)->trace.prevfile = (head)->trace.lastfile; \
+ (head)->trace.lastline = __LINE__; \
+ (head)->trace.lastfile = __FILE__; \
+} while (0)
+
+#define QMD_TRACE_ELEM(elem) do { \
+ (elem)->trace.prevline = (elem)->trace.lastline; \
+ (elem)->trace.prevfile = (elem)->trace.lastfile; \
+ (elem)->trace.lastline = __LINE__; \
+ (elem)->trace.lastfile = __FILE__; \
+} while (0)
+
+#else /* !QUEUE_MACRO_DEBUG_TRACE */
+#define QMD_TRACE_ELEM(elem)
+#define QMD_TRACE_HEAD(head)
+#define TRACEBUF
+#define TRACEBUF_INITIALIZER
+#endif /* QUEUE_MACRO_DEBUG_TRACE */
+
+#ifdef QUEUE_MACRO_DEBUG_TRASH
+#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
+#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
+#define QMD_IS_TRASHED(x) ((x) == (void *)(intptr_t)-1)
+#else /* !QUEUE_MACRO_DEBUG_TRASH */
+#define QMD_SAVELINK(name, link)
+#define TRASHIT(x)
+#define QMD_IS_TRASHED(x) 0
+#endif /* QUEUE_MACRO_DEBUG_TRASH */
+
+#if defined(QUEUE_MACRO_DEBUG_ASSERTIONS) && \
+ defined(QUEUE_MACRO_NO_DEBUG_ASSERTIONS)
+#error Both QUEUE_MACRO_DEBUG_ASSERTIONS and QUEUE_MACRO_NO_DEBUG_ASSERTIONS defined
+#endif
+
+/*
+ * Automatically define QUEUE_MACRO_DEBUG_ASSERTIONS when compiling the kernel
+ * with INVARIANTS, if not already defined and not prevented by presence of
+ * QUEUE_MACRO_NO_DEBUG_ASSERTIONS.
+ */
+#if !defined(QUEUE_MACRO_DEBUG_ASSERTIONS) && \
+ !defined(QUEUE_MACRO_NO_DEBUG_ASSERTIONS) && \
+ (defined(_KERNEL) && defined(INVARIANTS))
+#define QUEUE_MACRO_DEBUG_ASSERTIONS
+#endif
+
+/*
+ * If queue assertions are enabled, provide default definitions for QMD_PANIC()
+ * and QMD_ASSERT() if undefined.
+ */
+#ifdef QUEUE_MACRO_DEBUG_ASSERTIONS
+#ifndef QMD_PANIC
+#if defined(_KERNEL) || defined(_STANDALONE)
+/*
+ * On _STANDALONE, either <stand.h> or the headers using <sys/queue.h> provide
+ * a declaration or macro for panic().
+ */
+#ifdef _KERNEL
+#include <sys/kassert.h>
+#endif
+#define QMD_PANIC(fmt, ...) do { \
+ panic(fmt, ##__VA_ARGS__); \
+} while (0)
+#else /* !(_KERNEL || _STANDALONE) */
+#include <stdio.h>
+#include <stdlib.h>
+#define QMD_PANIC(fmt, ...) do { \
+ fprintf(stderr, fmt "\n", ##__VA_ARGS__); \
+ abort(); \
+} while (0)
+#endif /* _KERNEL || _STANDALONE */
+#endif /* !QMD_PANIC */
+
+#ifndef QMD_ASSERT
+#define QMD_ASSERT(expression, fmt, ...) do { \
+ if (__predict_false(!(expression))) \
+ QMD_PANIC("%s:%u: %s: " fmt, \
+ __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
+} while (0)
+#endif /* !QMD_ASSERT */
+#else /* !QUEUE_MACRO_DEBUG_ASSERTIONS */
+#undef QMD_ASSERT
+#define QMD_ASSERT(test, fmt, ...) do {} while (0)
+#endif /* QUEUE_MACRO_DEBUG_ASSERTIONS */
+
+
+#ifdef __cplusplus
+/*
+ * In C++ there can be structure lists and class lists:
+ */
+#define QUEUE_TYPEOF(type) type
+#else
+#define QUEUE_TYPEOF(type) struct type
+#endif
+
+/*
+ * Singly-linked List declarations.
+ */
+
+#define SLIST_HEAD(name, type) \
+struct name { \
+ struct type *slh_first; /* first element */ \
+}
+
+#define SLIST_CLASS_HEAD(name, type) \
+struct name { \
+ class type *slh_first; /* first element */ \
+}
+
+#define SLIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define SLIST_ENTRY(type) \
+struct { \
+ struct type *sle_next; /* next element */ \
+}
+
+#define SLIST_CLASS_ENTRY(type) \
+struct { \
+ class type *sle_next; /* next element */ \
+}
+
+/*
+ * Singly-linked List functions.
+ */
+
+#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) \
+ QMD_ASSERT(*(prevp) == (elm), \
+ "Bad prevptr *(%p) == %p != %p", \
+ (prevp), *(prevp), (elm))
+
+#define SLIST_ASSERT_EMPTY(head) \
+ QMD_ASSERT(SLIST_EMPTY((head)), \
+ "slist %p is not empty", (head))
+
+#define SLIST_ASSERT_NONEMPTY(head) \
+ QMD_ASSERT(!SLIST_EMPTY((head)), \
+ "slist %p is empty", (head))
+
+#define SLIST_CONCAT(head1, head2, type, field) do { \
+ QUEUE_TYPEOF(type) *_Curelm = SLIST_FIRST(head1); \
+ if (_Curelm == NULL) { \
+ if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \
+ SLIST_INIT(head2); \
+ } else if (SLIST_FIRST(head2) != NULL) { \
+ while (SLIST_NEXT(_Curelm, field) != NULL) \
+ _Curelm = SLIST_NEXT(_Curelm, field); \
+ SLIST_NEXT(_Curelm, field) = SLIST_FIRST(head2); \
+ SLIST_INIT(head2); \
+ } \
+} while (0)
+
+#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
+
+#define SLIST_EMPTY_ATOMIC(head) \
+ (atomic_load_ptr(&(head)->slh_first) == NULL)
+
+#define SLIST_FIRST(head) ((head)->slh_first)
+
+#define SLIST_FOREACH(var, head, field) \
+ for ((var) = SLIST_FIRST((head)); \
+ (var); \
+ (var) = SLIST_NEXT((var), field))
+
+#define SLIST_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
+ (var); \
+ (var) = SLIST_NEXT((var), field))
+
+#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = SLIST_FIRST((head)); \
+ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
+ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
+ for ((varp) = &SLIST_FIRST((head)); \
+ ((var) = *(varp)) != NULL; \
+ (varp) = &SLIST_NEXT((var), field))
+
+#define SLIST_INIT(head) do { \
+ SLIST_FIRST((head)) = NULL; \
+} while (0)
+
+#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
+ SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
+ SLIST_NEXT((slistelm), field) = (elm); \
+} while (0)
+
+#define SLIST_INSERT_HEAD(head, elm, field) do { \
+ SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
+ SLIST_FIRST((head)) = (elm); \
+} while (0)
+
+#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
+
+#define SLIST_REMOVE(head, elm, type, field) do { \
+ if (SLIST_FIRST((head)) == (elm)) { \
+ SLIST_REMOVE_HEAD((head), field); \
+ } \
+ else { \
+ QUEUE_TYPEOF(type) *_Curelm = SLIST_FIRST(head); \
+ while (SLIST_NEXT(_Curelm, field) != (elm)) \
+ _Curelm = SLIST_NEXT(_Curelm, field); \
+ SLIST_REMOVE_AFTER(_Curelm, field); \
+ } \
+} while (0)
+
+#define SLIST_REMOVE_AFTER(elm, field) do { \
+ QMD_SAVELINK(_Oldnext, SLIST_NEXT(elm, field)->field.sle_next); \
+ SLIST_NEXT(elm, field) = \
+ SLIST_NEXT(SLIST_NEXT(elm, field), field); \
+ TRASHIT(*_Oldnext); \
+} while (0)
+
+#define SLIST_REMOVE_HEAD(head, field) do { \
+ QMD_SAVELINK(_Oldnext, SLIST_FIRST(head)->field.sle_next); \
+ SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
+ TRASHIT(*_Oldnext); \
+} while (0)
+
+#define SLIST_REMOVE_PREVPTR(prevp, elm, field) do { \
+ QMD_SLIST_CHECK_PREVPTR(prevp, elm); \
+ *(prevp) = SLIST_NEXT(elm, field); \
+ TRASHIT((elm)->field.sle_next); \
+} while (0)
+
+#define SLIST_SPLIT_AFTER(head, elm, rest, field) do { \
+ SLIST_ASSERT_NONEMPTY((head)); \
+ SLIST_FIRST((rest)) = SLIST_NEXT((elm), field); \
+ SLIST_NEXT((elm), field) = NULL; \
+} while (0)
+
+#define SLIST_SWAP(head1, head2, type) do { \
+ QUEUE_TYPEOF(type) *_Swap_first = SLIST_FIRST(head1); \
+ SLIST_FIRST(head1) = SLIST_FIRST(head2); \
+ SLIST_FIRST(head2) = _Swap_first; \
+} while (0)
+
+#define SLIST_END(head) NULL
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+
+#define STAILQ_HEAD(name, type) \
+struct name { \
+ struct type *stqh_first;/* first element */ \
+ struct type **stqh_last;/* addr of last next element */ \
+}
+
+#define STAILQ_CLASS_HEAD(name, type) \
+struct name { \
+ class type *stqh_first; /* first element */ \
+ class type **stqh_last; /* addr of last next element */ \
+}
+
+#define STAILQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).stqh_first }
+
+#define STAILQ_ENTRY(type) \
+struct { \
+ struct type *stqe_next; /* next element */ \
+}
+
+#define STAILQ_CLASS_ENTRY(type) \
+struct { \
+ class type *stqe_next; /* next element */ \
+}
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+
+/*
+ * QMD_STAILQ_CHECK_EMPTY(STAILQ_HEAD *head)
+ *
+ * Validates that the stailq head's pointer to the last element's next pointer
+ * actually points to the head's first element pointer field.
+ */
+#define QMD_STAILQ_CHECK_EMPTY(head) \
+ QMD_ASSERT((head)->stqh_last == &(head)->stqh_first, \
+ "Empty stailq %p->stqh_last is %p, " \
+ "not head's first field address", \
+ (head), (head)->stqh_last)
+
+/*
+ * QMD_STAILQ_CHECK_TAIL(STAILQ_HEAD *head)
+ *
+ * Validates that the stailq's last element's next pointer is NULL.
+ */
+#define QMD_STAILQ_CHECK_TAIL(head) \
+ QMD_ASSERT(*(head)->stqh_last == NULL, \
+ "Stailq %p last element's next pointer is " \
+ "%p, not NULL", (head), *(head)->stqh_last)
+
+#define STAILQ_ASSERT_EMPTY(head) \
+ QMD_ASSERT(STAILQ_EMPTY((head)), \
+ "stailq %p is not empty", (head))
+
+#define STAILQ_ASSERT_NONEMPTY(head) \
+ QMD_ASSERT(!STAILQ_EMPTY((head)), \
+ "stailq %p is empty", (head))
+
+#define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+ (head1)->stqh_last = (head2)->stqh_last; \
+ STAILQ_INIT((head2)); \
+ } \
+} while (0)
+
+#define STAILQ_EMPTY(head) ({ \
+ if (STAILQ_FIRST(head) == NULL) \
+ QMD_STAILQ_CHECK_EMPTY(head); \
+ STAILQ_FIRST(head) == NULL; \
+})
+
+#define STAILQ_EMPTY_ATOMIC(head) \
+ (atomic_load_ptr(&(head)->stqh_first) == NULL)
+
+#define STAILQ_FIRST(head) ((head)->stqh_first)
+
+#define STAILQ_FOREACH(var, head, field) \
+ for((var) = STAILQ_FIRST((head)); \
+ (var); \
+ (var) = STAILQ_NEXT((var), field))
+
+#define STAILQ_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
+ (var); \
+ (var) = STAILQ_NEXT((var), field))
+
+#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = STAILQ_FIRST((head)); \
+ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
+ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define STAILQ_INIT(head) do { \
+ STAILQ_FIRST((head)) = NULL; \
+ (head)->stqh_last = &STAILQ_FIRST((head)); \
+} while (0)
+
+#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
+ if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+ STAILQ_NEXT((tqelm), field) = (elm); \
+} while (0)
+
+#define STAILQ_INSERT_HEAD(head, elm, field) do { \
+ if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+ STAILQ_FIRST((head)) = (elm); \
+} while (0)
+
+#define STAILQ_INSERT_TAIL(head, elm, field) do { \
+ QMD_STAILQ_CHECK_TAIL(head); \
+ STAILQ_NEXT((elm), field) = NULL; \
+ *(head)->stqh_last = (elm); \
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+} while (0)
+
+#define STAILQ_LAST(head, type, field) \
+ (STAILQ_EMPTY((head)) ? NULL : \
+ __containerof((head)->stqh_last, \
+ QUEUE_TYPEOF(type), field.stqe_next))
+
+#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
+
+#define STAILQ_REMOVE(head, elm, type, field) do { \
+ QMD_SAVELINK(_Oldnext, (elm)->field.stqe_next); \
+ if (STAILQ_FIRST((head)) == (elm)) { \
+ STAILQ_REMOVE_HEAD((head), field); \
+ } \
+ else { \
+ QUEUE_TYPEOF(type) *_Curelm = STAILQ_FIRST(head); \
+ while (STAILQ_NEXT(_Curelm, field) != (elm)) \
+ _Curelm = STAILQ_NEXT(_Curelm, field); \
+ STAILQ_REMOVE_AFTER(head, _Curelm, field); \
+ } \
+ TRASHIT(*_Oldnext); \
+} while (0)
+
+#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
+ if ((STAILQ_NEXT(elm, field) = \
+ STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+} while (0)
+
+#define STAILQ_REMOVE_HEAD(head, field) do { \
+ if ((STAILQ_FIRST((head)) = \
+ STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
+ (head)->stqh_last = &STAILQ_FIRST((head)); \
+} while (0)
+
+#define STAILQ_SPLIT_AFTER(head, elm, rest, field) do { \
+ STAILQ_ASSERT_NONEMPTY((head)); \
+ QMD_STAILQ_CHECK_TAIL((head)); \
+ if (STAILQ_NEXT((elm), field) == NULL) \
+ /* 'elm' is the last element in 'head'. */ \
+ STAILQ_INIT((rest)); \
+ else { \
+ STAILQ_FIRST((rest)) = STAILQ_NEXT((elm), field); \
+ (rest)->stqh_last = (head)->stqh_last; \
+ STAILQ_NEXT((elm), field) = NULL; \
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+ } \
+} while (0)
+
+#define STAILQ_SWAP(head1, head2, type) do { \
+ QUEUE_TYPEOF(type) *_Swap_first = STAILQ_FIRST(head1); \
+ QUEUE_TYPEOF(type) **_Swap_last = (head1)->stqh_last; \
+ STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
+ (head1)->stqh_last = (head2)->stqh_last; \
+ STAILQ_FIRST(head2) = _Swap_first; \
+ (head2)->stqh_last = _Swap_last; \
+ if (STAILQ_FIRST(head1) == NULL) \
+ (head1)->stqh_last = &STAILQ_FIRST(head1); \
+ if (STAILQ_FIRST(head2) == NULL) \
+ (head2)->stqh_last = &STAILQ_FIRST(head2); \
+} while (0)
+
+#define STAILQ_REVERSE(head, type, field) do { \
+ if (STAILQ_EMPTY(head)) \
+ break; \
+ QUEUE_TYPEOF(type) *_Var, *_Varp, *_Varn; \
+ for (_Var = STAILQ_FIRST(head), _Varp = NULL; \
+ _Var != NULL;) { \
+ _Varn = STAILQ_NEXT(_Var, field); \
+ STAILQ_NEXT(_Var, field) = _Varp; \
+ _Varp = _Var; \
+ _Var = _Varn; \
+ } \
+ (head)->stqh_last = &STAILQ_NEXT(STAILQ_FIRST(head), field); \
+ (head)->stqh_first = _Varp; \
+} while (0)
+
+#define STAILQ_END(head) NULL
+
+
+/*
+ * List declarations.
+ */
+
+#define LIST_HEAD(name, type) \
+struct name { \
+ struct type *lh_first; /* first element */ \
+}
+
+#define LIST_CLASS_HEAD(name, type) \
+struct name { \
+ class type *lh_first; /* first element */ \
+}
+
+#define LIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define LIST_ENTRY(type) \
+struct { \
+ struct type *le_next; /* next element */ \
+ struct type **le_prev; /* address of previous next element */ \
+}
+
+#define LIST_CLASS_ENTRY(type) \
+struct { \
+ class type *le_next; /* next element */ \
+ class type **le_prev; /* address of previous next element */ \
+}
+
+/*
+ * List functions.
+ */
+
+/*
+ * QMD_LIST_CHECK_HEAD(LIST_HEAD *head, LIST_ENTRY NAME)
+ *
+ * If the list is non-empty, validates that the first element of the list
+ * points back at 'head.'
+ */
+#define QMD_LIST_CHECK_HEAD(head, field) \
+ QMD_ASSERT(LIST_FIRST((head)) == NULL || \
+ LIST_FIRST((head))->field.le_prev == \
+ &LIST_FIRST((head)), \
+ "Bad list head %p first->prev != head", \
+ (head))
+
+/*
+ * QMD_LIST_CHECK_NEXT(TYPE *elm, LIST_ENTRY NAME)
+ *
+ * If an element follows 'elm' in the list, validates that the next element
+ * points back at 'elm.'
+ */
+#define QMD_LIST_CHECK_NEXT(elm, field) \
+ QMD_ASSERT(LIST_NEXT((elm), field) == NULL || \
+ LIST_NEXT((elm), field)->field.le_prev == \
+ &((elm)->field.le_next), \
+ "Bad link elm %p next->prev != elm", (elm))
+
+/*
+ * QMD_LIST_CHECK_PREV(TYPE *elm, LIST_ENTRY NAME)
+ *
+ * Validates that the previous element (or head of the list) points to 'elm.'
+ */
+#define QMD_LIST_CHECK_PREV(elm, field) \
+ QMD_ASSERT(*(elm)->field.le_prev == (elm), \
+ "Bad link elm %p prev->next != elm", (elm))
+
+#define LIST_ASSERT_EMPTY(head) \
+ QMD_ASSERT(LIST_EMPTY((head)), \
+ "list %p is not empty", (head))
+
+#define LIST_ASSERT_NONEMPTY(head) \
+ QMD_ASSERT(!LIST_EMPTY((head)), \
+ "list %p is empty", (head))
+
+#define LIST_CONCAT(head1, head2, type, field) do { \
+ QUEUE_TYPEOF(type) *_Curelm = LIST_FIRST(head1); \
+ if (_Curelm == NULL) { \
+ if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \
+ LIST_FIRST(head2)->field.le_prev = \
+ &LIST_FIRST((head1)); \
+ LIST_INIT(head2); \
+ } \
+ } else if (LIST_FIRST(head2) != NULL) { \
+ while (LIST_NEXT(_Curelm, field) != NULL) \
+ _Curelm = LIST_NEXT(_Curelm, field); \
+ LIST_NEXT(_Curelm, field) = LIST_FIRST(head2); \
+ LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(_Curelm, field);\
+ LIST_INIT(head2); \
+ } \
+} while (0)
+
+#define LIST_EMPTY(head) ((head)->lh_first == NULL)
+
+#define LIST_EMPTY_ATOMIC(head) \
+ (atomic_load_ptr(&(head)->lh_first) == NULL)
+
+#define LIST_FIRST(head) ((head)->lh_first)
+
+#define LIST_FOREACH(var, head, field) \
+ for ((var) = LIST_FIRST((head)); \
+ (var); \
+ (var) = LIST_NEXT((var), field))
+
+#define LIST_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
+ (var); \
+ (var) = LIST_NEXT((var), field))
+
+#define LIST_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = LIST_FIRST((head)); \
+ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
+ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define LIST_INIT(head) do { \
+ LIST_FIRST((head)) = NULL; \
+} while (0)
+
+#define LIST_INSERT_AFTER(listelm, elm, field) do { \
+ QMD_LIST_CHECK_NEXT(listelm, field); \
+ if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
+ LIST_NEXT((listelm), field)->field.le_prev = \
+ &LIST_NEXT((elm), field); \
+ LIST_NEXT((listelm), field) = (elm); \
+ (elm)->field.le_prev = &LIST_NEXT((listelm), field); \
+} while (0)
+
+#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
+ QMD_LIST_CHECK_PREV(listelm, field); \
+ (elm)->field.le_prev = (listelm)->field.le_prev; \
+ LIST_NEXT((elm), field) = (listelm); \
+ *(listelm)->field.le_prev = (elm); \
+ (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
+} while (0)
+
+#define LIST_INSERT_HEAD(head, elm, field) do { \
+ QMD_LIST_CHECK_HEAD((head), field); \
+ if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
+ LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
+ LIST_FIRST((head)) = (elm); \
+ (elm)->field.le_prev = &LIST_FIRST((head)); \
+} while (0)
+
+#define LIST_NEXT(elm, field) ((elm)->field.le_next)
+
+#define LIST_PREV(elm, head, type, field) \
+ ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
+ __containerof((elm)->field.le_prev, \
+ QUEUE_TYPEOF(type), field.le_next))
+
+#define LIST_REMOVE_HEAD(head, field) \
+ LIST_REMOVE(LIST_FIRST(head), field)
+
+#define LIST_REMOVE(elm, field) do { \
+ QMD_SAVELINK(_Oldnext, (elm)->field.le_next); \
+ QMD_SAVELINK(_Oldprev, (elm)->field.le_prev); \
+ QMD_LIST_CHECK_NEXT(elm, field); \
+ QMD_LIST_CHECK_PREV(elm, field); \
+ if (LIST_NEXT((elm), field) != NULL) \
+ LIST_NEXT((elm), field)->field.le_prev = \
+ (elm)->field.le_prev; \
+ *(elm)->field.le_prev = LIST_NEXT((elm), field); \
+ TRASHIT(*_Oldnext); \
+ TRASHIT(*_Oldprev); \
+} while (0)
+
+#define LIST_REPLACE(elm, elm2, field) do { \
+ QMD_SAVELINK(_Oldnext, (elm)->field.le_next); \
+ QMD_SAVELINK(_Oldprev, (elm)->field.le_prev); \
+ QMD_LIST_CHECK_NEXT(elm, field); \
+ QMD_LIST_CHECK_PREV(elm, field); \
+ LIST_NEXT((elm2), field) = LIST_NEXT((elm), field); \
+ if (LIST_NEXT((elm2), field) != NULL) \
+ LIST_NEXT((elm2), field)->field.le_prev = \
+ &(elm2)->field.le_next; \
+ (elm2)->field.le_prev = (elm)->field.le_prev; \
+ *(elm2)->field.le_prev = (elm2); \
+ TRASHIT(*_Oldnext); \
+ TRASHIT(*_Oldprev); \
+} while (0)
+
+#define LIST_SPLIT_AFTER(head, elm, rest, field) do { \
+ LIST_ASSERT_NONEMPTY((head)); \
+ if (LIST_NEXT((elm), field) == NULL) \
+ /* 'elm' is the last element in 'head'. */ \
+ LIST_INIT((rest)); \
+ else { \
+ LIST_FIRST((rest)) = LIST_NEXT((elm), field); \
+ LIST_NEXT((elm), field)->field.le_prev = \
+ &LIST_FIRST((rest)); \
+ LIST_NEXT((elm), field) = NULL; \
+ } \
+} while (0)
+
+#define LIST_SWAP(head1, head2, type, field) do { \
+ QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \
+ LIST_FIRST((head1)) = LIST_FIRST((head2)); \
+ LIST_FIRST((head2)) = swap_tmp; \
+ if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
+ swap_tmp->field.le_prev = &LIST_FIRST((head1)); \
+ if ((swap_tmp = LIST_FIRST((head2))) != NULL) \
+ swap_tmp->field.le_prev = &LIST_FIRST((head2)); \
+} while (0)
+
+#define LIST_END(head) NULL
+
+/*
+ * Tail queue declarations.
+ */
+
+#define TAILQ_HEAD(name, type) \
+struct name { \
+ struct type *tqh_first; /* first element */ \
+ struct type **tqh_last; /* addr of last next element */ \
+ TRACEBUF \
+}
+
+#define TAILQ_CLASS_HEAD(name, type) \
+struct name { \
+ class type *tqh_first; /* first element */ \
+ class type **tqh_last; /* addr of last next element */ \
+ TRACEBUF \
+}
+
+#define TAILQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
+
+#define TAILQ_ENTRY(type) \
+struct { \
+ struct type *tqe_next; /* next element */ \
+ struct type **tqe_prev; /* address of previous next element */ \
+ TRACEBUF \
+}
+
+#define TAILQ_CLASS_ENTRY(type) \
+struct { \
+ class type *tqe_next; /* next element */ \
+ class type **tqe_prev; /* address of previous next element */ \
+ TRACEBUF \
+}
+
+/*
+ * Tail queue functions.
+ */
+
+/*
+ * QMD_TAILQ_CHECK_HEAD(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
+ *
+ * If the tailq is non-empty, validates that the first element of the tailq
+ * points back at 'head.'
+ */
+#define QMD_TAILQ_CHECK_HEAD(head, field) \
+ QMD_ASSERT(TAILQ_EMPTY(head) || \
+ TAILQ_FIRST((head))->field.tqe_prev == \
+ &TAILQ_FIRST((head)), \
+ "Bad tailq head %p first->prev != head", \
+ (head))
+
+/*
+ * QMD_TAILQ_CHECK_TAIL(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
+ *
+ * Validates that the tail of the tailq is a pointer to pointer to NULL.
+ */
+#define QMD_TAILQ_CHECK_TAIL(head, field) \
+ QMD_ASSERT(*(head)->tqh_last == NULL, \
+ "Bad tailq NEXT(%p->tqh_last) != NULL", \
+ (head))
+
+/*
+ * QMD_TAILQ_CHECK_NEXT(TYPE *elm, TAILQ_ENTRY NAME)
+ *
+ * If an element follows 'elm' in the tailq, validates that the next element
+ * points back at 'elm.'
+ */
+#define QMD_TAILQ_CHECK_NEXT(elm, field) \
+ QMD_ASSERT(TAILQ_NEXT((elm), field) == NULL || \
+ TAILQ_NEXT((elm), field)->field.tqe_prev == \
+ &((elm)->field.tqe_next), \
+ "Bad link elm %p next->prev != elm", (elm))
+
+/*
+ * QMD_TAILQ_CHECK_PREV(TYPE *elm, TAILQ_ENTRY NAME)
+ *
+ * Validates that the previous element (or head of the tailq) points to 'elm.'
+ */
+#define QMD_TAILQ_CHECK_PREV(elm, field) \
+ QMD_ASSERT(*(elm)->field.tqe_prev == (elm), \
+ "Bad link elm %p prev->next != elm", (elm))
+
+#define TAILQ_ASSERT_EMPTY(head) \
+ QMD_ASSERT(TAILQ_EMPTY((head)), \
+ "tailq %p is not empty", (head))
+
+#define TAILQ_ASSERT_NONEMPTY(head) \
+ QMD_ASSERT(!TAILQ_EMPTY((head)), \
+ "tailq %p is empty", (head))
+
+#define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
+ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ TAILQ_INIT((head2)); \
+ QMD_TRACE_HEAD(head1); \
+ QMD_TRACE_HEAD(head2); \
+ } \
+} while (0)
+
+#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
+
+#define TAILQ_EMPTY_ATOMIC(head) \
+ (atomic_load_ptr(&(head)->tqh_first) == NULL)
+
+#define TAILQ_FIRST(head) ((head)->tqh_first)
+
+#define TAILQ_FOREACH(var, head, field) \
+ for ((var) = TAILQ_FIRST((head)); \
+ (var); \
+ (var) = TAILQ_NEXT((var), field))
+
+#define TAILQ_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
+ (var); \
+ (var) = TAILQ_NEXT((var), field))
+
+#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = TAILQ_FIRST((head)); \
+ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
+ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = TAILQ_LAST((head), headname); \
+ (var); \
+ (var) = TAILQ_PREV((var), headname, field))
+
+#define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \
+ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
+ (var); \
+ (var) = TAILQ_PREV((var), headname, field))
+
+#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
+ for ((var) = TAILQ_LAST((head), headname); \
+ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
+ (var) = (tvar))
+
+#define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar)\
+ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
+ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
+ (var) = (tvar))
+
+#define TAILQ_INIT(head) do { \
+ TAILQ_FIRST((head)) = NULL; \
+ (head)->tqh_last = &TAILQ_FIRST((head)); \
+ QMD_TRACE_HEAD(head); \
+} while (0)
+
+#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ QMD_TAILQ_CHECK_NEXT(listelm, field); \
+ if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
+ TAILQ_NEXT((elm), field)->field.tqe_prev = \
+ &TAILQ_NEXT((elm), field); \
+ else { \
+ (head)->tqh_last = &TAILQ_NEXT((elm), field); \
+ QMD_TRACE_HEAD(head); \
+ } \
+ TAILQ_NEXT((listelm), field) = (elm); \
+ (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+ QMD_TRACE_ELEM(&(listelm)->field); \
+} while (0)
+
+#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
+ QMD_TAILQ_CHECK_PREV(listelm, field); \
+ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
+ TAILQ_NEXT((elm), field) = (listelm); \
+ *(listelm)->field.tqe_prev = (elm); \
+ (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+ QMD_TRACE_ELEM(&(listelm)->field); \
+} while (0)
+
+#define TAILQ_INSERT_HEAD(head, elm, field) do { \
+ QMD_TAILQ_CHECK_HEAD(head, field); \
+ if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
+ TAILQ_FIRST((head))->field.tqe_prev = \
+ &TAILQ_NEXT((elm), field); \
+ else \
+ (head)->tqh_last = &TAILQ_NEXT((elm), field); \
+ TAILQ_FIRST((head)) = (elm); \
+ (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
+ QMD_TRACE_HEAD(head); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+} while (0)
+
+#define TAILQ_INSERT_TAIL(head, elm, field) do { \
+ QMD_TAILQ_CHECK_TAIL(head, field); \
+ TAILQ_NEXT((elm), field) = NULL; \
+ (elm)->field.tqe_prev = (head)->tqh_last; \
+ *(head)->tqh_last = (elm); \
+ (head)->tqh_last = &TAILQ_NEXT((elm), field); \
+ QMD_TRACE_HEAD(head); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+} while (0)
+
+#define TAILQ_LAST(head, headname) \
+ (*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+/*
+ * The FAST function is fast in that it causes no data access other
+ * then the access to the head. The standard LAST function above
+ * will cause a data access of both the element you want and
+ * the previous element. FAST is very useful for instances when
+ * you may want to prefetch the last data element.
+ */
+#define TAILQ_LAST_FAST(head, type, field) \
+ (TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last, QUEUE_TYPEOF(type), field.tqe_next))
+
+#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define TAILQ_PREV(elm, headname, field) \
+ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define TAILQ_PREV_FAST(elm, head, type, field) \
+ ((elm)->field.tqe_prev == &(head)->tqh_first ? NULL : \
+ __containerof((elm)->field.tqe_prev, QUEUE_TYPEOF(type), field.tqe_next))
+
+#define TAILQ_REMOVE_HEAD(head, field) \
+ TAILQ_REMOVE(head, TAILQ_FIRST(head), field)
+
+#define TAILQ_REMOVE(head, elm, field) do { \
+ QMD_SAVELINK(_Oldnext, (elm)->field.tqe_next); \
+ QMD_SAVELINK(_Oldprev, (elm)->field.tqe_prev); \
+ QMD_TAILQ_CHECK_NEXT(elm, field); \
+ QMD_TAILQ_CHECK_PREV(elm, field); \
+ if ((TAILQ_NEXT((elm), field)) != NULL) \
+ TAILQ_NEXT((elm), field)->field.tqe_prev = \
+ (elm)->field.tqe_prev; \
+ else { \
+ (head)->tqh_last = (elm)->field.tqe_prev; \
+ QMD_TRACE_HEAD(head); \
+ } \
+ *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
+ TRASHIT(*_Oldnext); \
+ TRASHIT(*_Oldprev); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+} while (0)
+
+#define TAILQ_REPLACE(head, elm, elm2, field) do { \
+ QMD_SAVELINK(_Oldnext, (elm)->field.tqe_next); \
+ QMD_SAVELINK(_Oldprev, (elm)->field.tqe_prev); \
+ QMD_TAILQ_CHECK_NEXT(elm, field); \
+ QMD_TAILQ_CHECK_PREV(elm, field); \
+ TAILQ_NEXT((elm2), field) = TAILQ_NEXT((elm), field); \
+ if (TAILQ_NEXT((elm2), field) != TAILQ_END(head)) \
+ TAILQ_NEXT((elm2), field)->field.tqe_prev = \
+ &(elm2)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm2)->field.tqe_next; \
+ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
+ *(elm2)->field.tqe_prev = (elm2); \
+ TRASHIT(*_Oldnext); \
+ TRASHIT(*_Oldprev); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+} while (0)
+
+#define TAILQ_SPLIT_AFTER(head, elm, rest, field) do { \
+ TAILQ_ASSERT_NONEMPTY((head)); \
+ QMD_TAILQ_CHECK_TAIL((head), field); \
+ if (TAILQ_NEXT((elm), field) == NULL) \
+ /* 'elm' is the last element in 'head'. */ \
+ TAILQ_INIT((rest)); \
+ else { \
+ TAILQ_FIRST((rest)) = TAILQ_NEXT((elm), field); \
+ (rest)->tqh_last = (head)->tqh_last; \
+ TAILQ_NEXT((elm), field)->field.tqe_prev = \
+ &TAILQ_FIRST((rest)); \
+ \
+ TAILQ_NEXT((elm), field) = NULL; \
+ (head)->tqh_last = &TAILQ_NEXT((elm), field); \
+ } \
+} while (0)
+
+#define TAILQ_SWAP(head1, head2, type, field) do { \
+ QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \
+ QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \
+ (head1)->tqh_first = (head2)->tqh_first; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ (head2)->tqh_first = swap_first; \
+ (head2)->tqh_last = swap_last; \
+ if ((swap_first = (head1)->tqh_first) != NULL) \
+ swap_first->field.tqe_prev = &(head1)->tqh_first; \
+ else \
+ (head1)->tqh_last = &(head1)->tqh_first; \
+ if ((swap_first = (head2)->tqh_first) != NULL) \
+ swap_first->field.tqe_prev = &(head2)->tqh_first; \
+ else \
+ (head2)->tqh_last = &(head2)->tqh_first; \
+} while (0)
+
+#define TAILQ_END(head) NULL
+
+#endif /* !_SYS_QUEUE_H_ */
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index d903577caa..c10b2f09e0 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -4,6 +4,7 @@
includes += include_directories('.')
headers += files(
+ 'bsd_queue.h',
'rte_alarm.h',
'rte_bitmap.h',
'rte_bitops.h',
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 02/47] net/nfp: fix use after free
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 01/47] eal: add BSD version of queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 03/47] eal: use bsd_queue.h Stephen Hemminger
` (44 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, jin.liu, stable, Chaoyong He,
Niklas Söderlund, Peng Zhang
The code to cleanup metering was using the objects after calling
rte_free(). Can fix now by using LIST_FOREACH_SAFE().
Fixes: 2caf84a71cfd ("net/nfp: add meter options")
Cc: jin.liu@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/nfp/nfp_mtr.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/nfp/nfp_mtr.c b/drivers/net/nfp/nfp_mtr.c
index d4f2c4f2f0..904d2126e7 100644
--- a/drivers/net/nfp/nfp_mtr.c
+++ b/drivers/net/nfp/nfp_mtr.c
@@ -1124,10 +1124,10 @@ nfp_mtr_priv_init(struct nfp_pf_dev *pf_dev)
void
nfp_mtr_priv_uninit(struct nfp_pf_dev *pf_dev)
{
- struct nfp_mtr *mtr;
+ struct nfp_mtr *mtr, *tmp_mtr;
struct nfp_mtr_priv *priv;
- struct nfp_mtr_policy *mtr_policy;
- struct nfp_mtr_profile *mtr_profile;
+ struct nfp_mtr_policy *mtr_policy, *tmp_policy;
+ struct nfp_mtr_profile *mtr_profile, *tmp_profile;
struct nfp_app_fw_flower *app_fw_flower;
app_fw_flower = NFP_PRIV_TO_APP_FW_FLOWER(pf_dev->app_fw_priv);
@@ -1135,17 +1135,17 @@ nfp_mtr_priv_uninit(struct nfp_pf_dev *pf_dev)
rte_eal_alarm_cancel(nfp_mtr_stats_request, (void *)app_fw_flower);
- LIST_FOREACH(mtr, &priv->mtrs, next) {
+ LIST_FOREACH_SAFE(mtr, &priv->mtrs, next, tmp_mtr) {
LIST_REMOVE(mtr, next);
rte_free(mtr);
}
- LIST_FOREACH(mtr_profile, &priv->profiles, next) {
+ LIST_FOREACH_SAFE(mtr_profile, &priv->profiles, next, tmp_profile) {
LIST_REMOVE(mtr_profile, next);
rte_free(mtr_profile);
}
- LIST_FOREACH(mtr_policy, &priv->policies, next) {
+ LIST_FOREACH_SAFE(mtr_policy, &priv->policies, next, tmp_policy) {
LIST_REMOVE(mtr_policy, next);
rte_free(mtr_policy);
}
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 03/47] eal: use bsd_queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 01/47] eal: add BSD version of queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 02/47] net/nfp: fix use after free Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 04/47] test: remove unnecessary inclusion of sys/queue.h Stephen Hemminger
` (43 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Tyler Retzlaff, Jerin Jacob, Sunil Kumar Kori,
Anatoly Burakov, Bruce Richardson, Harman Kalra, Dmitry Kozlyuk
Replace use of sys/queue.h with bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/common/eal_common_bus.c | 2 +-
lib/eal/common/eal_common_class.c | 2 +-
lib/eal/common/eal_common_dev.c | 2 +-
lib/eal/common/eal_common_tailqs.c | 2 +-
lib/eal/common/eal_common_trace.c | 2 +-
lib/eal/common/eal_private.h | 2 +-
lib/eal/common/malloc_elem.c | 2 +-
lib/eal/common/malloc_heap.c | 2 +-
lib/eal/common/malloc_heap.h | 2 +-
lib/eal/common/rte_malloc.c | 2 +-
lib/eal/freebsd/eal.c | 2 +-
lib/eal/freebsd/eal_interrupts.c | 2 +-
lib/eal/freebsd/eal_thread.c | 2 +-
lib/eal/freebsd/include/rte_os.h | 6 ++++--
lib/eal/linux/eal_alarm.c | 2 +-
lib/eal/linux/eal_interrupts.c | 2 +-
lib/eal/linux/include/rte_os.h | 3 ++-
lib/eal/windows/eal_alarm.c | 2 +-
18 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 0a2311a342..29b69a1bd8 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -4,8 +4,8 @@
#include <stdio.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <bus_driver.h>
#include <rte_debug.h>
#include <rte_string_fns.h>
diff --git a/lib/eal/common/eal_common_class.c b/lib/eal/common/eal_common_class.c
index 0f10c6894b..1f10eca5b5 100644
--- a/lib/eal/common/eal_common_class.c
+++ b/lib/eal/common/eal_common_class.c
@@ -4,8 +4,8 @@
#include <stdio.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_class.h>
#include <rte_debug.h>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 7185de0cb9..9bd7d5082d 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -6,8 +6,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <bus_driver.h>
#include <rte_class.h>
#include <dev_driver.h>
diff --git a/lib/eal/common/eal_common_tailqs.c b/lib/eal/common/eal_common_tailqs.c
index 47080d75ac..1d4eda8517 100644
--- a/lib/eal/common/eal_common_tailqs.c
+++ b/lib/eal/common/eal_common_tailqs.c
@@ -2,10 +2,10 @@
* Copyright(c) 2010-2014 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <string.h>
+#include <bsd_queue.h>
#include <rte_eal.h>
#include <rte_eal_memconfig.h>
#include <rte_log.h>
diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c
index be1f78a68d..2ec2a6532d 100644
--- a/lib/eal/common/eal_common_trace.c
+++ b/lib/eal/common/eal_common_trace.c
@@ -5,9 +5,9 @@
#include <stdlib.h>
#include <fnmatch.h>
#include <pthread.h>
-#include <sys/queue.h>
#include <regex.h>
+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_errno.h>
#include <rte_lcore.h>
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 5846917cc5..d7557ea4a8 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -8,8 +8,8 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <dev_driver.h>
#include <rte_lcore.h>
#include <rte_log.h>
diff --git a/lib/eal/common/malloc_elem.c b/lib/eal/common/malloc_elem.c
index 452b119c20..cf78395eba 100644
--- a/lib/eal/common/malloc_elem.c
+++ b/lib/eal/common/malloc_elem.c
@@ -6,8 +6,8 @@
#include <stddef.h>
#include <stdio.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_memory.h>
#include <rte_eal.h>
#include <rte_common.h>
diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c
index 13a56e490e..9f319cc040 100644
--- a/lib/eal/common/malloc_heap.c
+++ b/lib/eal/common/malloc_heap.c
@@ -6,8 +6,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_memory.h>
#include <rte_errno.h>
#include <rte_eal.h>
diff --git a/lib/eal/common/malloc_heap.h b/lib/eal/common/malloc_heap.h
index dfc56d4ae3..5c7e6cfad8 100644
--- a/lib/eal/common/malloc_heap.h
+++ b/lib/eal/common/malloc_heap.h
@@ -6,8 +6,8 @@
#define MALLOC_HEAP_H_
#include <stdbool.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_malloc.h>
#include <rte_spinlock.h>
diff --git a/lib/eal/common/rte_malloc.c b/lib/eal/common/rte_malloc.c
index 3a86c19490..f30b66fc10 100644
--- a/lib/eal/common/rte_malloc.c
+++ b/lib/eal/common/rte_malloc.c
@@ -6,8 +6,8 @@
#include <stddef.h>
#include <stdio.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_errno.h>
#include <rte_memcpy.h>
#include <rte_memory.h>
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index c1ab8d86d2..64e9922775 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -17,9 +17,9 @@
#include <errno.h>
#include <limits.h>
#include <sys/mman.h>
-#include <sys/queue.h>
#include <sys/stat.h>
+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_memory.h>
diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
index 5c3ab6699e..0e3069af8a 100644
--- a/lib/eal/freebsd/eal_interrupts.c
+++ b/lib/eal/freebsd/eal_interrupts.c
@@ -5,9 +5,9 @@
#include <string.h>
#include <sys/types.h>
#include <sys/event.h>
-#include <sys/queue.h>
#include <unistd.h>
+#include <bsd_queue.h>
#include <eal_export.h>
#include <eal_trace_internal.h>
#include <rte_errno.h>
diff --git a/lib/eal/freebsd/eal_thread.c b/lib/eal/freebsd/eal_thread.c
index 7ed76ed796..28335282e7 100644
--- a/lib/eal/freebsd/eal_thread.c
+++ b/lib/eal/freebsd/eal_thread.c
@@ -9,9 +9,9 @@
#include <unistd.h>
#include <sched.h>
#include <pthread_np.h>
-#include <sys/queue.h>
#include <sys/thr.h>
+#include <bsd_queue.h>
#include <rte_debug.h>
#include <rte_atomic.h>
#include <rte_launch.h>
diff --git a/lib/eal/freebsd/include/rte_os.h b/lib/eal/freebsd/include/rte_os.h
index 94b9275beb..874fdd7f03 100644
--- a/lib/eal/freebsd/include/rte_os.h
+++ b/lib/eal/freebsd/include/rte_os.h
@@ -12,9 +12,11 @@
#include <pthread_np.h>
#include <stdlib.h> /* Declares alloca() */
-#include <sys/queue.h>
-/* These macros are compatible with system's sys/queue.h. */
+/* Alternative to system's sys/queue.h which is missing some macros. */
+#include <bsd_queue.h>
+
+/* These macros are compatible with bsd_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)
diff --git a/lib/eal/linux/eal_alarm.c b/lib/eal/linux/eal_alarm.c
index eb6a21d4f0..150e502437 100644
--- a/lib/eal/linux/eal_alarm.c
+++ b/lib/eal/linux/eal_alarm.c
@@ -6,10 +6,10 @@
#include <stdlib.h>
#include <errno.h>
#include <pthread.h>
-#include <sys/queue.h>
#include <sys/time.h>
#include <sys/timerfd.h>
+#include <bsd_queue.h>
#include <eal_export.h>
#include <eal_trace_internal.h>
#include <rte_interrupts.h>
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index 4ec78de82c..0d26cd9ce0 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-#include <sys/queue.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
@@ -15,6 +14,7 @@
#include <assert.h>
#include <stdbool.h>
+#include <bsd_queue.h>
#include <eal_export.h>
#include <eal_trace_internal.h>
#include <rte_common.h>
diff --git a/lib/eal/linux/include/rte_os.h b/lib/eal/linux/include/rte_os.h
index 20eff0409a..bfb9447586 100644
--- a/lib/eal/linux/include/rte_os.h
+++ b/lib/eal/linux/include/rte_os.h
@@ -12,7 +12,8 @@
#include <alloca.h>
#include <sched.h>
-#include <sys/queue.h>
+
+#include <bsd_queue.h>
/* These macros are compatible with system's sys/queue.h. */
#define RTE_TAILQ_HEAD(name, type) TAILQ_HEAD(name, type)
diff --git a/lib/eal/windows/eal_alarm.c b/lib/eal/windows/eal_alarm.c
index 0b11d331dc..757d4efc4f 100644
--- a/lib/eal/windows/eal_alarm.c
+++ b/lib/eal/windows/eal_alarm.c
@@ -4,8 +4,8 @@
#include <stdatomic.h>
#include <stdbool.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <eal_export.h>
#include <rte_alarm.h>
#include <rte_spinlock.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 04/47] test: remove unnecessary inclusion of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (2 preceding siblings ...)
2025-08-18 23:27 ` [RFC 03/47] eal: use bsd_queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 05/47] testpmd: use bsd_queue.h Stephen Hemminger
` (42 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Tyler Retzlaff, Yipeng Wang, Sameh Gobriel,
Bruce Richardson, Vladimir Medvedkin, Honnappa Nagarahalli,
Konstantin Ananyev, Anatoly Burakov, Andrew Rybchenko,
Morten Brørup, Chas Williams, Min Hu (Connor),
Jack Bond-Preston, Erik Gabriel Carrillo
Those macros are not directly in most of the test code.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/commands.c | 2 +-
app/test/test.c | 1 -
app/test/test.h | 2 +-
app/test/test_atomic.c | 1 -
app/test/test_cmdline_lib.c | 1 -
app/test/test_func_reentrancy.c | 1 -
app/test/test_hash.c | 1 -
app/test/test_hash_functions.c | 1 -
app/test/test_link_bonding.c | 1 -
app/test/test_link_bonding_mode4.c | 1 -
| 1 -
app/test/test_logs.c | 1 -
app/test/test_malloc.c | 1 -
app/test/test_mbuf.c | 1 -
app/test/test_mcslock.c | 1 -
app/test/test_mempool.c | 1 -
app/test/test_mempool_perf.c | 1 -
app/test/test_memzone.c | 1 -
app/test/test_mp_secondary.c | 1 -
app/test/test_per_lcore.c | 1 -
app/test/test_pflock.c | 1 -
app/test/test_ring.c | 1 -
app/test/test_rwlock.c | 1 -
app/test/test_soring.c | 1 -
app/test/test_spinlock.c | 1 -
app/test/test_tailq.c | 1 -
app/test/test_ticketlock.c | 1 -
app/test/test_timer.c | 1 -
28 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/app/test/commands.c b/app/test/commands.c
index 497d8e9952..6328ff3ed6 100644
--- a/app/test/commands.c
+++ b/app/test/commands.c
@@ -10,8 +10,8 @@
#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_log.h>
#include <rte_debug.h>
diff --git a/app/test/test.c b/app/test/test.c
index fd653cbbfd..b3a15529d9 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -9,7 +9,6 @@
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
-#include <sys/queue.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
diff --git a/app/test/test.h b/app/test/test.h
index ebc4864bf8..a8a1ac9e76 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -8,8 +8,8 @@
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_hexdump.h>
#include <rte_common.h>
#include <rte_os_shim.h>
diff --git a/app/test/test_atomic.c b/app/test/test_atomic.c
index 3f26ce88d9..d98f7b1d09 100644
--- a/app/test/test_atomic.c
+++ b/app/test/test_atomic.c
@@ -7,7 +7,6 @@
#include <stdint.h>
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <rte_memory.h>
#include <rte_per_lcore.h>
diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c
index 87c1059366..67a2d73137 100644
--- a/app/test/test_cmdline_lib.c
+++ b/app/test/test_cmdline_lib.c
@@ -9,7 +9,6 @@
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
-#include <sys/queue.h>
#include <rte_common.h>
diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c
index 34d685d493..c7f359e360 100644
--- a/app/test/test_func_reentrancy.c
+++ b/app/test/test_func_reentrancy.c
@@ -9,7 +9,6 @@
#include <inttypes.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_log.h>
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index 5791fd7f4c..f538053367 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -8,7 +8,6 @@
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_malloc.h>
diff --git a/app/test/test_hash_functions.c b/app/test/test_hash_functions.c
index 70820d1f19..0d9f1dc0f6 100644
--- a/app/test/test_hash_functions.c
+++ b/app/test/test_hash_functions.c
@@ -8,7 +8,6 @@
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_cycles.h>
#include <rte_random.h>
diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 19b064771a..39541b04b0 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -11,7 +11,6 @@
#include <inttypes.h>
#include <errno.h>
#include <pthread.h>
-#include <sys/queue.h>
#include <sys/time.h>
#include <rte_cycles.h>
diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c
index ff13dbed93..0df83d94d3 100644
--- a/app/test/test_link_bonding_mode4.c
+++ b/app/test/test_link_bonding_mode4.c
@@ -10,7 +10,6 @@
#include <inttypes.h>
#include <errno.h>
#include <rte_cycles.h>
-#include <sys/queue.h>
#include <rte_byteorder.h>
#include <rte_common.h>
--git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c
index 2cb689b1de..50bdc909f5 100644
--- a/app/test/test_link_bonding_rssconf.c
+++ b/app/test/test_link_bonding_rssconf.c
@@ -10,7 +10,6 @@
#include <inttypes.h>
#include <errno.h>
#include <rte_cycles.h>
-#include <sys/queue.h>
#include <rte_byteorder.h>
#include <rte_common.h>
diff --git a/app/test/test_logs.c b/app/test/test_logs.c
index 43b09704a3..a02e4b7860 100644
--- a/app/test/test_logs.c
+++ b/app/test/test_logs.c
@@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
-#include <sys/queue.h>
#include <rte_log.h>
#include <rte_memory.h>
diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index ce8fc5dd06..c74ebaad10 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -13,7 +13,6 @@
#ifndef RTE_EXEC_ENV_WINDOWS
#include <sys/mman.h>
#endif
-#include <sys/queue.h>
#include <unistd.h>
#include <rte_common.h>
diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 17be977f31..b057ae79b4 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -12,7 +12,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_errno.h>
diff --git a/app/test/test_mcslock.c b/app/test/test_mcslock.c
index 8fcbc11a08..e88da6d8de 100644
--- a/app/test/test_mcslock.c
+++ b/app/test/test_mcslock.c
@@ -7,7 +7,6 @@
#include <inttypes.h>
#include <string.h>
#include <unistd.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_memory.h>
diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 61385e096e..6e6431e422 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -9,7 +9,6 @@
#include <inttypes.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_eal_paging.h>
diff --git a/app/test/test_mempool_perf.c b/app/test/test_mempool_perf.c
index e164eca788..775d61461d 100644
--- a/app/test/test_mempool_perf.c
+++ b/app/test/test_mempool_perf.c
@@ -10,7 +10,6 @@
#include <inttypes.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_log.h>
diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c
index 506725ea41..8080501a89 100644
--- a/app/test/test_memzone.c
+++ b/app/test/test_memzone.c
@@ -6,7 +6,6 @@
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <rte_random.h>
#include <rte_cycles.h>
diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c
index f3694530a8..72a50c92e4 100644
--- a/app/test/test_mp_secondary.c
+++ b/app/test/test_mp_secondary.c
@@ -10,7 +10,6 @@
#include <stdlib.h>
#include <stdarg.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
diff --git a/app/test/test_per_lcore.c b/app/test/test_per_lcore.c
index e0674b0e70..a3e56b5c9d 100644
--- a/app/test/test_per_lcore.c
+++ b/app/test/test_per_lcore.c
@@ -4,7 +4,6 @@
#include <stdio.h>
#include <stdint.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_memory.h>
diff --git a/app/test/test_pflock.c b/app/test/test_pflock.c
index 162049201f..5fb7f21d50 100644
--- a/app/test/test_pflock.c
+++ b/app/test/test_pflock.c
@@ -6,7 +6,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
-#include <sys/queue.h>
#include <string.h>
#include <rte_common.h>
diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index ba1fec1de3..1487093bc4 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -10,7 +10,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_log.h>
diff --git a/app/test/test_rwlock.c b/app/test/test_rwlock.c
index 785317621d..3bbcd8100e 100644
--- a/app/test/test_rwlock.c
+++ b/app/test/test_rwlock.c
@@ -6,7 +6,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
-#include <sys/queue.h>
#include <string.h>
#include <rte_common.h>
diff --git a/app/test/test_soring.c b/app/test/test_soring.c
index 3c1944424e..d75054d95c 100644
--- a/app/test/test_soring.c
+++ b/app/test/test_soring.c
@@ -9,7 +9,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_log.h>
diff --git a/app/test/test_spinlock.c b/app/test/test_spinlock.c
index 34e0ef9422..5b2064ee9a 100644
--- a/app/test/test_spinlock.c
+++ b/app/test/test_spinlock.c
@@ -7,7 +7,6 @@
#include <inttypes.h>
#include <string.h>
#include <unistd.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_memory.h>
diff --git a/app/test/test_tailq.c b/app/test/test_tailq.c
index 2ff2877344..edb671a2be 100644
--- a/app/test/test_tailq.c
+++ b/app/test/test_tailq.c
@@ -7,7 +7,6 @@
#include <stdarg.h>
#include <string.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_eal.h>
#include <rte_string_fns.h>
diff --git a/app/test/test_ticketlock.c b/app/test/test_ticketlock.c
index 8ac2e90876..2de7cc71c0 100644
--- a/app/test/test_ticketlock.c
+++ b/app/test/test_ticketlock.c
@@ -6,7 +6,6 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <sys/queue.h>
#include <unistd.h>
#include <rte_common.h>
diff --git a/app/test/test_timer.c b/app/test/test_timer.c
index 3411b7fe20..5efcc7e61d 100644
--- a/app/test/test_timer.c
+++ b/app/test/test_timer.c
@@ -91,7 +91,6 @@
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <math.h>
#include <rte_common.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 05/47] testpmd: use bsd_queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (3 preceding siblings ...)
2025-08-18 23:27 ` [RFC 04/47] test: remove unnecessary inclusion of sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 06/47] dumpcap: " Stephen Hemminger
` (41 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Aman Singh
Only include the definition of LIST, TAILQ, etc where needed.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test-pmd/5tswap.c | 2 --
app/test-pmd/cmdline.c | 2 +-
app/test-pmd/config.c | 2 +-
app/test-pmd/csumonly.c | 1 -
app/test-pmd/flowgen.c | 1 -
app/test-pmd/hairpin.c | 1 -
app/test-pmd/icmpecho.c | 1 -
app/test-pmd/iofwd.c | 1 -
app/test-pmd/macfwd.c | 1 -
app/test-pmd/macswap.c | 1 -
app/test-pmd/noisy_vnf.c | 1 -
app/test-pmd/parameters.c | 1 -
app/test-pmd/rxonly.c | 1 -
app/test-pmd/testpmd.c | 1 -
app/test-pmd/testpmd.h | 2 +-
app/test-pmd/txonly.c | 1 -
16 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/app/test-pmd/5tswap.c b/app/test-pmd/5tswap.c
index 8e8de2557a..2671fdcd9f 100644
--- a/app/test-pmd/5tswap.c
+++ b/app/test-pmd/5tswap.c
@@ -7,8 +7,6 @@
#include <stdint.h>
#include <unistd.h>
#include <inttypes.h>
-
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 7b4e27eddf..cf1bfe658b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -13,8 +13,8 @@
#include <string.h>
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_byteorder.h>
#include <rte_log.h>
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 0fda8e99f8..3b21c7e994 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -13,7 +13,7 @@
#include <stdint.h>
#include <inttypes.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index d355dbd8c0..babf4e1881 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -10,7 +10,6 @@
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index 53b5f24f11..dc50f8c94f 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -10,7 +10,6 @@
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
diff --git a/app/test-pmd/hairpin.c b/app/test-pmd/hairpin.c
index 5e6b37974e..35d5c06047 100644
--- a/app/test-pmd/hairpin.c
+++ b/app/test-pmd/hairpin.c
@@ -8,7 +8,6 @@
#include <stdbool.h>
#include <stdint.h>
-#include <sys/queue.h>
#include "testpmd.h"
diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c
index c87b7a80df..7b51513070 100644
--- a/app/test-pmd/icmpecho.c
+++ b/app/test-pmd/icmpecho.c
@@ -10,7 +10,6 @@
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c
index ba06fae4a6..26dd787ca1 100644
--- a/app/test-pmd/iofwd.c
+++ b/app/test-pmd/iofwd.c
@@ -10,7 +10,6 @@
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index d19ace7395..5ba3549270 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -10,7 +10,6 @@
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index 57f77003fe..cc171aed4c 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -10,7 +10,6 @@
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c
index 81d1187cfe..edf1f62b55 100644
--- a/app/test-pmd/noisy_vnf.c
+++ b/app/test-pmd/noisy_vnf.c
@@ -12,7 +12,6 @@
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 1132972913..c3e46f97b9 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -13,7 +13,6 @@
#include <fcntl.h>
#include <sys/types.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <stdint.h>
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 315f9286cd..c73282e991 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -10,7 +10,6 @@
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index bb88555328..b8ad6b6f73 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -16,7 +16,6 @@
#include <errno.h>
#include <stdbool.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <stdint.h>
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index e629edaa02..59e3620f0f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -21,7 +21,7 @@
#include <cmdline.h>
#include <cmdline_parse.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#ifdef RTE_HAS_JANSSON
#include <jansson.h>
#endif
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index bdcf6ea660..2aa8aaa4c5 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -10,7 +10,6 @@
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <rte_common.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 06/47] dumpcap: use bsd_queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (4 preceding siblings ...)
2025-08-18 23:27 ` [RFC 05/47] testpmd: use bsd_queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 07/47] proc-info: remove unnecessary sys/queue.h Stephen Hemminger
` (40 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Reshma Pattan
Use DPDK not system version.
Not really a requirement but better to avoid any possible conflict.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/dumpcap/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index 3d3c0dbc66..f28392d6cd 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -17,12 +17,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/queue.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <time.h>
#include <unistd.h>
+#include <bsd_queue.h>
#include <rte_alarm.h>
#include <rte_bitops.h>
#include <rte_bpf.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 07/47] proc-info: remove unnecessary sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (5 preceding siblings ...)
2025-08-18 23:27 ` [RFC 06/47] dumpcap: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 08/47] doc: suggest bsd_queue.h Stephen Hemminger
` (39 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Reshma Pattan
Not used directly here.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/proc-info/main.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index be67386658..2feecbca78 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -9,7 +9,6 @@
#include <errno.h>
#include <stdarg.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <stdlib.h>
#include <getopt.h>
#include <unistd.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 08/47] doc: suggest bsd_queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (6 preceding siblings ...)
2025-08-18 23:27 ` [RFC 07/47] proc-info: remove unnecessary sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 09/47] test-pipeline: remove unnecessary use of sys/queue.h Stephen Hemminger
` (38 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
Don't suggest use of sys/queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
doc/guides/contributing/coding_style.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst
index 243a3c2959..1f3d5d9acb 100644
--- a/doc/guides/contributing/coding_style.rst
+++ b/doc/guides/contributing/coding_style.rst
@@ -324,12 +324,12 @@ Structure Declarations
Queues
~~~~~~
-Use queue(3) macros rather than rolling your own lists, whenever possible.
+Use queue(3) macros defined in <bsd_queue.h> rather than rolling your own lists.
Thus, the previous example would be better written:
.. code-block:: c
- #include <sys/queue.h>
+ #include <bsd_queue.h>
struct foo {
LIST_ENTRY(foo) link; /* Use queue macros for foo lists. */
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 09/47] test-pipeline: remove unnecessary use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (7 preceding siblings ...)
2025-08-18 23:27 ` [RFC 08/47] doc: suggest bsd_queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 10/47] test-eventdev: use bsd_queue.h Stephen Hemminger
` (37 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu
Not used directly here
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test-pipeline/config.c | 1 -
app/test-pipeline/init.c | 1 -
app/test-pipeline/main.c | 1 -
app/test-pipeline/runtime.c | 1 -
4 files changed, 4 deletions(-)
diff --git a/app/test-pipeline/config.c b/app/test-pipeline/config.c
index daf838948b..61cf3a195c 100644
--- a/app/test-pipeline/config.c
+++ b/app/test-pipeline/config.c
@@ -8,7 +8,6 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c
index 558f0e428d..2ca32db39d 100644
--- a/app/test-pipeline/init.c
+++ b/app/test-pipeline/init.c
@@ -8,7 +8,6 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
diff --git a/app/test-pipeline/main.c b/app/test-pipeline/main.c
index 4cc098d7ac..dbc1e0d92d 100644
--- a/app/test-pipeline/main.c
+++ b/app/test-pipeline/main.c
@@ -8,7 +8,6 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
#include <stdarg.h>
#include <signal.h>
#include <errno.h>
diff --git a/app/test-pipeline/runtime.c b/app/test-pipeline/runtime.c
index 752f783370..e1d9f8174e 100644
--- a/app/test-pipeline/runtime.c
+++ b/app/test-pipeline/runtime.c
@@ -8,7 +8,6 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 10/47] test-eventdev: use bsd_queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (8 preceding siblings ...)
2025-08-18 23:27 ` [RFC 09/47] test-pipeline: remove unnecessary use of sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 11/47] test-bbdev, test-cmdline, test-mldev: don't use sys/queue.h Stephen Hemminger
` (36 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Jerin Jacob
Use the replacement bsd_queue.h header instead
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test-eventdev/evt_test.c | 2 +-
app/test-eventdev/evt_test.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/test-eventdev/evt_test.c b/app/test-eventdev/evt_test.c
index 72d6228bc3..4d1b1689bb 100644
--- a/app/test-eventdev/evt_test.c
+++ b/app/test-eventdev/evt_test.c
@@ -4,8 +4,8 @@
#include <stdio.h>
#include <unistd.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include "evt_test.h"
static STAILQ_HEAD(, evt_test_entry) head = STAILQ_HEAD_INITIALIZER(head);
diff --git a/app/test-eventdev/evt_test.h b/app/test-eventdev/evt_test.h
index ad3f531dcf..30b248d5db 100644
--- a/app/test-eventdev/evt_test.h
+++ b/app/test-eventdev/evt_test.h
@@ -7,7 +7,6 @@
#include <string.h>
#include <stdbool.h>
-#include <sys/queue.h>
#include <rte_eal.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 11/47] test-bbdev, test-cmdline, test-mldev: don't use sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (9 preceding siblings ...)
2025-08-18 23:27 ` [RFC 10/47] test-eventdev: use bsd_queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 12/47] examples: replace use of sys/queue.h Stephen Hemminger
` (35 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Nicolas Chautru, Srikanth Yalavarthi
No need for direct inclusion here.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test-bbdev/main.h | 1 -
app/test-cmdline/cmdline_test.c | 1 -
app/test-mldev/ml_test.h | 1 -
3 files changed, 3 deletions(-)
diff --git a/app/test-bbdev/main.h b/app/test-bbdev/main.h
index dc10a505d1..67a10e7a9c 100644
--- a/app/test-bbdev/main.h
+++ b/app/test-bbdev/main.h
@@ -6,7 +6,6 @@
#define _MAIN_H_
#include <stddef.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_hexdump.h>
diff --git a/app/test-cmdline/cmdline_test.c b/app/test-cmdline/cmdline_test.c
index 89f4260cbf..3927381f81 100644
--- a/app/test-cmdline/cmdline_test.c
+++ b/app/test-cmdline/cmdline_test.c
@@ -10,7 +10,6 @@
#include <errno.h>
#include <termios.h>
#include <ctype.h>
-#include <sys/queue.h>
#include <rte_common.h>
diff --git a/app/test-mldev/ml_test.h b/app/test-mldev/ml_test.h
index f35fa8aadb..a2de5b3a31 100644
--- a/app/test-mldev/ml_test.h
+++ b/app/test-mldev/ml_test.h
@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/queue.h>
#include <rte_common.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 12/47] examples: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (10 preceding siblings ...)
2025-08-18 23:27 ` [RFC 11/47] test-bbdev, test-cmdline, test-mldev: don't use sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 13/47] hash: do not include sys/queue.h Stephen Hemminger
` (34 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Nicolas Chautru, Chas Williams,
Min Hu (Connor),
Ori Kam, Bruce Richardson, Konstantin Ananyev,
Cristian Dumitrescu, Radu Nicolau, Akhil Goyal, Fan Zhang,
Sunil Kumar Kori, Pavan Nikhilesh, Jerin Jacob, Kiran Kumar K,
Nithin Dabilpuram, Zhirun Yan, Anatoly Burakov, David Hunt,
Sivaprasad Tummala, Byron Marohn, Yipeng Wang, Harry van Haaren,
Erik Gabriel Carrillo, Maxime Coquelin, Chenbo Xia
Where macros are actually used directly include bsd_queue.h.
Most places were just copying some other file and doing unnecessary
include of sys/queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/bbdev_app/main.c | 2 +-
examples/bond/main.c | 2 +-
examples/cmdline/main.c | 1 -
examples/cmdline/parse_obj_list.h | 2 +-
examples/flow_filtering/main.c | 1 -
examples/helloworld/main.c | 2 +-
examples/ip_fragmentation/main.c | 2 +-
examples/ip_pipeline/action.h | 2 +-
examples/ip_pipeline/cryptodev.h | 2 +-
examples/ip_pipeline/link.h | 2 +-
examples/ip_pipeline/mempool.h | 2 +-
examples/ip_pipeline/pipeline.h | 2 +-
examples/ip_pipeline/swq.h | 2 +-
examples/ip_pipeline/tap.h | 2 +-
examples/ip_pipeline/tmgr.h | 2 +-
examples/ip_reassembly/main.c | 2 +-
examples/ipsec-secgw/ipsec-secgw.c | 2 +-
examples/ipv4_multicast/main.c | 2 +-
examples/l2fwd-crypto/main.c | 2 +-
examples/l2fwd-event/l2fwd_common.h | 1 -
examples/l2fwd-keepalive/ka-agent/main.c | 1 -
examples/l2fwd-keepalive/main.c | 2 +-
examples/l2fwd-macsec/main.c | 2 +-
examples/l2fwd/main.c | 2 +-
examples/l3fwd-graph/main.c | 2 +-
examples/l3fwd-power/main.c | 2 +-
examples/l3fwd/l3fwd_em.c | 1 -
examples/l3fwd/l3fwd_lpm.c | 1 -
examples/l3fwd/main.c | 2 +-
examples/link_status_interrupt/main.c | 2 +-
examples/multi_process/client_server_mp/mp_client/client.c | 1 -
examples/multi_process/client_server_mp/mp_server/init.c | 1 -
examples/multi_process/client_server_mp/mp_server/main.c | 2 +-
examples/multi_process/hotplug_mp/main.c | 1 -
examples/multi_process/simple_mp/main.c | 2 +-
examples/multi_process/symmetric_mp/main.c | 2 +-
examples/server_node_efd/efd_node/node.c | 1 -
examples/server_node_efd/efd_server/init.c | 1 -
examples/server_node_efd/efd_server/main.c | 1 -
examples/service_cores/main.c | 1 -
examples/timer/main.c | 2 +-
examples/vhost/main.h | 2 +-
examples/vm_power_manager/channel_manager.c | 2 +-
examples/vm_power_manager/channel_monitor.c | 2 +-
examples/vm_power_manager/main.c | 2 +-
examples/vmdq/main.c | 2 +-
examples/vmdq_dcb/main.c | 2 +-
47 files changed, 34 insertions(+), 47 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 03f15f91cc..f05c8e6ce1 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -10,7 +10,7 @@
#include <inttypes.h>
#include <sys/types.h>
#include <unistd.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdarg.h>
#include <ctype.h>
#include <errno.h>
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 9f38b63cbb..427bc3ab5e 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -3,7 +3,7 @@
*/
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
diff --git a/examples/cmdline/main.c b/examples/cmdline/main.c
index c04a782507..73ac631901 100644
--- a/examples/cmdline/main.c
+++ b/examples/cmdline/main.c
@@ -8,7 +8,6 @@
#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <sys/queue.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
diff --git a/examples/cmdline/parse_obj_list.h b/examples/cmdline/parse_obj_list.h
index 1223ac1e8b..38a6a77f64 100644
--- a/examples/cmdline/parse_obj_list.h
+++ b/examples/cmdline/parse_obj_list.h
@@ -10,7 +10,7 @@
/* This file is an example of extension of libcmdline. It provides an
* example of objects stored in a list. */
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <cmdline_parse.h>
#include <cmdline_parse_string.h>
diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
index 13ad17a712..51d8d22900 100644
--- a/examples/flow_filtering/main.c
+++ b/examples/flow_filtering/main.c
@@ -8,7 +8,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/queue.h>
#include <setjmp.h>
#include <stdarg.h>
#include <ctype.h>
diff --git a/examples/helloworld/main.c b/examples/helloworld/main.c
index af509138da..d53caff23c 100644
--- a/examples/helloworld/main.c
+++ b/examples/helloworld/main.c
@@ -6,7 +6,7 @@
#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_memory.h>
#include <rte_launch.h>
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 1f84102844..f4106288fc 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -9,7 +9,7 @@
#include <sys/types.h>
#include <sys/param.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
diff --git a/examples/ip_pipeline/action.h b/examples/ip_pipeline/action.h
index cde17e69a3..c9c400ba9b 100644
--- a/examples/ip_pipeline/action.h
+++ b/examples/ip_pipeline/action.h
@@ -5,7 +5,7 @@
#ifndef _INCLUDE_ACTION_H_
#define _INCLUDE_ACTION_H_
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_port_in_action.h>
#include <rte_table_action.h>
diff --git a/examples/ip_pipeline/cryptodev.h b/examples/ip_pipeline/cryptodev.h
index d00434379e..b9b241045d 100644
--- a/examples/ip_pipeline/cryptodev.h
+++ b/examples/ip_pipeline/cryptodev.h
@@ -6,7 +6,7 @@
#define _INCLUDE_SYM_C_H_
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_cryptodev.h>
diff --git a/examples/ip_pipeline/link.h b/examples/ip_pipeline/link.h
index 34ff1149e0..462f1c1e1b 100644
--- a/examples/ip_pipeline/link.h
+++ b/examples/ip_pipeline/link.h
@@ -6,7 +6,7 @@
#define _INCLUDE_LINK_H_
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include "common.h"
diff --git a/examples/ip_pipeline/mempool.h b/examples/ip_pipeline/mempool.h
index bd46a11ca0..9dc359d2cb 100644
--- a/examples/ip_pipeline/mempool.h
+++ b/examples/ip_pipeline/mempool.h
@@ -6,7 +6,7 @@
#define _INCLUDE_MEMPOOL_H_
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_mempool.h>
diff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h
index 89696480fc..da91c53a08 100644
--- a/examples/ip_pipeline/pipeline.h
+++ b/examples/ip_pipeline/pipeline.h
@@ -6,7 +6,7 @@
#define _INCLUDE_PIPELINE_H_
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_pipeline.h>
#include <rte_table_action.h>
diff --git a/examples/ip_pipeline/swq.h b/examples/ip_pipeline/swq.h
index c8440ee3cd..8733db2da8 100644
--- a/examples/ip_pipeline/swq.h
+++ b/examples/ip_pipeline/swq.h
@@ -6,7 +6,7 @@
#define _INCLUDE_SWQ_H_
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_ring.h>
diff --git a/examples/ip_pipeline/tap.h b/examples/ip_pipeline/tap.h
index 0dce72fe3c..f8a164b787 100644
--- a/examples/ip_pipeline/tap.h
+++ b/examples/ip_pipeline/tap.h
@@ -5,7 +5,7 @@
#ifndef _INCLUDE_TAP_H_
#define _INCLUDE_TAP_H_
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include "common.h"
diff --git a/examples/ip_pipeline/tmgr.h b/examples/ip_pipeline/tmgr.h
index 1994c55bcc..e8178e6f62 100644
--- a/examples/ip_pipeline/tmgr.h
+++ b/examples/ip_pipeline/tmgr.h
@@ -6,7 +6,7 @@
#define _INCLUDE_TMGR_H_
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_sched.h>
#include <rte_red.h>
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 17ae76d4ba..3723408ad4 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -8,7 +8,7 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index fe489f9a56..0940ca89c5 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -12,7 +12,7 @@
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdarg.h>
#include <errno.h>
#include <signal.h>
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index 1eed645d02..1cb00c65aa 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -8,7 +8,7 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index a441312f55..320838e86d 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -9,7 +9,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <netinet/in.h>
#include <setjmp.h>
#include <stdarg.h>
diff --git a/examples/l2fwd-event/l2fwd_common.h b/examples/l2fwd-event/l2fwd_common.h
index 8cf91b919c..3703ed3329 100644
--- a/examples/l2fwd-event/l2fwd_common.h
+++ b/examples/l2fwd-event/l2fwd_common.h
@@ -11,7 +11,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/queue.h>
#include <netinet/in.h>
#include <setjmp.h>
#include <stdarg.h>
diff --git a/examples/l2fwd-keepalive/ka-agent/main.c b/examples/l2fwd-keepalive/ka-agent/main.c
index b8a755dbd5..4afbb0897f 100644
--- a/examples/l2fwd-keepalive/ka-agent/main.c
+++ b/examples/l2fwd-keepalive/ka-agent/main.c
@@ -9,7 +9,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
-#include <sys/queue.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <time.h>
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index bff2b99531..985dc30184 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -8,7 +8,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <netinet/in.h>
#include <setjmp.h>
#include <stdarg.h>
diff --git a/examples/l2fwd-macsec/main.c b/examples/l2fwd-macsec/main.c
index 73e32fc197..4563773342 100644
--- a/examples/l2fwd-macsec/main.c
+++ b/examples/l2fwd-macsec/main.c
@@ -8,7 +8,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <setjmp.h>
#include <stdarg.h>
#include <ctype.h>
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index c6fafdd019..8365280734 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -8,7 +8,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <setjmp.h>
#include <stdarg.h>
#include <ctype.h>
diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c
index 92cdaa1ebe..8bac44209b 100644
--- a/examples/l3fwd-graph/main.c
+++ b/examples/l3fwd-graph/main.c
@@ -15,7 +15,7 @@
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <unistd.h>
#include <rte_branch_prediction.h>
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index e27b8531b5..6c923062b3 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -8,7 +8,7 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index da9c45e3a4..f3af71adba 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -8,7 +8,6 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index fec0aeb79c..ba23a0f32a 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -8,7 +8,6 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index ae3b4f6439..ce0418dfb4 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -8,7 +8,7 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index ac9c7f6217..d37f4fbc87 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -8,7 +8,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <setjmp.h>
#include <stdarg.h>
#include <ctype.h>
diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
index 087c38ef73..0d0aad5c07 100644
--- a/examples/multi_process/client_server_mp/mp_client/client.c
+++ b/examples/multi_process/client_server_mp/mp_client/client.c
@@ -7,7 +7,6 @@
#include <inttypes.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 65713dbea8..6b06754205 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -6,7 +6,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/queue.h>
#include <errno.h>
#include <stdarg.h>
#include <inttypes.h>
diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c
index ebfc2febc5..5de8183767 100644
--- a/examples/multi_process/client_server_mp/mp_server/main.c
+++ b/examples/multi_process/client_server_mp/mp_server/main.c
@@ -9,7 +9,7 @@
#include <stdint.h>
#include <stdarg.h>
#include <inttypes.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <errno.h>
#include <signal.h>
diff --git a/examples/multi_process/hotplug_mp/main.c b/examples/multi_process/hotplug_mp/main.c
index d668580784..cfdcbe7329 100644
--- a/examples/multi_process/hotplug_mp/main.c
+++ b/examples/multi_process/hotplug_mp/main.c
@@ -7,7 +7,6 @@
#include <stdint.h>
#include <errno.h>
#include <termios.h>
-#include <sys/queue.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
diff --git a/examples/multi_process/simple_mp/main.c b/examples/multi_process/simple_mp/main.c
index d73d1358ff..7d033dbd9b 100644
--- a/examples/multi_process/simple_mp/main.c
+++ b/examples/multi_process/simple_mp/main.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <unistd.h>
#include <termios.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_memory.h>
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index f7d8439cd4..d1d553dd8a 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <getopt.h>
#include <signal.h>
#include <inttypes.h>
diff --git a/examples/server_node_efd/efd_node/node.c b/examples/server_node_efd/efd_node/node.c
index fc2aa5ffef..4ae218ebf7 100644
--- a/examples/server_node_efd/efd_node/node.c
+++ b/examples/server_node_efd/efd_node/node.c
@@ -7,7 +7,6 @@
#include <inttypes.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
diff --git a/examples/server_node_efd/efd_server/init.c b/examples/server_node_efd/efd_server/init.c
index 9c89f6b60d..d6ded10edf 100644
--- a/examples/server_node_efd/efd_server/init.c
+++ b/examples/server_node_efd/efd_server/init.c
@@ -6,7 +6,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/queue.h>
#include <errno.h>
#include <stdarg.h>
#include <inttypes.h>
diff --git a/examples/server_node_efd/efd_server/main.c b/examples/server_node_efd/efd_server/main.c
index 75ff0ea532..367fac156c 100644
--- a/examples/server_node_efd/efd_server/main.c
+++ b/examples/server_node_efd/efd_server/main.c
@@ -9,7 +9,6 @@
#include <stdint.h>
#include <stdarg.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <errno.h>
#include <sys/types.h>
#include <netinet/in.h>
diff --git a/examples/service_cores/main.c b/examples/service_cores/main.c
index 9f52082254..b1d34466d3 100644
--- a/examples/service_cores/main.c
+++ b/examples/service_cores/main.c
@@ -7,7 +7,6 @@
#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <sys/queue.h>
#include <rte_memory.h>
#include <rte_launch.h>
diff --git a/examples/timer/main.c b/examples/timer/main.c
index a349846c7c..872c05c7c5 100644
--- a/examples/timer/main.c
+++ b/examples/timer/main.c
@@ -6,7 +6,7 @@
#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_memory.h>
diff --git a/examples/vhost/main.h b/examples/vhost/main.h
index c986cbc5a9..2c04576336 100644
--- a/examples/vhost/main.h
+++ b/examples/vhost/main.h
@@ -5,7 +5,7 @@
#ifndef _MAIN_H_
#define _MAIN_H_
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_ether.h>
#include <rte_pci.h>
diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index 7d7efdd05a..74201f8b23 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -10,7 +10,7 @@
#include <dirent.h>
#include <errno.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 800f733a26..4b66594139 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -13,7 +13,7 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/epoll.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/select.h>
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index c141382020..910cc76670 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -12,7 +12,7 @@
#include <signal.h>
#include <errno.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_eal.h>
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index 4a3ce6884c..50d5348651 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -3,7 +3,7 @@
*/
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 4ccc2fe4b0..e5ce027f79 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -3,7 +3,7 @@
*/
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 13/47] hash: do not include sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (11 preceding siblings ...)
2025-08-18 23:27 ` [RFC 12/47] examples: replace use of sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 14/47] lpm: " Stephen Hemminger
` (33 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
Vladimir Medvedkin
The necessary TAILQ macros are in rte_tailq.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/hash/rte_cuckoo_hash.c | 1 -
lib/hash/rte_fbk_hash.c | 1 -
lib/hash/rte_thash.c | 1 -
3 files changed, 3 deletions(-)
diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
index 2c92c51624..dbc0ddcf75 100644
--- a/lib/hash/rte_cuckoo_hash.c
+++ b/lib/hash/rte_cuckoo_hash.c
@@ -7,7 +7,6 @@
#include <stdint.h>
#include <errno.h>
#include <stdio.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_common.h>
diff --git a/lib/hash/rte_fbk_hash.c b/lib/hash/rte_fbk_hash.c
index 38b15a14d1..c4027bee26 100644
--- a/lib/hash/rte_fbk_hash.c
+++ b/lib/hash/rte_fbk_hash.c
@@ -6,7 +6,6 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_cpuflags.h>
diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index 6c662bf14f..63930f67be 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -3,7 +3,6 @@
*/
#include <stdalign.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_thash.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 14/47] lpm: do not include sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (12 preceding siblings ...)
2025-08-18 23:27 ` [RFC 13/47] hash: do not include sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 15/47] log: replace use of sys/queue.h Stephen Hemminger
` (32 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Bruce Richardson, Vladimir Medvedkin
The necessary macros are in rte_tailq.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/lpm/rte_lpm.c | 1 -
lib/lpm/rte_lpm6.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
index 6dab86a05e..09d1e08263 100644
--- a/lib/lpm/rte_lpm.c
+++ b/lib/lpm/rte_lpm.c
@@ -7,7 +7,6 @@
#include <stdint.h>
#include <errno.h>
#include <stdio.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_log.h>
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index e23c886766..781ec8de0b 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -6,7 +6,6 @@
#include <stdint.h>
#include <errno.h>
#include <stdio.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_log.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 15/47] log: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (13 preceding siblings ...)
2025-08-18 23:27 ` [RFC 14/47] lpm: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 16/47] ethdev: " Stephen Hemminger
` (31 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
Use bsd_queue.h instead.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/log/log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/log/log.c b/lib/log/log.c
index 8ad5250a13..63289dd9a6 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -11,9 +11,9 @@
#include <errno.h>
#include <regex.h>
#include <fnmatch.h>
-#include <sys/queue.h>
#include <unistd.h>
+#include <bsd_queue.h>
#include <eal_export.h>
#include <rte_common.h>
#include <rte_log.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 16/47] ethdev: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (14 preceding siblings ...)
2025-08-18 23:27 ` [RFC 15/47] log: replace use of sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 17/47] bpf: " Stephen Hemminger
` (30 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Thomas Monjalon, Andrew Rybchenko
Use bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ethdev/ethdev_private.h | 3 +--
lib/ethdev/rte_ethdev.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/ethdev/ethdev_private.h b/lib/ethdev/ethdev_private.h
index b07b1b4c42..a994833760 100644
--- a/lib/ethdev/ethdev_private.h
+++ b/lib/ethdev/ethdev_private.h
@@ -5,8 +5,7 @@
#ifndef _ETH_PRIVATE_H_
#define _ETH_PRIVATE_H_
-#include <sys/queue.h>
-
+#include <bsd_queue.h>
#include <rte_eal_memconfig.h>
#include <rte_malloc.h>
#include <rte_os_shim.h>
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index dd7c00bc94..42561a01b8 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -9,8 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <bus_driver.h>
#include <eal_export.h>
#include <rte_log.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 17/47] bpf: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (15 preceding siblings ...)
2025-08-18 23:27 ` [RFC 16/47] ethdev: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 18/47] mempool: do not need sys/queue.h Stephen Hemminger
` (29 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Konstantin Ananyev
Use new bsd_queue.h instead.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/bpf/bpf_load_elf.c | 1 -
lib/bpf/bpf_pkt.c | 3 +--
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/bpf/bpf_load_elf.c b/lib/bpf/bpf_load_elf.c
index 1d30ba17e2..4e911c5083 100644
--- a/lib/bpf/bpf_load_elf.c
+++ b/lib/bpf/bpf_load_elf.c
@@ -12,7 +12,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/queue.h>
#include <fcntl.h>
#include <libelf.h>
diff --git a/lib/bpf/bpf_pkt.c b/lib/bpf/bpf_pkt.c
index 01f813c56b..fca082ac53 100644
--- a/lib/bpf/bpf_pkt.c
+++ b/lib/bpf/bpf_pkt.c
@@ -7,8 +7,7 @@
#include <errno.h>
#include <stdint.h>
-#include <sys/queue.h>
-
+#include <bsd_queue.h>
#include <eal_export.h>
#include <rte_common.h>
#include <rte_malloc.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 18/47] mempool: do not need sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (16 preceding siblings ...)
2025-08-18 23:27 ` [RFC 17/47] bpf: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 19/47] lib: remove use of sys/queue.h Stephen Hemminger
` (28 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Andrew Rybchenko, Morten Brørup
The necessary tailq macros are in rte_tailq.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/mempool/rte_mempool.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 1021ede0c2..bf8e870151 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -12,7 +12,6 @@
#include <unistd.h>
#include <inttypes.h>
#include <errno.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_common.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 19/47] lib: remove use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (17 preceding siblings ...)
2025-08-18 23:27 ` [RFC 18/47] mempool: do not need sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 20/47] bus/fslmc: use rte_tailq.h Stephen Hemminger
` (27 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Konstantin Ananyev, Nicolas Chautru,
Akhil Goyal, Fan Zhang, David Hunt, Byron Marohn, Yipeng Wang,
Vladimir Medvedkin, Elena Agostini, Jerin Jacob, Kiran Kumar K,
Nithin Dabilpuram, Zhirun Yan, Cristian Dumitrescu,
Tomasz Duszynski, Volodymyr Fialko, Honnappa Nagarahalli,
Maxime Coquelin, Chenbo Xia
Use the new bsd_queue.h where needed but most files already
get the needed macros from rte_tailq.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/acl/rte_acl_osdep.h | 1 -
lib/bbdev/rte_bbdev.c | 2 +-
lib/cryptodev/cryptodev_pmd.c | 1 -
lib/cryptodev/rte_cryptodev.c | 1 -
lib/distributor/rte_distributor.c | 2 +-
lib/distributor/rte_distributor_single.c | 2 +-
lib/efd/rte_efd.c | 1 -
lib/fib/rte_fib.c | 1 -
lib/fib/rte_fib6.c | 1 -
lib/gpudev/gpudev_driver.h | 1 -
lib/graph/graph_private.h | 1 -
lib/ip_frag/ip_frag_common.h | 3 +--
lib/mbuf/rte_mbuf_dyn.c | 1 -
lib/pipeline/rte_swx_ctl.c | 1 -
lib/pipeline/rte_swx_pipeline_internal.h | 3 ++-
lib/pmu/pmu.c | 1 -
lib/reorder/rte_reorder.c | 1 -
lib/rib/rte_rib.c | 1 -
lib/rib/rte_rib6.c | 1 -
lib/ring/rte_ring.c | 1 -
lib/stack/rte_stack.c | 1 -
lib/vhost/fd_man.h | 1 -
lib/vhost/socket.c | 2 +-
lib/vhost/vdpa.c | 2 --
lib/vhost/vhost.h | 2 +-
25 files changed, 8 insertions(+), 27 deletions(-)
diff --git a/lib/acl/rte_acl_osdep.h b/lib/acl/rte_acl_osdep.h
index b2c262dee7..96e4f2908c 100644
--- a/lib/acl/rte_acl_osdep.h
+++ b/lib/acl/rte_acl_osdep.h
@@ -21,7 +21,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
-#include <sys/queue.h>
/*
* Common defines.
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index e0f8c8eb0d..a781c7d14c 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -5,8 +5,8 @@
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <eal_export.h>
#include <rte_common.h>
#include <rte_errno.h>
diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index d79d561bf6..1c6292ed1c 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -3,7 +3,6 @@
*/
#include <stdlib.h>
-#include <sys/queue.h>
#include <dev_driver.h>
#include <eal_export.h>
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index bb7bab4dd5..833f809c03 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -2,7 +2,6 @@
* Copyright(c) 2015-2020 Intel Corporation
*/
-#include <sys/queue.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/distributor/rte_distributor.c b/lib/distributor/rte_distributor.c
index dde7ce2677..49ce882cdb 100644
--- a/lib/distributor/rte_distributor.c
+++ b/lib/distributor/rte_distributor.c
@@ -5,8 +5,8 @@
#include <stdalign.h>
#include <stdio.h>
#include <stdlib.h>
-#include <sys/queue.h>
#include <string.h>
+
#include <eal_export.h>
#include <rte_mbuf.h>
#include <rte_cycles.h>
diff --git a/lib/distributor/rte_distributor_single.c b/lib/distributor/rte_distributor_single.c
index d4b3e12648..804d6b8a71 100644
--- a/lib/distributor/rte_distributor_single.c
+++ b/lib/distributor/rte_distributor_single.c
@@ -3,7 +3,7 @@
*/
#include <stdio.h>
-#include <sys/queue.h>
+
#include <rte_mbuf.h>
#include <rte_memzone.h>
#include <rte_errno.h>
diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index b0e44e5c51..d7abdda303 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -7,7 +7,6 @@
#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_cpuflags.h>
diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c
index 184210f380..e3da524236 100644
--- a/lib/fib/rte_fib.c
+++ b/lib/fib/rte_fib.c
@@ -5,7 +5,6 @@
#include <stdint.h>
#include <string.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_eal_memconfig.h>
diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index 93a1c7197b..b351d8cd69 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -5,7 +5,6 @@
#include <stdint.h>
#include <string.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_eal_memconfig.h>
diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h
index 37b6ae3149..6478814fce 100644
--- a/lib/gpudev/gpudev_driver.h
+++ b/lib/gpudev/gpudev_driver.h
@@ -12,7 +12,6 @@
#define RTE_GPUDEV_DRIVER_H
#include <stdint.h>
-#include <sys/queue.h>
#include <dev_driver.h>
diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h
index 21912c0ae6..db74ff41d2 100644
--- a/lib/graph/graph_private.h
+++ b/lib/graph/graph_private.h
@@ -6,7 +6,6 @@
#define _RTE_GRAPH_PRIVATE_H_
#include <inttypes.h>
-#include <sys/queue.h>
#include <rte_common.h>
#include <rte_eal.h>
diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index 51fc9d47fb..72128b0241 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -5,8 +5,7 @@
#ifndef _IP_FRAG_COMMON_H_
#define _IP_FRAG_COMMON_H_
-#include <sys/queue.h>
-
+#include <bsd_queue.h>
#include <rte_common.h>
#if defined(RTE_ARCH_ARM64)
diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index 5987c9dee8..9a20033021 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -3,7 +3,6 @@
*/
#include <stdalign.h>
-#include <sys/queue.h>
#include <stdint.h>
#include <limits.h>
diff --git a/lib/pipeline/rte_swx_ctl.c b/lib/pipeline/rte_swx_ctl.c
index 4e9bb842a1..ca44adb126 100644
--- a/lib/pipeline/rte_swx_ctl.c
+++ b/lib/pipeline/rte_swx_ctl.c
@@ -5,7 +5,6 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <sys/queue.h>
#include <unistd.h>
#include <eal_export.h>
diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h
index df864ea066..fa8dfa7d75 100644
--- a/lib/pipeline/rte_swx_pipeline_internal.h
+++ b/lib/pipeline/rte_swx_pipeline_internal.h
@@ -6,7 +6,7 @@
#include <inttypes.h>
#include <string.h>
-#include <sys/queue.h>
+
#include <rte_bitops.h>
#include <rte_byteorder.h>
@@ -14,6 +14,7 @@
#include <rte_cycles.h>
#include <rte_prefetch.h>
#include <rte_meter.h>
+#include <rte_tailq.h>
#include <rte_swx_table_selector.h>
#include <rte_swx_table_learner.h>
diff --git a/lib/pmu/pmu.c b/lib/pmu/pmu.c
index 4c7271522a..6a18563c80 100644
--- a/lib/pmu/pmu.c
+++ b/lib/pmu/pmu.c
@@ -8,7 +8,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
-#include <sys/queue.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>
diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c
index be06530860..1c4751bee0 100644
--- a/lib/reorder/rte_reorder.c
+++ b/lib/reorder/rte_reorder.c
@@ -4,7 +4,6 @@
#include <stdalign.h>
#include <string.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_string_fns.h>
diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c
index 046db131ca..bfb4c0e577 100644
--- a/lib/rib/rte_rib.c
+++ b/lib/rib/rte_rib.c
@@ -5,7 +5,6 @@
#include <stdbool.h>
#include <stdint.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_eal_memconfig.h>
diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c
index ded5fd044f..1efe19e97c 100644
--- a/lib/rib/rte_rib6.c
+++ b/lib/rib/rte_rib6.c
@@ -5,7 +5,6 @@
#include <stdbool.h>
#include <stdint.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_eal_memconfig.h>
diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
index edd63aa535..b63820dcd2 100644
--- a/lib/ring/rte_ring.c
+++ b/lib/ring/rte_ring.c
@@ -13,7 +13,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <errno.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_common.h>
diff --git a/lib/stack/rte_stack.c b/lib/stack/rte_stack.c
index 4c78fe4b4b..0b9223cd3f 100644
--- a/lib/stack/rte_stack.c
+++ b/lib/stack/rte_stack.c
@@ -4,7 +4,6 @@
#include <stdalign.h>
#include <string.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_string_fns.h>
diff --git a/lib/vhost/fd_man.h b/lib/vhost/fd_man.h
index eadcc6fb42..0f3f8fb430 100644
--- a/lib/vhost/fd_man.h
+++ b/lib/vhost/fd_man.h
@@ -6,7 +6,6 @@
#define _FD_MAN_H_
#include <pthread.h>
#include <poll.h>
-#include <sys/queue.h>
struct fdset;
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 9b4f332f94..107933bfd7 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -10,13 +10,13 @@
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>
-#include <sys/queue.h>
#include <errno.h>
#include <fcntl.h>
#include <eal_export.h>
#include <rte_thread.h>
#include <rte_log.h>
+#include <rte_tailq.h>
#include "fd_man.h"
#include "vduse.h"
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index bc2dd8d2e1..4e5fcf02be 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -8,8 +8,6 @@
* Device specific vhost lib
*/
-#include <sys/queue.h>
-
#include <dev_driver.h>
#include <eal_export.h>
#include <rte_class.h>
diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h
index 6ffc3f20c1..d42796a509 100644
--- a/lib/vhost/vhost.h
+++ b/lib/vhost/vhost.h
@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
-#include <sys/queue.h>
#include <unistd.h>
#include <linux/virtio_net.h>
#include <sys/socket.h>
@@ -19,6 +18,7 @@
#include <rte_ether.h>
#include <rte_malloc.h>
#include <rte_dmadev.h>
+#include <rte_tailq.h>
#include "rte_vhost.h"
#include "vdpa_driver.h"
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 20/47] bus/fslmc: use rte_tailq.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (18 preceding siblings ...)
2025-08-18 23:27 ` [RFC 19/47] lib: remove use of sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 21/47] drivers/bus: replace use of sys/queue.h Stephen Hemminger
` (26 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena
Use macros from rte_tailq.h instead using sys/queue.h directly.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/bus/fslmc/bus_fslmc_driver.h | 1 -
drivers/bus/fslmc/fslmc_vfio.c | 1 +
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 11 ++---------
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 442de1a3fb..211864f945 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>
#include <linux/vfio.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 68439cbd8c..d69bbb236c 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -21,6 +21,7 @@
#include <sys/eventfd.h>
#include <ctype.h>
+#include <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 e32471d8b5..8c87d35742 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -15,7 +15,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>
@@ -32,6 +31,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>
@@ -39,13 +39,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)
@@ -105,7 +98,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;
}
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 21/47] drivers/bus: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (19 preceding siblings ...)
2025-08-18 23:27 ` [RFC 20/47] bus/fslmc: use rte_tailq.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 22/47] net/qede: use bsd_queue.h Stephen Hemminger
` (25 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Parav Pandit, Xueming Li, Rosen Xu,
Chenbo Xia, Nipun Gupta, Tomasz Duszynski, Long Li, Wei Hu
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/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 -
11 files changed, 6 insertions(+), 14 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..808426c4a3 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 <bsd_queue.h>
#include "bus_auxiliary_driver.h"
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 c88634f790..2898f8d9c7 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 e7e449306e..18e5f5369e 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>
#include "private.h"
#include "pci_netuio.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 0f50027236..b47c41c18b 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -8,7 +8,6 @@
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <sys/queue.h>
#include <unistd.h>
#include <bus_driver.h>
@@ -21,6 +20,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.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 22/47] net/qede: use bsd_queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (20 preceding siblings ...)
2025-08-18 23:27 ` [RFC 21/47] drivers/bus: replace use of sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 23/47] net/bnxt: remove use of sys/queue.h Stephen Hemminger
` (24 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Devendra Singh Rawat, Alok Prasad
The BSD version has the needed SLIST_FOREACH_SAFE already.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/qede/qede_ethdev.h | 3 +--
drivers/net/qede/qede_filter.c | 6 ------
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index 3015c18504..656d72adfd 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -8,8 +8,7 @@
#ifndef _QEDE_ETHDEV_H_
#define _QEDE_ETHDEV_H_
-#include <sys/queue.h>
-
+#include <bsd_queue.h>
#include <rte_ether.h>
#include <ethdev_driver.h>
#include <ethdev_pci.h>
diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c
index cecb58c997..958ab558f3 100644
--- a/drivers/net/qede/qede_filter.c
+++ b/drivers/net/qede/qede_filter.c
@@ -12,12 +12,6 @@
#include "qede_ethdev.h"
-#ifndef SLIST_FOREACH_SAFE
-#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = SLIST_FIRST((head)); \
- (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
- (var) = (tvar))
-#endif
/* VXLAN tunnel classification mapping */
const struct _qede_udp_tunn_types {
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 23/47] net/bnxt: remove use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (21 preceding siblings ...)
2025-08-18 23:27 ` [RFC 22/47] net/qede: use bsd_queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 24/47] net/intel: " Stephen Hemminger
` (23 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, ajit.khaparde, stable, Somnath Kotur, Kalesh AP
Fix unsafe use after free by using STAILQ_FOREACH_SAFE.
Fixes: e8fe0e067b68 ("net/bnxt: fix allocation of PF info struct")
Cc: ajit.khaparde@broadcom.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bnxt/bnxt.h | 1 -
drivers/net/bnxt/bnxt_filter.c | 7 +++----
drivers/net/bnxt/bnxt_flow.c | 1 -
drivers/net/bnxt/bnxt_vnic.h | 1 -
drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 1 -
drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c | 1 -
6 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index c9fdd36d3e..e9099a3ff2 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -9,7 +9,6 @@
#include <inttypes.h>
#include <stdbool.h>
#include <pthread.h>
-#include <sys/queue.h>
#include <rte_pci.h>
#include <bus_pci_driver.h>
diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index 7b90ba651f..4c44506daa 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -3,8 +3,7 @@
* All rights reserved.
*/
-#include <sys/queue.h>
-
+#include <bsd_queue.h>
#include <rte_byteorder.h>
#include <rte_log.h>
#include <rte_malloc.h>
@@ -110,7 +109,7 @@ void bnxt_free_all_filters(struct bnxt *bp)
void bnxt_free_filter_mem(struct bnxt *bp)
{
- struct bnxt_filter_info *filter;
+ struct bnxt_filter_info *filter, *tmp;
uint16_t max_filters, i;
int rc = 0;
@@ -151,7 +150,7 @@ void bnxt_free_filter_mem(struct bnxt *bp)
bp->filter_info = NULL;
for (i = 0; i < bp->pf->max_vfs; i++) {
- STAILQ_FOREACH(filter, &bp->pf->vf_info[i].filter, next) {
+ STAILQ_FOREACH_SAFE(filter, &bp->pf->vf_info[i].filter, next, tmp) {
rte_free(filter);
STAILQ_REMOVE(&bp->pf->vf_info[i].filter, filter,
bnxt_filter_info, next);
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index a2e590540b..d3da309254 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -3,7 +3,6 @@
* All rights reserved.
*/
-#include <sys/queue.h>
#include <rte_log.h>
#include <rte_malloc.h>
diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h
index 5a4fd4ecb7..be232df2e7 100644
--- a/drivers/net/bnxt/bnxt_vnic.h
+++ b/drivers/net/bnxt/bnxt_vnic.h
@@ -6,7 +6,6 @@
#ifndef _BNXT_VNIC_H_
#define _BNXT_VNIC_H_
-#include <sys/queue.h>
#include <stdbool.h>
#include <rte_hash.h>
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
index e0e31532fd..f8c46186fe 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
@@ -8,7 +8,6 @@
#include <inttypes.h>
#include <stdbool.h>
-#include <sys/queue.h>
#include "rte_version.h"
#include "rte_ethdev.h"
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
index 591bde96e8..cd97bc6635 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
@@ -4,7 +4,6 @@
*/
#include <math.h>
-#include <sys/queue.h>
#include <rte_log.h>
#include <rte_malloc.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 24/47] net/intel: remove use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (22 preceding siblings ...)
2025-08-18 23:27 ` [RFC 23/47] net/bnxt: remove use of sys/queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 25/47] net/mlx5: remove unnecessary include " Stephen Hemminger
` (22 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Praveen Shetty, Bruce Richardson,
Vladimir Medvedkin, Anatoly Burakov, Jingjing Wu, Rosen Xu
For all the drivers, remove use of sys/queue.h if not necessary.
Remove locally defined FOREACH_SAFE macros.
Use bsd_queue.h instead.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/intel/cpfl/cpfl_flow_engine_fxp.c | 1 -
drivers/net/intel/e1000/e1000_ethdev.h | 1 -
drivers/net/intel/e1000/em_ethdev.c | 1 -
drivers/net/intel/e1000/em_rxtx.c | 1 -
drivers/net/intel/e1000/igb_ethdev.c | 2 +-
drivers/net/intel/e1000/igb_flow.c | 2 +-
drivers/net/intel/e1000/igb_rxtx.c | 1 -
drivers/net/intel/i40e/i40e_ethdev.c | 9 +++------
drivers/net/intel/i40e/i40e_ethdev.h | 1 -
drivers/net/intel/i40e/i40e_fdir.c | 2 +-
drivers/net/intel/i40e/i40e_flow.c | 1 -
drivers/net/intel/i40e/i40e_hash.c | 1 -
drivers/net/intel/i40e/i40e_pf.c | 1 -
drivers/net/intel/i40e/i40e_rxtx.c | 1 -
drivers/net/intel/iavf/iavf.h | 1 -
drivers/net/intel/iavf/iavf_ethdev.c | 1 -
drivers/net/intel/iavf/iavf_fdir.c | 1 -
drivers/net/intel/iavf/iavf_fsub.c | 1 -
drivers/net/intel/iavf/iavf_generic_flow.c | 1 -
drivers/net/intel/iavf/iavf_hash.c | 1 -
drivers/net/intel/iavf/iavf_rxtx.c | 1 -
drivers/net/intel/iavf/iavf_vchnl.c | 7 -------
drivers/net/intel/ice/base/ice_osdep.h | 2 +-
drivers/net/intel/ice/ice_acl_filter.c | 1 -
drivers/net/intel/ice/ice_dcf.c | 2 +-
drivers/net/intel/ice/ice_dcf_ethdev.c | 1 -
drivers/net/intel/ice/ice_ethdev.c | 8 ++------
drivers/net/intel/ice/ice_generic_flow.c | 1 -
drivers/net/intel/ice/ice_hash.c | 1 -
drivers/net/intel/ice/ice_switch_filter.c | 1 -
drivers/net/intel/idpf/base/idpf_osdep.h | 9 +--------
drivers/net/intel/ipn3ke/ipn3ke_ethdev.h | 1 -
drivers/net/intel/ipn3ke/ipn3ke_flow.c | 1 -
drivers/net/intel/ixgbe/ixgbe_ethdev.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_ethdev.h | 1 -
drivers/net/intel/ixgbe/ixgbe_fdir.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_flow.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_rxtx.c | 1 -
38 files changed, 14 insertions(+), 61 deletions(-)
diff --git a/drivers/net/intel/cpfl/cpfl_flow_engine_fxp.c b/drivers/net/intel/cpfl/cpfl_flow_engine_fxp.c
index 689ed82f18..98e7678a65 100644
--- a/drivers/net/intel/cpfl/cpfl_flow_engine_fxp.c
+++ b/drivers/net/intel/cpfl/cpfl_flow_engine_fxp.c
@@ -2,7 +2,6 @@
* Copyright(c) 2022 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/e1000/e1000_ethdev.h b/drivers/net/intel/e1000/e1000_ethdev.h
index 339ae1f4b6..f80afdffdc 100644
--- a/drivers/net/intel/e1000/e1000_ethdev.h
+++ b/drivers/net/intel/e1000/e1000_ethdev.h
@@ -6,7 +6,6 @@
#define _E1000_ETHDEV_H_
#include <stdint.h>
-#include <sys/queue.h>
#include <rte_flow.h>
#include <rte_time.h>
diff --git a/drivers/net/intel/e1000/em_ethdev.c b/drivers/net/intel/e1000/em_ethdev.c
index 39dddf3384..e14adddcab 100644
--- a/drivers/net/intel/e1000/em_ethdev.c
+++ b/drivers/net/intel/e1000/em_ethdev.c
@@ -2,7 +2,6 @@
* Copyright(c) 2010-2016 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/e1000/em_rxtx.c b/drivers/net/intel/e1000/em_rxtx.c
index e3d8967a5c..d22495a436 100644
--- a/drivers/net/intel/e1000/em_rxtx.c
+++ b/drivers/net/intel/e1000/em_rxtx.c
@@ -2,7 +2,6 @@
* Copyright(c) 2010-2016 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/drivers/net/intel/e1000/igb_ethdev.c b/drivers/net/intel/e1000/igb_ethdev.c
index 124cf75762..255e09e5fd 100644
--- a/drivers/net/intel/e1000/igb_ethdev.c
+++ b/drivers/net/intel/e1000/igb_ethdev.c
@@ -2,7 +2,7 @@
* Copyright(c) 2010-2016 Intel Corporation
*/
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/e1000/igb_flow.c b/drivers/net/intel/e1000/igb_flow.c
index ea9b290e1c..0f28603ce0 100644
--- a/drivers/net/intel/e1000/igb_flow.c
+++ b/drivers/net/intel/e1000/igb_flow.c
@@ -2,7 +2,7 @@
* Copyright(c) 2010-2016 Intel Corporation
*/
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/e1000/igb_rxtx.c b/drivers/net/intel/e1000/igb_rxtx.c
index b63de2354f..b045d80e53 100644
--- a/drivers/net/intel/e1000/igb_rxtx.c
+++ b/drivers/net/intel/e1000/igb_rxtx.c
@@ -2,7 +2,6 @@
* Copyright(c) 2010-2016 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index 7a562a6e0b..50c6e82d30 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -12,6 +12,7 @@
#include <inttypes.h>
#include <assert.h>
+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_eal.h>
#include <rte_string_fns.h>
@@ -5097,16 +5098,12 @@ i40e_res_pool_destroy(struct i40e_res_pool_info *pool)
if (pool == NULL)
return;
- for (entry = LIST_FIRST(&pool->alloc_list);
- entry && (next_entry = LIST_NEXT(entry, next), 1);
- entry = next_entry) {
+ LIST_FOREACH_SAFE(entry, &pool->alloc_list, next, next_entry) {
LIST_REMOVE(entry, next);
rte_free(entry);
}
- for (entry = LIST_FIRST(&pool->free_list);
- entry && (next_entry = LIST_NEXT(entry, next), 1);
- entry = next_entry) {
+ LIST_FOREACH_SAFE(entry, &pool->free_list, next, next_entry) {
LIST_REMOVE(entry, next);
rte_free(entry);
}
diff --git a/drivers/net/intel/i40e/i40e_ethdev.h b/drivers/net/intel/i40e/i40e_ethdev.h
index 44864292d0..7d20bd301b 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.h
+++ b/drivers/net/intel/i40e/i40e_ethdev.h
@@ -6,7 +6,6 @@
#define _I40E_ETHDEV_H_
#include <stdint.h>
-#include <sys/queue.h>
#include <rte_time.h>
#include <rte_kvargs.h>
diff --git a/drivers/net/intel/i40e/i40e_fdir.c b/drivers/net/intel/i40e/i40e_fdir.c
index 55d18c5d4a..746e7859a9 100644
--- a/drivers/net/intel/i40e/i40e_fdir.c
+++ b/drivers/net/intel/i40e/i40e_fdir.c
@@ -2,7 +2,7 @@
* Copyright(c) 2010-2015 Intel Corporation
*/
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/i40e/i40e_flow.c b/drivers/net/intel/i40e/i40e_flow.c
index f130f53ae0..5f7b69c72f 100644
--- a/drivers/net/intel/i40e/i40e_flow.c
+++ b/drivers/net/intel/i40e/i40e_flow.c
@@ -2,7 +2,6 @@
* Copyright(c) 2016-2017 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/i40e/i40e_hash.c b/drivers/net/intel/i40e/i40e_hash.c
index 02e1457d80..71658fce8d 100644
--- a/drivers/net/intel/i40e/i40e_hash.c
+++ b/drivers/net/intel/i40e/i40e_hash.c
@@ -2,7 +2,6 @@
* Copyright(c) 2020 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/i40e/i40e_pf.c b/drivers/net/intel/i40e/i40e_pf.c
index ebe1deeade..06a468d388 100644
--- a/drivers/net/intel/i40e/i40e_pf.c
+++ b/drivers/net/intel/i40e/i40e_pf.c
@@ -2,7 +2,6 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/i40e/i40e_rxtx.c b/drivers/net/intel/i40e/i40e_rxtx.c
index aba3c11ee5..e60e54c029 100644
--- a/drivers/net/intel/i40e/i40e_rxtx.c
+++ b/drivers/net/intel/i40e/i40e_rxtx.c
@@ -10,7 +10,6 @@
#include <stdarg.h>
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <rte_string_fns.h>
#include <rte_memzone.h>
diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
index f81c939c96..485c9968f8 100644
--- a/drivers/net/intel/iavf/iavf.h
+++ b/drivers/net/intel/iavf/iavf.h
@@ -5,7 +5,6 @@
#ifndef _IAVF_ETHDEV_H_
#define _IAVF_ETHDEV_H_
-#include <sys/queue.h>
#include <rte_kvargs.h>
#include <rte_tm_driver.h>
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 335a8126c4..e517047bf4 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -3,7 +3,6 @@
*/
#include <ctype.h>
-#include <sys/queue.h>
#include <stdalign.h>
#include <stdio.h>
#include <errno.h>
diff --git a/drivers/net/intel/iavf/iavf_fdir.c b/drivers/net/intel/iavf/iavf_fdir.c
index 3213464254..7b418c6604 100644
--- a/drivers/net/intel/iavf/iavf_fdir.c
+++ b/drivers/net/intel/iavf/iavf_fdir.c
@@ -2,7 +2,6 @@
* Copyright(c) 2020 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/iavf/iavf_fsub.c b/drivers/net/intel/iavf/iavf_fsub.c
index eb5a3feab1..12d59fb05c 100644
--- a/drivers/net/intel/iavf/iavf_fsub.c
+++ b/drivers/net/intel/iavf/iavf_fsub.c
@@ -2,7 +2,6 @@
* Copyright(c) 2022 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/iavf/iavf_generic_flow.c b/drivers/net/intel/iavf/iavf_generic_flow.c
index 6f6e95fc45..8f52b43b7c 100644
--- a/drivers/net/intel/iavf/iavf_generic_flow.c
+++ b/drivers/net/intel/iavf/iavf_generic_flow.c
@@ -2,7 +2,6 @@
* Copyright(c) 2019 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/iavf/iavf_hash.c b/drivers/net/intel/iavf/iavf_hash.c
index 217f0500ab..212048adf9 100644
--- a/drivers/net/intel/iavf/iavf_hash.c
+++ b/drivers/net/intel/iavf/iavf_hash.c
@@ -2,7 +2,6 @@
* Copyright(c) 2020 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/iavf/iavf_rxtx.c b/drivers/net/intel/iavf/iavf_rxtx.c
index 7033a74610..fee433e595 100644
--- a/drivers/net/intel/iavf/iavf_rxtx.c
+++ b/drivers/net/intel/iavf/iavf_rxtx.c
@@ -10,7 +10,6 @@
#include <stdarg.h>
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <eal_export.h>
#include <rte_string_fns.h>
diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index b1b7a5bf94..bf85a9bc23 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -52,13 +52,6 @@ static struct iavf_event_handler event_handler = {
.fd = {-1, -1},
};
-#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
-
static uint32_t
iavf_dev_event_handle(void *param __rte_unused)
{
diff --git a/drivers/net/intel/ice/base/ice_osdep.h b/drivers/net/intel/ice/base/ice_osdep.h
index 21c460d007..a8168527d0 100644
--- a/drivers/net/intel/ice/base/ice_osdep.h
+++ b/drivers/net/intel/ice/base/ice_osdep.h
@@ -10,9 +10,9 @@
#include <stdio.h>
#include <stdarg.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include <stdbool.h>
+#include <bsd_queue.h>
#include <rte_common.h>
#include <rte_memcpy.h>
#include <rte_malloc.h>
diff --git a/drivers/net/intel/ice/ice_acl_filter.c b/drivers/net/intel/ice/ice_acl_filter.c
index 83cb3e36f9..ad6a9a93ee 100644
--- a/drivers/net/intel/ice/ice_acl_filter.c
+++ b/drivers/net/intel/ice/ice_acl_filter.c
@@ -2,7 +2,6 @@
* Copyright(c) 2020 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/ice/ice_dcf.c b/drivers/net/intel/ice/ice_dcf.c
index 51716a4d5b..ace8f031f4 100644
--- a/drivers/net/intel/ice/ice_dcf.c
+++ b/drivers/net/intel/ice/ice_dcf.c
@@ -2,7 +2,7 @@
* Copyright(c) 2020 Intel Corporation
*/
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/ice/ice_dcf_ethdev.c b/drivers/net/intel/ice/ice_dcf_ethdev.c
index 499062be40..dc192c1a6c 100644
--- a/drivers/net/intel/ice/ice_dcf_ethdev.c
+++ b/drivers/net/intel/ice/ice_dcf_ethdev.c
@@ -4,7 +4,6 @@
#include <errno.h>
#include <stdbool.h>
-#include <sys/queue.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c
index 513777e372..8855af91cb 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -883,16 +883,12 @@ ice_res_pool_destroy(struct ice_res_pool_info *pool)
if (!pool)
return;
- for (entry = LIST_FIRST(&pool->alloc_list);
- entry && (next_entry = LIST_NEXT(entry, next), 1);
- entry = next_entry) {
+ LIST_FOREACH_SAFE(entry, &pool->alloc_list, next, next_entry) {
LIST_REMOVE(entry, next);
rte_free(entry);
}
- for (entry = LIST_FIRST(&pool->free_list);
- entry && (next_entry = LIST_NEXT(entry, next), 1);
- entry = next_entry) {
+ LIST_FOREACH_SAFE(entry, &pool->free_list, next, next_entry) {
LIST_REMOVE(entry, next);
rte_free(entry);
}
diff --git a/drivers/net/intel/ice/ice_generic_flow.c b/drivers/net/intel/ice/ice_generic_flow.c
index 4049157eab..614b8ae280 100644
--- a/drivers/net/intel/ice/ice_generic_flow.c
+++ b/drivers/net/intel/ice/ice_generic_flow.c
@@ -2,7 +2,6 @@
* Copyright(c) 2019 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c
index aa6a21c055..b4516b1510 100644
--- a/drivers/net/intel/ice/ice_hash.c
+++ b/drivers/net/intel/ice/ice_hash.c
@@ -2,7 +2,6 @@
* Copyright(c) 2019 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/ice/ice_switch_filter.c b/drivers/net/intel/ice/ice_switch_filter.c
index 28bc775a2c..a40eafb977 100644
--- a/drivers/net/intel/ice/ice_switch_filter.c
+++ b/drivers/net/intel/ice/ice_switch_filter.c
@@ -2,7 +2,6 @@
* Copyright(c) 2019 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/idpf/base/idpf_osdep.h b/drivers/net/intel/idpf/base/idpf_osdep.h
index 7b43df3079..57e855308c 100644
--- a/drivers/net/intel/idpf/base/idpf_osdep.h
+++ b/drivers/net/intel/idpf/base/idpf_osdep.h
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <inttypes.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdbool.h>
#include <rte_common.h>
@@ -343,13 +343,6 @@ idpf_hweight32(u32 num)
#define LIST_ENTRY_TYPE(type) LIST_ENTRY(type)
#endif
-#ifndef LIST_FOREACH_SAFE
-#define LIST_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = LIST_FIRST((head)); \
- (var) && ((tvar) = LIST_NEXT((var), field), 1); \
- (var) = (tvar))
-#endif
-
#ifndef LIST_FOR_EACH_ENTRY_SAFE
#define LIST_FOR_EACH_ENTRY_SAFE(pos, temp, head, entry_type, list) \
LIST_FOREACH_SAFE(pos, head, list, temp)
diff --git a/drivers/net/intel/ipn3ke/ipn3ke_ethdev.h b/drivers/net/intel/ipn3ke/ipn3ke_ethdev.h
index 4b93d2649e..e285fa65d6 100644
--- a/drivers/net/intel/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/intel/ipn3ke/ipn3ke_ethdev.h
@@ -11,7 +11,6 @@
#include <limits.h>
#include <net/if.h>
#include <netinet/in.h>
-#include <sys/queue.h>
#include <rte_mbuf.h>
#include <rte_flow_driver.h>
diff --git a/drivers/net/intel/ipn3ke/ipn3ke_flow.c b/drivers/net/intel/ipn3ke/ipn3ke_flow.c
index a2f76268b5..843f9f6747 100644
--- a/drivers/net/intel/ipn3ke/ipn3ke_flow.c
+++ b/drivers/net/intel/ipn3ke/ipn3ke_flow.c
@@ -2,7 +2,6 @@
* Copyright(c) 2019 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 4f0343245e..af0e29cdf6 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -2,7 +2,7 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.h b/drivers/net/intel/ixgbe/ixgbe_ethdev.h
index 86da9fc89b..1bc310d85f 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.h
@@ -7,7 +7,6 @@
#include <stdint.h>
#include <stdbool.h>
-#include <sys/queue.h>
#include "base/ixgbe_type.h"
#include "base/ixgbe_dcb.h"
diff --git a/drivers/net/intel/ixgbe/ixgbe_fdir.c b/drivers/net/intel/ixgbe/ixgbe_fdir.c
index b6351bc2cf..de96bd040a 100644
--- a/drivers/net/intel/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/intel/ixgbe/ixgbe_fdir.c
@@ -6,7 +6,7 @@
#include <stdint.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_interrupts.h>
#include <rte_log.h>
diff --git a/drivers/net/intel/ixgbe/ixgbe_flow.c b/drivers/net/intel/ixgbe/ixgbe_flow.c
index 6278646720..a251cd75a0 100644
--- a/drivers/net/intel/ixgbe/ixgbe_flow.c
+++ b/drivers/net/intel/ixgbe/ixgbe_flow.c
@@ -2,7 +2,7 @@
* Copyright(c) 2010-2016 Intel Corporation
*/
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/intel/ixgbe/ixgbe_rxtx.c b/drivers/net/intel/ixgbe/ixgbe_rxtx.c
index bbe665a6ff..fd5841c70d 100644
--- a/drivers/net/intel/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/intel/ixgbe/ixgbe_rxtx.c
@@ -3,7 +3,6 @@
* Copyright 2014 6WIND S.A.
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 25/47] net/mlx5: remove unnecessary include of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (23 preceding siblings ...)
2025-08-18 23:27 ` [RFC 24/47] net/intel: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 26/47] net/tap: " Stephen Hemminger
` (21 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Dariusz Sosnowski, Viacheslav Ovsiienko,
Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad
Already handled by rte_tailq.h in most places.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/mlx5/hws/mlx5dr_internal.h | 1 -
drivers/net/mlx5/linux/mlx5_verbs.c | 1 -
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_devx.c | 1 -
drivers/net/mlx5/mlx5_flow.c | 2 +-
drivers/net/mlx5/mlx5_flow.h | 2 +-
drivers/net/mlx5/mlx5_flow_dv.c | 1 -
drivers/net/mlx5/mlx5_flow_verbs.c | 2 +-
drivers/net/mlx5/mlx5_rx.h | 1 -
drivers/net/mlx5/mlx5_rxq.c | 2 +-
drivers/net/mlx5/mlx5_rxtx.h | 1 -
drivers/net/mlx5/mlx5_tx.h | 1 -
12 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_internal.h b/drivers/net/mlx5/hws/mlx5dr_internal.h
index 2abc516b5e..4687e16dbe 100644
--- a/drivers/net/mlx5/hws/mlx5dr_internal.h
+++ b/drivers/net/mlx5/hws/mlx5dr_internal.h
@@ -6,7 +6,6 @@
#define MLX5DR_INTERNAL_H_
#include <stdint.h>
-#include <sys/queue.h>
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
#pragma GCC diagnostic ignored "-Wpedantic"
diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c
index 9011319a3e..6d5864ae3d 100644
--- a/drivers/net/mlx5/linux/mlx5_verbs.c
+++ b/drivers/net/mlx5/linux/mlx5_verbs.c
@@ -8,7 +8,6 @@
#include <stdint.h>
#include <unistd.h>
#include <inttypes.h>
-#include <sys/queue.h>
#include "mlx5_autoconf.h"
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index c08894cd03..f79052a2b9 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -10,7 +10,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <limits.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_pci.h>
#include <rte_ether.h>
diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index 10bd93c29a..c549f917c3 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -7,7 +7,6 @@
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
-#include <sys/queue.h>
#include <rte_malloc.h>
#include <rte_common.h>
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 8db372123c..55721f96d5 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -7,7 +7,7 @@
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <eal_export.h>
#include <rte_common.h>
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index e890e732c3..9026de9419 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -8,7 +8,7 @@
#include <stdalign.h>
#include <stdint.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_alarm.h>
#include <rte_mtr.h>
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 7b9e5018b8..f968b0febb 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -2,7 +2,6 @@
* Copyright 2018 Mellanox Technologies, Ltd
*/
-#include <sys/queue.h>
#include <stdalign.h>
#include <stdint.h>
#include <string.h>
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 5b4a4eda3b..774fc3b27a 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -3,7 +3,7 @@
*/
#include <netinet/in.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdalign.h>
#include <stdint.h>
#include <string.h>
diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h
index 4f3d73e3c4..1ff01f710c 100644
--- a/drivers/net/mlx5/mlx5_rx.h
+++ b/drivers/net/mlx5/mlx5_rx.h
@@ -7,7 +7,6 @@
#define RTE_PMD_MLX5_RX_H_
#include <stdint.h>
-#include <sys/queue.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 77c5848c37..79f664fa06 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -8,7 +8,7 @@
#include <string.h>
#include <stdint.h>
#include <fcntl.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <eal_export.h>
#include <rte_mbuf.h>
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 3fa9245769..c999ca9052 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -8,7 +8,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <sys/queue.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h
index 16307206e2..f320b18481 100644
--- a/drivers/net/mlx5/mlx5_tx.h
+++ b/drivers/net/mlx5/mlx5_tx.h
@@ -7,7 +7,6 @@
#define RTE_PMD_MLX5_TX_H_
#include <stdint.h>
-#include <sys/queue.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 26/47] net/tap: remove unnecessary include of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (24 preceding siblings ...)
2025-08-18 23:27 ` [RFC 25/47] net/mlx5: remove unnecessary include " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 27/47] net/axgbe: replace use " Stephen Hemminger
` (20 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
The macros in sys/queue.h are not used here.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/tap/rte_eth_tap.h | 1 -
drivers/net/tap/tap_flow.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h
index ce4322ad04..055a9e9b23 100644
--- a/drivers/net/tap/rte_eth_tap.h
+++ b/drivers/net/tap/rte_eth_tap.h
@@ -6,7 +6,6 @@
#ifndef _RTE_ETH_TAP_H_
#define _RTE_ETH_TAP_H_
-#include <sys/queue.h>
#include <sys/uio.h>
#include <inttypes.h>
#include <net/if.h>
diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
index 373b773e2d..99e0bcf218 100644
--- a/drivers/net/tap/tap_flow.c
+++ b/drivers/net/tap/tap_flow.c
@@ -6,7 +6,6 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
-#include <sys/queue.h>
#include <sys/resource.h>
#include <rte_byteorder.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 27/47] net/axgbe: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (25 preceding siblings ...)
2025-08-18 23:27 ` [RFC 26/47] net/tap: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 28/47] net/bnx2x: " Stephen Hemminger
` (19 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Selwin Sebastian
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/axgbe/axgbe_common.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index 93e6c177b6..e882842e39 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -10,7 +10,6 @@
#include <stdbool.h>
#include <limits.h>
-#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 28/47] net/bnx2x: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (26 preceding siblings ...)
2025-08-18 23:27 ` [RFC 27/47] net/axgbe: replace use " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 29/47] net/bonding: " Stephen Hemminger
` (18 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Julien Aube
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bnx2x/bnx2x_ethdev.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.h b/drivers/net/bnx2x/bnx2x_ethdev.h
index fa1c3ba955..3434aa0c9f 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.h
+++ b/drivers/net/bnx2x/bnx2x_ethdev.h
@@ -8,7 +8,6 @@
#ifndef PMD_BNX2X_ETHDEV_H
#define PMD_BNX2X_ETHDEV_H
-#include <sys/queue.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/stat.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 29/47] net/bonding: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (27 preceding siblings ...)
2025-08-18 23:27 ` [RFC 28/47] net/bnx2x: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 30/47] net/cxgbe: " Stephen Hemminger
` (17 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Chas Williams, Min Hu (Connor)
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bonding/eth_bond_private.h | 1 -
drivers/net/bonding/rte_eth_bond_flow.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h
index 378bbba4e6..9e268d77c5 100644
--- a/drivers/net/bonding/eth_bond_private.h
+++ b/drivers/net/bonding/eth_bond_private.h
@@ -6,7 +6,6 @@
#define _ETH_BOND_PRIVATE_H_
#include <stdint.h>
-#include <sys/queue.h>
#include <ethdev_driver.h>
#include <rte_flow.h>
diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c
index 5d0be5caf5..2d5b186aad 100644
--- a/drivers/net/bonding/rte_eth_bond_flow.c
+++ b/drivers/net/bonding/rte_eth_bond_flow.c
@@ -4,7 +4,6 @@
#include <stddef.h>
#include <string.h>
-#include <sys/queue.h>
#include <rte_errno.h>
#include <rte_malloc.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 30/47] net/cxgbe: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (28 preceding siblings ...)
2025-08-18 23:27 ` [RFC 29/47] net/bonding: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 31/47] net/enic: " Stephen Hemminger
` (16 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Potnuri Bharat Teja
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 1 -
drivers/net/cxgbe/sge.c | 1 -
3 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 9b6a3651f9..3d4a333a27 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -3,7 +3,7 @@
* All rights reserved.
*/
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 2ed21f2d66..b3d7e1c012 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -3,7 +3,6 @@
* All rights reserved.
*/
-#include <sys/queue.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index e9d45f24c4..3fa296b1bd 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -3,7 +3,6 @@
* All rights reserved.
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 31/47] net/enic: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (29 preceding siblings ...)
2025-08-18 23:27 ` [RFC 30/47] net/cxgbe: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 32/47] net/failsafe: " Stephen Hemminger
` (15 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, John Daley, Hyong Youb Kim
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/enic/enic.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index dc1d16f7d5..7c16356a58 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -21,7 +21,6 @@
#include "enic_res.h"
#include "cq_enet_desc.h"
#include <stdbool.h>
-#include <sys/queue.h>
#include <rte_spinlock.h>
#define DRV_NAME "enic_pmd"
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 32/47] net/failsafe: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (30 preceding siblings ...)
2025-08-18 23:27 ` [RFC 31/47] net/enic: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 33/47] net/memif: " Stephen Hemminger
` (14 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Gaetan Rivet
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/failsafe/failsafe_flow.c | 1 -
drivers/net/failsafe/failsafe_private.h | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c
index 707e6c63b5..9f620443a4 100644
--- a/drivers/net/failsafe/failsafe_flow.c
+++ b/drivers/net/failsafe/failsafe_flow.c
@@ -5,7 +5,6 @@
#include <stddef.h>
#include <string.h>
-#include <sys/queue.h>
#include <rte_errno.h>
#include <rte_malloc.h>
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index babea6016e..1702d5fb3b 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -7,7 +7,7 @@
#define _ETH_FAILSAFE_PRIVATE_H_
#include <stdint.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <pthread.h>
#include <rte_atomic.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 33/47] net/memif: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (31 preceding siblings ...)
2025-08-18 23:27 ` [RFC 32/47] net/failsafe: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 34/47] net/mlx4: " Stephen Hemminger
` (13 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Jakub Grajciar
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/memif/memif_socket.h | 1 -
drivers/net/memif/rte_eth_memif.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/net/memif/memif_socket.h b/drivers/net/memif/memif_socket.h
index b0decbb0a2..f95b64fd61 100644
--- a/drivers/net/memif/memif_socket.h
+++ b/drivers/net/memif/memif_socket.h
@@ -5,7 +5,6 @@
#ifndef _MEMIF_SOCKET_H_
#define _MEMIF_SOCKET_H_
-#include <sys/queue.h>
#include <sys/un.h>
/**
diff --git a/drivers/net/memif/rte_eth_memif.h b/drivers/net/memif/rte_eth_memif.h
index 8e45a3ab78..dc6ca8be58 100644
--- a/drivers/net/memif/rte_eth_memif.h
+++ b/drivers/net/memif/rte_eth_memif.h
@@ -5,7 +5,6 @@
#ifndef _RTE_ETH_MEMIF_H_
#define _RTE_ETH_MEMIF_H_
-#include <sys/queue.h>
#include <ethdev_driver.h>
#include <rte_ether.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 34/47] net/mlx4: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (32 preceding siblings ...)
2025-08-18 23:27 ` [RFC 33/47] net/memif: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 35/47] net/ngbe: " Stephen Hemminger
` (12 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Matan Azrad, Viacheslav Ovsiienko
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/mlx4/mlx4.h | 1 -
drivers/net/mlx4/mlx4_flow.c | 2 +-
drivers/net/mlx4/mlx4_flow.h | 1 -
drivers/net/mlx4/mlx4_mr.h | 1 -
drivers/net/mlx4/mlx4_rxtx.h | 1 -
5 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index c992a1c5ea..67768f3e56 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -8,7 +8,6 @@
#include <net/if.h>
#include <stdint.h>
-#include <sys/queue.h>
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c
index b520664d95..8a696e9fff 100644
--- a/drivers/net/mlx4/mlx4_flow.c
+++ b/drivers/net/mlx4/mlx4_flow.c
@@ -14,7 +14,7 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
diff --git a/drivers/net/mlx4/mlx4_flow.h b/drivers/net/mlx4/mlx4_flow.h
index 5e82df6bd6..a27317432d 100644
--- a/drivers/net/mlx4/mlx4_flow.h
+++ b/drivers/net/mlx4/mlx4_flow.h
@@ -7,7 +7,6 @@
#define RTE_PMD_MLX4_FLOW_H_
#include <stdint.h>
-#include <sys/queue.h>
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
diff --git a/drivers/net/mlx4/mlx4_mr.h b/drivers/net/mlx4/mlx4_mr.h
index 56dd73ff19..7fef07d6f9 100644
--- a/drivers/net/mlx4/mlx4_mr.h
+++ b/drivers/net/mlx4/mlx4_mr.h
@@ -8,7 +8,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <sys/queue.h>
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h
index 70f3cd8680..c68375b088 100644
--- a/drivers/net/mlx4/mlx4_rxtx.h
+++ b/drivers/net/mlx4/mlx4_rxtx.h
@@ -7,7 +7,6 @@
#define MLX4_RXTX_H_
#include <stdint.h>
-#include <sys/queue.h>
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 35/47] net/ngbe: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (33 preceding siblings ...)
2025-08-18 23:27 ` [RFC 34/47] net/mlx4: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 36/47] net/ntnic: " Stephen Hemminger
` (11 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Jiawen Wu, Zaiyu Wang
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ngbe/ngbe_ethdev_vf.c | 1 -
drivers/net/ngbe/ngbe_rxtx.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/net/ngbe/ngbe_ethdev_vf.c b/drivers/net/ngbe/ngbe_ethdev_vf.c
index 846bc981f6..c25acede85 100644
--- a/drivers/net/ngbe/ngbe_ethdev_vf.c
+++ b/drivers/net/ngbe/ngbe_ethdev_vf.c
@@ -3,7 +3,6 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c
index 3dd268e5bc..049a9f587c 100644
--- a/drivers/net/ngbe/ngbe_rxtx.c
+++ b/drivers/net/ngbe/ngbe_rxtx.c
@@ -3,7 +3,6 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdint.h>
#include <rte_ethdev.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 36/47] net/ntnic: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (34 preceding siblings ...)
2025-08-18 23:27 ` [RFC 35/47] net/ngbe: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 37/47] net/sfc: " Stephen Hemminger
` (10 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Christian Koue Muf, Serhii Iliushyk
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ntnic/ntnic_ethdev.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c
index 79ef9e7e7c..dac1cde891 100644
--- a/drivers/net/ntnic/ntnic_ethdev.c
+++ b/drivers/net/ntnic/ntnic_ethdev.c
@@ -16,7 +16,6 @@
#include <ethdev_pci.h>
#include <rte_kvargs.h>
-#include <sys/queue.h>
#include "rte_spinlock.h"
#include "ntlog.h"
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 37/47] net/sfc: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (35 preceding siblings ...)
2025-08-18 23:27 ` [RFC 36/47] net/ntnic: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 38/47] net/softnic: " Stephen Hemminger
` (9 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Andrew Rybchenko
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/sfc/sfc_dp.c | 2 +-
drivers/net/sfc/sfc_dp.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/sfc/sfc_dp.c b/drivers/net/sfc/sfc_dp.c
index 7e2a20e4dc..0dbdc5d6ff 100644
--- a/drivers/net/sfc/sfc_dp.c
+++ b/drivers/net/sfc/sfc_dp.c
@@ -7,7 +7,7 @@
* for Solarflare) and Solarflare Communications, Inc.
*/
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <stdalign.h>
#include <string.h>
#include <errno.h>
diff --git a/drivers/net/sfc/sfc_dp.h b/drivers/net/sfc/sfc_dp.h
index 545f0f32bf..6f61b20a0f 100644
--- a/drivers/net/sfc/sfc_dp.h
+++ b/drivers/net/sfc/sfc_dp.h
@@ -11,7 +11,6 @@
#define _SFC_DP_H
#include <stdbool.h>
-#include <sys/queue.h>
#include <rte_pci.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 38/47] net/softnic: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (36 preceding siblings ...)
2025-08-18 23:27 ` [RFC 37/47] net/sfc: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 39/47] net/thunderx: " Stephen Hemminger
` (8 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/softnic/rte_eth_softnic_internals.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h
index d3975dad10..5b4361bad0 100644
--- a/drivers/net/softnic/rte_eth_softnic_internals.h
+++ b/drivers/net/softnic/rte_eth_softnic_internals.h
@@ -7,7 +7,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <sys/queue.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 39/47] net/thunderx: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (37 preceding siblings ...)
2025-08-18 23:27 ` [RFC 38/47] net/softnic: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 40/47] net/txgbe: " Stephen Hemminger
` (7 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Jerin Jacob, Maciej Czekaj
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/thunderx/base/nicvf_bsvf.h | 2 +-
drivers/net/thunderx/base/nicvf_plat.h | 1 +
drivers/net/thunderx/nicvf_ethdev.c | 1 -
3 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/thunderx/base/nicvf_bsvf.h b/drivers/net/thunderx/base/nicvf_bsvf.h
index 4c7615ca99..b93201f265 100644
--- a/drivers/net/thunderx/base/nicvf_bsvf.h
+++ b/drivers/net/thunderx/base/nicvf_bsvf.h
@@ -5,7 +5,7 @@
#ifndef __THUNDERX_NICVF_BSVF_H__
#define __THUNDERX_NICVF_BSVF_H__
-#include <sys/queue.h>
+#include <bsd_queue.h>
struct nicvf;
diff --git a/drivers/net/thunderx/base/nicvf_plat.h b/drivers/net/thunderx/base/nicvf_plat.h
index 8421f57040..34761000b4 100644
--- a/drivers/net/thunderx/base/nicvf_plat.h
+++ b/drivers/net/thunderx/base/nicvf_plat.h
@@ -6,6 +6,7 @@
#define _THUNDERX_NICVF_H
/* Platform/OS/arch specific abstractions */
+#include <bsd_queue.h>
/* log */
#include <rte_log.h>
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 4441a90bdf..c7b6252cd6 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -12,7 +12,6 @@
#include <stdarg.h>
#include <inttypes.h>
#include <netinet/in.h>
-#include <sys/queue.h>
#include <rte_alarm.h>
#include <rte_branch_prediction.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 40/47] net/txgbe: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (38 preceding siblings ...)
2025-08-18 23:27 ` [RFC 39/47] net/thunderx: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 41/47] net/vdev_netvsc: " Stephen Hemminger
` (6 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Jiawen Wu, Jian Wang, Zaiyu Wang
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/txgbe/txgbe_ethdev_vf.c | 1 -
drivers/net/txgbe/txgbe_fdir.c | 2 +-
drivers/net/txgbe/txgbe_flow.c | 2 +-
drivers/net/txgbe/txgbe_rxtx.c | 1 -
4 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index 847febf8c3..61e62e9015 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -3,7 +3,6 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/txgbe/txgbe_fdir.c b/drivers/net/txgbe/txgbe_fdir.c
index 0efd43b59a..8a35f07d88 100644
--- a/drivers/net/txgbe/txgbe_fdir.c
+++ b/drivers/net/txgbe/txgbe_fdir.c
@@ -7,7 +7,7 @@
#include <stdint.h>
#include <stdarg.h>
#include <errno.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <rte_malloc.h>
#include "txgbe_logs.h"
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index 99a76daca0..ba1154c1df 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -3,7 +3,7 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <bus_pci_driver.h>
#include <rte_malloc.h>
#include <rte_flow.h>
diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c
index e6f33739c4..38fe981997 100644
--- a/drivers/net/txgbe/txgbe_rxtx.c
+++ b/drivers/net/txgbe/txgbe_rxtx.c
@@ -3,7 +3,6 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 41/47] net/vdev_netvsc: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (39 preceding siblings ...)
2025-08-18 23:27 ` [RFC 40/47] net/txgbe: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 42/47] net/vmxnet3: " Stephen Hemminger
` (5 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Matan Azrad
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/vdev_netvsc/vdev_netvsc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index f4a84783ce..e7a05b1aa8 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
-#include <sys/queue.h>
+#include <bsd_queue.h>
#include <sys/socket.h>
#include <unistd.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 42/47] net/vmxnet3: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (40 preceding siblings ...)
2025-08-18 23:27 ` [RFC 41/47] net/vdev_netvsc: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 43/47] net/zxdh: " Stephen Hemminger
` (4 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Jochen Behrens
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 -
drivers/net/vmxnet3/vmxnet3_rxtx.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 15ca25b187..cc7f540d54 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -2,7 +2,6 @@
* Copyright(c) 2010-2015 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdalign.h>
#include <stdio.h>
#include <errno.h>
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index e226641fdf..51db8d03cb 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -2,7 +2,6 @@
* Copyright(c) 2010-2015 Intel Corporation
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 43/47] net/zxdh: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (41 preceding siblings ...)
2025-08-18 23:27 ` [RFC 42/47] net/vmxnet3: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 44/47] net/dpaa2: " Stephen Hemminger
` (3 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Junlong Wang, Lijie Shan
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/zxdh/zxdh_mtr.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/zxdh/zxdh_mtr.h b/drivers/net/zxdh/zxdh_mtr.h
index 3efcb6b591..4b9b409025 100644
--- a/drivers/net/zxdh/zxdh_mtr.h
+++ b/drivers/net/zxdh/zxdh_mtr.h
@@ -7,7 +7,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <sys/queue.h>
#include <rte_mtr.h>
#include "zxdh_np.h"
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 44/47] net/dpaa2: replace use of sys/queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (42 preceding siblings ...)
2025-08-18 23:27 ` [RFC 43/47] net/zxdh: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 45/47] eal: remove no longer used windows version of queue.h Stephen Hemminger
` (2 subsequent siblings)
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena
Replace use of system sys/queue.h with DPDK bsd_queue.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/dpaa2/dpaa2_flow.c | 1 -
drivers/net/dpaa2/dpaa2_mux.c | 1 -
drivers/net/dpaa2/dpaa2_ptp.c | 1 -
3 files changed, 3 deletions(-)
diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c
index 299c50dcdf..96e58b85fe 100644
--- a/drivers/net/dpaa2/dpaa2_flow.c
+++ b/drivers/net/dpaa2/dpaa2_flow.c
@@ -2,7 +2,6 @@
* Copyright 2018-2022 NXP
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c
index 1908d1e865..f956d5d5b2 100644
--- a/drivers/net/dpaa2/dpaa2_mux.c
+++ b/drivers/net/dpaa2/dpaa2_mux.c
@@ -2,7 +2,6 @@
* Copyright 2018-2021,2023 NXP
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
diff --git a/drivers/net/dpaa2/dpaa2_ptp.c b/drivers/net/dpaa2/dpaa2_ptp.c
index 751e558c73..b55aa195ea 100644
--- a/drivers/net/dpaa2/dpaa2_ptp.c
+++ b/drivers/net/dpaa2/dpaa2_ptp.c
@@ -2,7 +2,6 @@
* Copyright 2019, 2023 NXP
*/
-#include <sys/queue.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 45/47] eal: remove no longer used windows version of queue.h
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (43 preceding siblings ...)
2025-08-18 23:27 ` [RFC 44/47] net/dpaa2: " Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 46/47] net/mvpp2: replace local definition of FOREACH_SAFE Stephen Hemminger
2025-08-18 23:27 ` [RFC 47/47] drivers/raw: replace with TAILQ_FOREACH_SAFE Stephen Hemminger
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Dmitry Kozlyuk, Tyler Retzlaff
The file sys/queue.h is not used anywhere now in DPDK.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/windows/include/sys/queue.h | 840 ----------------------------
1 file changed, 840 deletions(-)
delete mode 100644 lib/eal/windows/include/sys/queue.h
diff --git a/lib/eal/windows/include/sys/queue.h b/lib/eal/windows/include/sys/queue.h
deleted file mode 100644
index 917526531b..0000000000
--- a/lib/eal/windows/include/sys/queue.h
+++ /dev/null
@@ -1,840 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- */
-
-#ifndef _SYS_QUEUE_H_
-#define _SYS_QUEUE_H_
-
-/*
- * This file defines four types of data structures: singly-linked lists,
- * singly-linked tail queues, lists and tail queues.
- *
- * A singly-linked list is headed by a single forward pointer. The elements
- * are singly linked for minimum space and pointer manipulation overhead at
- * the expense of O(n) removal for arbitrary elements. New elements can be
- * added to the list after an existing element or at the head of the list.
- * Elements being removed from the head of the list should use the explicit
- * macro for this purpose for optimum efficiency. A singly-linked list may
- * only be traversed in the forward direction. Singly-linked lists are ideal
- * for applications with large datasets and few or no removals or for
- * implementing a LIFO queue.
- *
- * A singly-linked tail queue is headed by a pair of pointers, one to the
- * head of the list and the other to the tail of the list. The elements are
- * singly linked for minimum space and pointer manipulation overhead at the
- * expense of O(n) removal for arbitrary elements. New elements can be added
- * to the list after an existing element, at the head of the list, or at the
- * end of the list. Elements being removed from the head of the tail queue
- * should use the explicit macro for this purpose for optimum efficiency.
- * A singly-linked tail queue may only be traversed in the forward direction.
- * Singly-linked tail queues are ideal for applications with large datasets
- * and few or no removals or for implementing a FIFO queue.
- *
- * A list is headed by a single forward pointer (or an array of forward
- * pointers for a hash table header). The elements are doubly linked
- * so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before
- * or after an existing element or at the head of the list. A list
- * may be traversed in either direction.
- *
- * A tail queue is headed by a pair of pointers, one to the head of the
- * list and the other to the tail of the list. The elements are doubly
- * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before or
- * after an existing element, at the head of the list, or at the end of
- * the list. A tail queue may be traversed in either direction.
- *
- * For details on the use of these macros, see the queue(3) manual page.
- *
- * Below is a summary of implemented functions where:
- * + means the macro is available
- * - means the macro is not available
- * s means the macro is available but is slow (runs in O(n) time)
- *
- * SLIST LIST STAILQ TAILQ
- * _HEAD + + + +
- * _CLASS_HEAD + + + +
- * _HEAD_INITIALIZER + + + +
- * _ENTRY + + + +
- * _CLASS_ENTRY + + + +
- * _INIT + + + +
- * _EMPTY + + + +
- * _FIRST + + + +
- * _NEXT + + + +
- * _PREV - + - +
- * _LAST - - + +
- * _LAST_FAST - - - +
- * _FOREACH + + + +
- * _FOREACH_FROM + + + +
- * _FOREACH_SAFE + + + +
- * _FOREACH_FROM_SAFE + + + +
- * _FOREACH_REVERSE - - - +
- * _FOREACH_REVERSE_FROM - - - +
- * _FOREACH_REVERSE_SAFE - - - +
- * _FOREACH_REVERSE_FROM_SAFE - - - +
- * _INSERT_HEAD + + + +
- * _INSERT_BEFORE - + - +
- * _INSERT_AFTER + + + +
- * _INSERT_TAIL - - + +
- * _CONCAT s s + +
- * _REMOVE_AFTER + - + -
- * _REMOVE_HEAD + - + -
- * _REMOVE s + s +
- * _SWAP + + + +
- */
-#ifdef QUEUE_MACRO_DEBUG
-#warn Use QUEUE_MACRO_DEBUG_TRACE and/or QUEUE_MACRO_DEBUG_TRASH
-#define QUEUE_MACRO_DEBUG_TRACE
-#define QUEUE_MACRO_DEBUG_TRASH
-#endif
-
-#ifdef QUEUE_MACRO_DEBUG_TRACE
-/* Store the last 2 places the queue element or head was altered */
-struct qm_trace {
- unsigned long lastline;
- unsigned long prevline;
- const char *lastfile;
- const char *prevfile;
-};
-
-#define TRACEBUF struct qm_trace trace;
-#define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } ,
-
-#define QMD_TRACE_HEAD(head) do { \
- (head)->trace.prevline = (head)->trace.lastline; \
- (head)->trace.prevfile = (head)->trace.lastfile; \
- (head)->trace.lastline = __LINE__; \
- (head)->trace.lastfile = __FILE__; \
-} while (0)
-
-#define QMD_TRACE_ELEM(elem) do { \
- (elem)->trace.prevline = (elem)->trace.lastline; \
- (elem)->trace.prevfile = (elem)->trace.lastfile; \
- (elem)->trace.lastline = __LINE__; \
- (elem)->trace.lastfile = __FILE__; \
-} while (0)
-
-#else /* !QUEUE_MACRO_DEBUG_TRACE */
-#define QMD_TRACE_ELEM(elem)
-#define QMD_TRACE_HEAD(head)
-#define TRACEBUF
-#define TRACEBUF_INITIALIZER
-#endif /* QUEUE_MACRO_DEBUG_TRACE */
-
-#ifdef QUEUE_MACRO_DEBUG_TRASH
-#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
-#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
-#define QMD_IS_TRASHED(x) ((x) == (void *)(intptr_t)-1)
-#else /* !QUEUE_MACRO_DEBUG_TRASH */
-#define QMD_SAVELINK(name, link)
-#define TRASHIT(x)
-#define QMD_IS_TRASHED(x) 0
-#endif /* QUEUE_MACRO_DEBUG_TRASH */
-
-#ifdef __cplusplus
-/*
- * In C++ there can be structure lists and class lists:
- */
-#define QUEUE_TYPEOF(type) type
-#else
-#define QUEUE_TYPEOF(type) struct type
-#endif
-
-/*
- * Singly-linked List declarations.
- */
-#define SLIST_HEAD(name, type) \
-struct name { \
- struct type *slh_first; /* first element */ \
-}
-
-#define SLIST_CLASS_HEAD(name, type) \
-struct name { \
- class type *slh_first; /* first element */ \
-}
-
-#define SLIST_HEAD_INITIALIZER(head) \
- { NULL }
-
-#define SLIST_ENTRY(type) \
-struct { \
- struct type *sle_next; /* next element */ \
-}
-
-#define SLIST_CLASS_ENTRY(type) \
-struct { \
- class type *sle_next; /* next element */ \
-}
-
-/*
- * Singly-linked List functions.
- */
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) do { \
- if (*(prevp) != (elm)) \
- panic("Bad prevptr *(%p) == %p != %p", \
- (prevp), *(prevp), (elm)); \
-} while (0)
-#else
-#define QMD_SLIST_CHECK_PREVPTR(prevp, elm)
-#endif
-
-#define SLIST_CONCAT(head1, head2, type, field) do { \
- QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \
- if (curelm == NULL) { \
- if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \
- SLIST_INIT(head2); \
- } else if (SLIST_FIRST(head2) != NULL) { \
- while (SLIST_NEXT(curelm, field) != NULL) \
- curelm = SLIST_NEXT(curelm, field); \
- SLIST_NEXT(curelm, field) = SLIST_FIRST(head2); \
- SLIST_INIT(head2); \
- } \
-} while (0)
-
-#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
-
-#define SLIST_FIRST(head) ((head)->slh_first)
-
-#define SLIST_FOREACH(var, head, field) \
- for ((var) = SLIST_FIRST((head)); \
- (var); \
- (var) = SLIST_NEXT((var), field))
-
-#define SLIST_FOREACH_FROM(var, head, field) \
- for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
- (var); \
- (var) = SLIST_NEXT((var), field))
-
-#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = SLIST_FIRST((head)); \
- (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
- for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
- (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
- for ((varp) = &SLIST_FIRST((head)); \
- ((var) = *(varp)) != NULL; \
- (varp) = &SLIST_NEXT((var), field))
-
-#define SLIST_INIT(head) do { \
- SLIST_FIRST((head)) = NULL; \
-} while (0)
-
-#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
- SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
- SLIST_NEXT((slistelm), field) = (elm); \
-} while (0)
-
-#define SLIST_INSERT_HEAD(head, elm, field) do { \
- SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
- SLIST_FIRST((head)) = (elm); \
-} while (0)
-
-#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
-
-#define SLIST_REMOVE(head, elm, type, field) do { \
- QMD_SAVELINK(oldnext, (elm)->field.sle_next); \
- if (SLIST_FIRST((head)) == (elm)) { \
- SLIST_REMOVE_HEAD((head), field); \
- } \
- else { \
- QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \
- while (SLIST_NEXT(curelm, field) != (elm)) \
- curelm = SLIST_NEXT(curelm, field); \
- SLIST_REMOVE_AFTER(curelm, field); \
- } \
- TRASHIT(*oldnext); \
-} while (0)
-
-#define SLIST_REMOVE_AFTER(elm, field) do { \
- SLIST_NEXT(elm, field) = \
- SLIST_NEXT(SLIST_NEXT(elm, field), field); \
-} while (0)
-
-#define SLIST_REMOVE_HEAD(head, field) do { \
- SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
-} while (0)
-
-#define SLIST_REMOVE_PREVPTR(prevp, elm, field) do { \
- QMD_SLIST_CHECK_PREVPTR(prevp, elm); \
- *(prevp) = SLIST_NEXT(elm, field); \
- TRASHIT((elm)->field.sle_next); \
-} while (0)
-
-#define SLIST_SWAP(head1, head2, type) do { \
- QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \
- SLIST_FIRST(head1) = SLIST_FIRST(head2); \
- SLIST_FIRST(head2) = swap_first; \
-} while (0)
-
-/*
- * Singly-linked Tail queue declarations.
- */
-#define STAILQ_HEAD(name, type) \
-struct name { \
- struct type *stqh_first;/* first element */ \
- struct type **stqh_last;/* addr of last next element */ \
-}
-
-#define STAILQ_CLASS_HEAD(name, type) \
-struct name { \
- class type *stqh_first; /* first element */ \
- class type **stqh_last; /* addr of last next element */ \
-}
-
-#define STAILQ_HEAD_INITIALIZER(head) \
- { NULL, &(head).stqh_first }
-
-#define STAILQ_ENTRY(type) \
-struct { \
- struct type *stqe_next; /* next element */ \
-}
-
-#define STAILQ_CLASS_ENTRY(type) \
-struct { \
- class type *stqe_next; /* next element */ \
-}
-
-/*
- * Singly-linked Tail queue functions.
- */
-#define STAILQ_CONCAT(head1, head2) do { \
- if (!STAILQ_EMPTY((head2))) { \
- *(head1)->stqh_last = (head2)->stqh_first; \
- (head1)->stqh_last = (head2)->stqh_last; \
- STAILQ_INIT((head2)); \
- } \
-} while (0)
-
-#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
-
-#define STAILQ_FIRST(head) ((head)->stqh_first)
-
-#define STAILQ_FOREACH(var, head, field) \
- for((var) = STAILQ_FIRST((head)); \
- (var); \
- (var) = STAILQ_NEXT((var), field))
-
-#define STAILQ_FOREACH_FROM(var, head, field) \
- for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
- (var); \
- (var) = STAILQ_NEXT((var), field))
-
-#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = STAILQ_FIRST((head)); \
- (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
- for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
- (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define STAILQ_INIT(head) do { \
- STAILQ_FIRST((head)) = NULL; \
- (head)->stqh_last = &STAILQ_FIRST((head)); \
-} while (0)
-
-#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
- if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
- (head)->stqh_last = &STAILQ_NEXT((elm), field); \
- STAILQ_NEXT((tqelm), field) = (elm); \
-} while (0)
-
-#define STAILQ_INSERT_HEAD(head, elm, field) do { \
- if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
- (head)->stqh_last = &STAILQ_NEXT((elm), field); \
- STAILQ_FIRST((head)) = (elm); \
-} while (0)
-
-#define STAILQ_INSERT_TAIL(head, elm, field) do { \
- STAILQ_NEXT((elm), field) = NULL; \
- *(head)->stqh_last = (elm); \
- (head)->stqh_last = &STAILQ_NEXT((elm), field); \
-} while (0)
-
-#define STAILQ_LAST(head, type, field) \
- (STAILQ_EMPTY((head)) ? NULL : \
- __containerof((head)->stqh_last, \
- QUEUE_TYPEOF(type), field.stqe_next))
-
-#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
-
-#define STAILQ_REMOVE(head, elm, type, field) do { \
- QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
- if (STAILQ_FIRST((head)) == (elm)) { \
- STAILQ_REMOVE_HEAD((head), field); \
- } \
- else { \
- QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \
- while (STAILQ_NEXT(curelm, field) != (elm)) \
- curelm = STAILQ_NEXT(curelm, field); \
- STAILQ_REMOVE_AFTER(head, curelm, field); \
- } \
- TRASHIT(*oldnext); \
-} while (0)
-
-#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
- if ((STAILQ_NEXT(elm, field) = \
- STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
- (head)->stqh_last = &STAILQ_NEXT((elm), field); \
-} while (0)
-
-#define STAILQ_REMOVE_HEAD(head, field) do { \
- if ((STAILQ_FIRST((head)) = \
- STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
- (head)->stqh_last = &STAILQ_FIRST((head)); \
-} while (0)
-
-#define STAILQ_SWAP(head1, head2, type) do { \
- QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \
- QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \
- STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
- (head1)->stqh_last = (head2)->stqh_last; \
- STAILQ_FIRST(head2) = swap_first; \
- (head2)->stqh_last = swap_last; \
- if (STAILQ_EMPTY(head1)) \
- (head1)->stqh_last = &STAILQ_FIRST(head1); \
- if (STAILQ_EMPTY(head2)) \
- (head2)->stqh_last = &STAILQ_FIRST(head2); \
-} while (0)
-
-
-/*
- * List declarations.
- */
-#define LIST_HEAD(name, type) \
-struct name { \
- struct type *lh_first; /* first element */ \
-}
-
-#define LIST_CLASS_HEAD(name, type) \
-struct name { \
- class type *lh_first; /* first element */ \
-}
-
-#define LIST_HEAD_INITIALIZER(head) \
- { NULL }
-
-#define LIST_ENTRY(type) \
-struct { \
- struct type *le_next; /* next element */ \
- struct type **le_prev; /* address of previous next element */ \
-}
-
-#define LIST_CLASS_ENTRY(type) \
-struct { \
- class type *le_next; /* next element */ \
- class type **le_prev; /* address of previous next element */ \
-}
-
-/*
- * List functions.
- */
-
-#if (defined(_KERNEL) && defined(INVARIANTS))
-/*
- * QMD_LIST_CHECK_HEAD(LIST_HEAD *head, LIST_ENTRY NAME)
- *
- * If the list is non-empty, validates that the first element of the list
- * points back at 'head.'
- */
-#define QMD_LIST_CHECK_HEAD(head, field) do { \
- if (LIST_FIRST((head)) != NULL && \
- LIST_FIRST((head))->field.le_prev != \
- &LIST_FIRST((head))) \
- panic("Bad list head %p first->prev != head", (head)); \
-} while (0)
-
-/*
- * QMD_LIST_CHECK_NEXT(TYPE *elm, LIST_ENTRY NAME)
- *
- * If an element follows 'elm' in the list, validates that the next element
- * points back at 'elm.'
- */
-#define QMD_LIST_CHECK_NEXT(elm, field) do { \
- if (LIST_NEXT((elm), field) != NULL && \
- LIST_NEXT((elm), field)->field.le_prev != \
- &((elm)->field.le_next)) \
- panic("Bad link elm %p next->prev != elm", (elm)); \
-} while (0)
-
-/*
- * QMD_LIST_CHECK_PREV(TYPE *elm, LIST_ENTRY NAME)
- *
- * Validates that the previous element (or head of the list) points to 'elm.'
- */
-#define QMD_LIST_CHECK_PREV(elm, field) do { \
- if (*(elm)->field.le_prev != (elm)) \
- panic("Bad link elm %p prev->next != elm", (elm)); \
-} while (0)
-#else
-#define QMD_LIST_CHECK_HEAD(head, field)
-#define QMD_LIST_CHECK_NEXT(elm, field)
-#define QMD_LIST_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define LIST_CONCAT(head1, head2, type, field) do { \
- QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1); \
- if (curelm == NULL) { \
- if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \
- LIST_FIRST(head2)->field.le_prev = \
- &LIST_FIRST((head1)); \
- LIST_INIT(head2); \
- } \
- } else if (LIST_FIRST(head2) != NULL) { \
- while (LIST_NEXT(curelm, field) != NULL) \
- curelm = LIST_NEXT(curelm, field); \
- LIST_NEXT(curelm, field) = LIST_FIRST(head2); \
- LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field); \
- LIST_INIT(head2); \
- } \
-} while (0)
-
-#define LIST_EMPTY(head) ((head)->lh_first == NULL)
-
-#define LIST_FIRST(head) ((head)->lh_first)
-
-#define LIST_FOREACH(var, head, field) \
- for ((var) = LIST_FIRST((head)); \
- (var); \
- (var) = LIST_NEXT((var), field))
-
-#define LIST_FOREACH_FROM(var, head, field) \
- for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
- (var); \
- (var) = LIST_NEXT((var), field))
-
-#define LIST_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = LIST_FIRST((head)); \
- (var) && ((tvar) = LIST_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
- for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
- (var) && ((tvar) = LIST_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define LIST_INIT(head) do { \
- LIST_FIRST((head)) = NULL; \
-} while (0)
-
-#define LIST_INSERT_AFTER(listelm, elm, field) do { \
- QMD_LIST_CHECK_NEXT(listelm, field); \
- if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
- LIST_NEXT((listelm), field)->field.le_prev = \
- &LIST_NEXT((elm), field); \
- LIST_NEXT((listelm), field) = (elm); \
- (elm)->field.le_prev = &LIST_NEXT((listelm), field); \
-} while (0)
-
-#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
- QMD_LIST_CHECK_PREV(listelm, field); \
- (elm)->field.le_prev = (listelm)->field.le_prev; \
- LIST_NEXT((elm), field) = (listelm); \
- *(listelm)->field.le_prev = (elm); \
- (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
-} while (0)
-
-#define LIST_INSERT_HEAD(head, elm, field) do { \
- QMD_LIST_CHECK_HEAD((head), field); \
- if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
- LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
- LIST_FIRST((head)) = (elm); \
- (elm)->field.le_prev = &LIST_FIRST((head)); \
-} while (0)
-
-#define LIST_NEXT(elm, field) ((elm)->field.le_next)
-
-#define LIST_PREV(elm, head, type, field) \
- ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
- __containerof((elm)->field.le_prev, \
- QUEUE_TYPEOF(type), field.le_next))
-
-#define LIST_REMOVE(elm, field) do { \
- QMD_SAVELINK(oldnext, (elm)->field.le_next); \
- QMD_SAVELINK(oldprev, (elm)->field.le_prev); \
- QMD_LIST_CHECK_NEXT(elm, field); \
- QMD_LIST_CHECK_PREV(elm, field); \
- if (LIST_NEXT((elm), field) != NULL) \
- LIST_NEXT((elm), field)->field.le_prev = \
- (elm)->field.le_prev; \
- *(elm)->field.le_prev = LIST_NEXT((elm), field); \
- TRASHIT(*oldnext); \
- TRASHIT(*oldprev); \
-} while (0)
-
-#define LIST_SWAP(head1, head2, type, field) do { \
- QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \
- LIST_FIRST((head1)) = LIST_FIRST((head2)); \
- LIST_FIRST((head2)) = swap_tmp; \
- if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
- swap_tmp->field.le_prev = &LIST_FIRST((head1)); \
- if ((swap_tmp = LIST_FIRST((head2))) != NULL) \
- swap_tmp->field.le_prev = &LIST_FIRST((head2)); \
-} while (0)
-
-/*
- * Tail queue declarations.
- */
-#define TAILQ_HEAD(name, type) \
-struct name { \
- struct type *tqh_first; /* first element */ \
- struct type **tqh_last; /* addr of last next element */ \
- TRACEBUF \
-}
-
-#define TAILQ_CLASS_HEAD(name, type) \
-struct name { \
- class type *tqh_first; /* first element */ \
- class type **tqh_last; /* addr of last next element */ \
- TRACEBUF \
-}
-
-#define TAILQ_HEAD_INITIALIZER(head) \
- { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
-
-#define TAILQ_ENTRY(type) \
-struct { \
- struct type *tqe_next; /* next element */ \
- struct type **tqe_prev; /* address of previous next element */ \
- TRACEBUF \
-}
-
-#define TAILQ_CLASS_ENTRY(type) \
-struct { \
- class type *tqe_next; /* next element */ \
- class type **tqe_prev; /* address of previous next element */ \
- TRACEBUF \
-}
-
-/*
- * Tail queue functions.
- */
-#if (defined(_KERNEL) && defined(INVARIANTS))
-/*
- * QMD_TAILQ_CHECK_HEAD(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
- *
- * If the tailq is non-empty, validates that the first element of the tailq
- * points back at 'head.'
- */
-#define QMD_TAILQ_CHECK_HEAD(head, field) do { \
- if (!TAILQ_EMPTY(head) && \
- TAILQ_FIRST((head))->field.tqe_prev != \
- &TAILQ_FIRST((head))) \
- panic("Bad tailq head %p first->prev != head", (head)); \
-} while (0)
-
-/*
- * QMD_TAILQ_CHECK_TAIL(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
- *
- * Validates that the tail of the tailq is a pointer to pointer to NULL.
- */
-#define QMD_TAILQ_CHECK_TAIL(head, field) do { \
- if (*(head)->tqh_last != NULL) \
- panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \
-} while (0)
-
-/*
- * QMD_TAILQ_CHECK_NEXT(TYPE *elm, TAILQ_ENTRY NAME)
- *
- * If an element follows 'elm' in the tailq, validates that the next element
- * points back at 'elm.'
- */
-#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \
- if (TAILQ_NEXT((elm), field) != NULL && \
- TAILQ_NEXT((elm), field)->field.tqe_prev != \
- &((elm)->field.tqe_next)) \
- panic("Bad link elm %p next->prev != elm", (elm)); \
-} while (0)
-
-/*
- * QMD_TAILQ_CHECK_PREV(TYPE *elm, TAILQ_ENTRY NAME)
- *
- * Validates that the previous element (or head of the tailq) points to 'elm.'
- */
-#define QMD_TAILQ_CHECK_PREV(elm, field) do { \
- if (*(elm)->field.tqe_prev != (elm)) \
- panic("Bad link elm %p prev->next != elm", (elm)); \
-} while (0)
-#else
-#define QMD_TAILQ_CHECK_HEAD(head, field)
-#define QMD_TAILQ_CHECK_TAIL(head, headname)
-#define QMD_TAILQ_CHECK_NEXT(elm, field)
-#define QMD_TAILQ_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define TAILQ_CONCAT(head1, head2, field) do { \
- if (!TAILQ_EMPTY(head2)) { \
- *(head1)->tqh_last = (head2)->tqh_first; \
- (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
- (head1)->tqh_last = (head2)->tqh_last; \
- TAILQ_INIT((head2)); \
- QMD_TRACE_HEAD(head1); \
- QMD_TRACE_HEAD(head2); \
- } \
-} while (0)
-
-#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
-
-#define TAILQ_FIRST(head) ((head)->tqh_first)
-
-#define TAILQ_FOREACH(var, head, field) \
- for ((var) = TAILQ_FIRST((head)); \
- (var); \
- (var) = TAILQ_NEXT((var), field))
-
-#define TAILQ_FOREACH_FROM(var, head, field) \
- for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
- (var); \
- (var) = TAILQ_NEXT((var), field))
-
-#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = TAILQ_FIRST((head)); \
- (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
- for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
- (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
- for ((var) = TAILQ_LAST((head), headname); \
- (var); \
- (var) = TAILQ_PREV((var), headname, field))
-
-#define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \
- for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
- (var); \
- (var) = TAILQ_PREV((var), headname, field))
-
-#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
- for ((var) = TAILQ_LAST((head), headname); \
- (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
- (var) = (tvar))
-
-#define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
- for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
- (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
- (var) = (tvar))
-
-#define TAILQ_INIT(head) do { \
- TAILQ_FIRST((head)) = NULL; \
- (head)->tqh_last = &TAILQ_FIRST((head)); \
- QMD_TRACE_HEAD(head); \
-} while (0)
-
-#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
- QMD_TAILQ_CHECK_NEXT(listelm, field); \
- if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
- TAILQ_NEXT((elm), field)->field.tqe_prev = \
- &TAILQ_NEXT((elm), field); \
- else { \
- (head)->tqh_last = &TAILQ_NEXT((elm), field); \
- QMD_TRACE_HEAD(head); \
- } \
- TAILQ_NEXT((listelm), field) = (elm); \
- (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
- QMD_TRACE_ELEM(&(elm)->field); \
- QMD_TRACE_ELEM(&(listelm)->field); \
-} while (0)
-
-#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
- QMD_TAILQ_CHECK_PREV(listelm, field); \
- (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
- TAILQ_NEXT((elm), field) = (listelm); \
- *(listelm)->field.tqe_prev = (elm); \
- (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
- QMD_TRACE_ELEM(&(elm)->field); \
- QMD_TRACE_ELEM(&(listelm)->field); \
-} while (0)
-
-#define TAILQ_INSERT_HEAD(head, elm, field) do { \
- QMD_TAILQ_CHECK_HEAD(head, field); \
- if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
- TAILQ_FIRST((head))->field.tqe_prev = \
- &TAILQ_NEXT((elm), field); \
- else \
- (head)->tqh_last = &TAILQ_NEXT((elm), field); \
- TAILQ_FIRST((head)) = (elm); \
- (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
- QMD_TRACE_HEAD(head); \
- QMD_TRACE_ELEM(&(elm)->field); \
-} while (0)
-
-#define TAILQ_INSERT_TAIL(head, elm, field) do { \
- QMD_TAILQ_CHECK_TAIL(head, field); \
- TAILQ_NEXT((elm), field) = NULL; \
- (elm)->field.tqe_prev = (head)->tqh_last; \
- *(head)->tqh_last = (elm); \
- (head)->tqh_last = &TAILQ_NEXT((elm), field); \
- QMD_TRACE_HEAD(head); \
- QMD_TRACE_ELEM(&(elm)->field); \
-} while (0)
-
-#define TAILQ_LAST(head, headname) \
- (*(((struct headname *)((head)->tqh_last))->tqh_last))
-
-/*
- * The FAST function is fast in that it causes no data access other
- * then the access to the head. The standard LAST function above
- * will cause a data access of both the element you want and
- * the previous element. FAST is very useful for instances when
- * you may want to prefetch the last data element.
- */
-#define TAILQ_LAST_FAST(head, type, field) \
- (TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last, QUEUE_TYPEOF(type), field.tqe_next))
-
-#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
-
-#define TAILQ_PREV(elm, headname, field) \
- (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
-
-#define TAILQ_PREV_FAST(elm, head, type, field) \
- ((elm)->field.tqe_prev == &(head)->tqh_first ? NULL : \
- __containerof((elm)->field.tqe_prev, QUEUE_TYPEOF(type), field.tqe_next))
-
-#define TAILQ_REMOVE(head, elm, field) do { \
- QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \
- QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \
- QMD_TAILQ_CHECK_NEXT(elm, field); \
- QMD_TAILQ_CHECK_PREV(elm, field); \
- if ((TAILQ_NEXT((elm), field)) != NULL) \
- TAILQ_NEXT((elm), field)->field.tqe_prev = \
- (elm)->field.tqe_prev; \
- else { \
- (head)->tqh_last = (elm)->field.tqe_prev; \
- QMD_TRACE_HEAD(head); \
- } \
- *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
- TRASHIT(*oldnext); \
- TRASHIT(*oldprev); \
- QMD_TRACE_ELEM(&(elm)->field); \
-} while (0)
-
-#define TAILQ_SWAP(head1, head2, type, field) do { \
- QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \
- QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \
- (head1)->tqh_first = (head2)->tqh_first; \
- (head1)->tqh_last = (head2)->tqh_last; \
- (head2)->tqh_first = swap_first; \
- (head2)->tqh_last = swap_last; \
- if ((swap_first = (head1)->tqh_first) != NULL) \
- swap_first->field.tqe_prev = &(head1)->tqh_first; \
- else \
- (head1)->tqh_last = &(head1)->tqh_first; \
- if ((swap_first = (head2)->tqh_first) != NULL) \
- swap_first->field.tqe_prev = &(head2)->tqh_first; \
- else \
- (head2)->tqh_last = &(head2)->tqh_first; \
-} while (0)
-
-#endif /* !_SYS_QUEUE_H_ */
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 46/47] net/mvpp2: replace local definition of FOREACH_SAFE
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (44 preceding siblings ...)
2025-08-18 23:27 ` [RFC 45/47] eal: remove no longer used windows version of queue.h Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 47/47] drivers/raw: replace with TAILQ_FOREACH_SAFE Stephen Hemminger
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Liron Himi
There is now a standard macro for this.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/mvpp2/mrvl_mtr.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/mvpp2/mrvl_mtr.c b/drivers/net/mvpp2/mrvl_mtr.c
index c07ac95ddc..27596b8c99 100644
--- a/drivers/net/mvpp2/mrvl_mtr.c
+++ b/drivers/net/mvpp2/mrvl_mtr.c
@@ -505,13 +505,9 @@ mrvl_mtr_deinit(struct rte_eth_dev *dev)
struct mrvl_mtr_profile *profile, *tmp_profile;
struct mrvl_mtr *mtr, *tmp_mtr;
- for (mtr = LIST_FIRST(&priv->mtrs);
- mtr && (tmp_mtr = LIST_NEXT(mtr, next), 1);
- mtr = tmp_mtr)
+ LIST_FOREACH_SAFE(mtr, &priv->mtrs, next, tmp_mtr)
mrvl_destroy(dev, mtr->mtr_id, NULL);
- for (profile = LIST_FIRST(&priv->profiles);
- profile && (tmp_profile = LIST_NEXT(profile, next), 1);
- profile = tmp_profile)
+ LIST_FOREACH_SAFE(profile, &priv_profiles, next, tmp_profile)
mrvl_meter_profile_delete(dev, profile->profile_id, NULL);
}
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
* [RFC 47/47] drivers/raw: replace with TAILQ_FOREACH_SAFE
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
` (45 preceding siblings ...)
2025-08-18 23:27 ` [RFC 46/47] net/mvpp2: replace local definition of FOREACH_SAFE Stephen Hemminger
@ 2025-08-18 23:27 ` Stephen Hemminger
46 siblings, 0 replies; 48+ messages in thread
From: Stephen Hemminger @ 2025-08-18 23:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Rosen Xu
There is now a standard macro to safely walk tailq.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/raw/ifpga/base/ifpga_enumerate.c | 6 +++---
drivers/raw/ifpga/base/opae_intel_max10.c | 8 +-------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/raw/ifpga/base/ifpga_enumerate.c b/drivers/raw/ifpga/base/ifpga_enumerate.c
index 61eb6601ea..ff0790038c 100644
--- a/drivers/raw/ifpga/base/ifpga_enumerate.c
+++ b/drivers/raw/ifpga/base/ifpga_enumerate.c
@@ -6,6 +6,8 @@
#include <inttypes.h>
#include <unistd.h>
+#include <bsd_queue.h>
+
#include "opae_hw_api.h"
#include "ifpga_api.h"
@@ -725,9 +727,7 @@ static void dfl_fpga_enum_info_free(struct dfl_fpga_enum_info *info)
return;
/* remove all device feature lists in the list. */
- for (dfl = TAILQ_FIRST(&info->dfls);
- dfl && (tmp = TAILQ_NEXT(dfl, node), 1);
- dfl = tmp) {
+ TAILQ_FOREACH_SAFE(dfl, &info->dfls, node, tmp) {
TAILQ_REMOVE(&info->dfls, dfl, node);
opae_free(dfl);
}
diff --git a/drivers/raw/ifpga/base/opae_intel_max10.c b/drivers/raw/ifpga/base/opae_intel_max10.c
index 58c884a8d8..84e0767b3a 100644
--- a/drivers/raw/ifpga/base/opae_intel_max10.c
+++ b/drivers/raw/ifpga/base/opae_intel_max10.c
@@ -4,14 +4,8 @@
#include "opae_intel_max10.h"
#include <libfdt.h>
-#include "opae_osdep.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
+#include "opae_osdep.h"
int max10_sys_read(struct intel_max10_device *dev,
unsigned int offset, unsigned int *val)
--
2.47.2
^ permalink raw reply [flat|nested] 48+ messages in thread
end of thread, other threads:[~2025-08-18 23:37 UTC | newest]
Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 01/47] eal: add BSD version of queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 02/47] net/nfp: fix use after free Stephen Hemminger
2025-08-18 23:27 ` [RFC 03/47] eal: use bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 04/47] test: remove unnecessary inclusion of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 05/47] testpmd: use bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 06/47] dumpcap: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 07/47] proc-info: remove unnecessary sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 08/47] doc: suggest bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 09/47] test-pipeline: remove unnecessary use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 10/47] test-eventdev: use bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 11/47] test-bbdev, test-cmdline, test-mldev: don't use sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 12/47] examples: replace use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 13/47] hash: do not include sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 14/47] lpm: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 15/47] log: replace use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 16/47] ethdev: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 17/47] bpf: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 18/47] mempool: do not need sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 19/47] lib: remove use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 20/47] bus/fslmc: use rte_tailq.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 21/47] drivers/bus: replace use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 22/47] net/qede: use bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 23/47] net/bnxt: remove use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 24/47] net/intel: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 25/47] net/mlx5: remove unnecessary include " Stephen Hemminger
2025-08-18 23:27 ` [RFC 26/47] net/tap: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 27/47] net/axgbe: replace use " Stephen Hemminger
2025-08-18 23:27 ` [RFC 28/47] net/bnx2x: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 29/47] net/bonding: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 30/47] net/cxgbe: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 31/47] net/enic: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 32/47] net/failsafe: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 33/47] net/memif: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 34/47] net/mlx4: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 35/47] net/ngbe: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 36/47] net/ntnic: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 37/47] net/sfc: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 38/47] net/softnic: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 39/47] net/thunderx: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 40/47] net/txgbe: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 41/47] net/vdev_netvsc: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 42/47] net/vmxnet3: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 43/47] net/zxdh: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 44/47] net/dpaa2: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 45/47] eal: remove no longer used windows version of queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 46/47] net/mvpp2: replace local definition of FOREACH_SAFE Stephen Hemminger
2025-08-18 23:27 ` [RFC 47/47] drivers/raw: replace with TAILQ_FOREACH_SAFE Stephen Hemminger
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).