[PATCH v3 0/9] introduce common FOREACH_SAFE macros
Stephen Hemminger
stephen at networkplumber.org
Mon Aug 18 18:34:16 CEST 2025
On Wed, 12 Mar 2025 16:15:29 -0700
Stephen Hemminger <stephen at networkplumber.org> wrote:
> This series adds common macros for safe iteration over lists.
> It is a subset copy of the macros from FreeBSD that are
> missing from the Linux header sys/queue.h
>
> Chose this over several other options:
> - let each driver define their own as needed.
> One Intel driver got it wrong, others will as well.
> - rename all the queue macros to RTE_XXX variants.
> Seems like useless renaming and confusion.
> - Several distros have libbsd package with the correct macros.
> But adding yet another dependency to DPDK would be annoying
> for something this basic.
>
> There are more macros in FreeBSD header that could be useful,
> but we can add those later as needed here.
>
> v3 - add a few more open coded loops that can use a macro
>
> Stephen Hemminger (9):
> eal: add queue macro extensions from FreeBSD
> net/qede: fix use after free
> bus/fslmc: fix use after free
> net/bnxt: fix use after free
> net/iavf: replace local version of TAILQ_FOREACH_SAFE
> vhost: replace open coded TAILQ_FOREACH_SAFE
> raw/ifpga: use EAL version of TAILQ_FOREACH_SAFE
> net/i40e: replace open coded version of LIST_FOREACH_SAFE
> net/ice: replace open coded version of LIST_FOREACH_SAFE
>
> drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 5 +-
> drivers/net/bnxt/bnxt_filter.c | 8 +-
> drivers/net/intel/i40e/i40e_ethdev.c | 9 +-
> drivers/net/intel/iavf/iavf_vchnl.c | 8 +-
> drivers/net/intel/ice/ice_ethdev.c | 9 +-
> drivers/net/qede/qede_ethdev.h | 3 +-
> drivers/net/qede/qede_filter.c | 13 +-
> drivers/raw/ifpga/base/ifpga_enumerate.c | 4 +-
> drivers/raw/ifpga/base/opae_osdep.h | 1 +
> lib/eal/include/meson.build | 3 +-
> lib/eal/include/rte_queue.h | 174 +++++++++++++++++++++++
Revisiting this and wondering about naming...
The file rte_queue.h is not really DPDK (ie not related to runtime environment).
Thinking of calling it bsd_queue.h as a comprimise
More information about the dev
mailing list