[PATCH v2 0/5] eal: RTE_PTR_ADD qualifiers and real unaligned types

Stephen Hemminger stephen at networkplumber.org
Sun Sep 6 19:09:53 CEST 2026


This series started with Scott Mitchell's patch to preserve pointer
qualifications across RTE_PTR_ADD and RTE_PTR_SUB. Reviewing it
turned up two further problems.

The first is that unaligned_uintNN_t only had alignment 1 on armv8
aarch32, the one target setting RTE_ARCH_STRICT_ALIGN. Everywhere
else they were ordinary aligned types, so code using them to read
or write at arbitrary offsets was still undefined behaviour and was
reported by UBSAN. Giving them alignment 1 on all architectures
fixes that, and once mlx5 no longer needs its strict alignment
path, RTE_ARCH_STRICT_ALIGN has no users left and is removed.

The second is the jhash test, which declared its key as a byte
array and cast it to unaligned_uint32_t * to pass to a function
taking const uint32_t *. That is fixed first in the series so the
alignment change does not introduce a new clang warning.

Only patch 1 should go to stable.

Note for reviewers: unaligned_uintNN_t is in an installed header,
so applications embedding one of these types in a structure will
see its layout change. That is called out in the release notes.

The types are also used in the hash key compare path
(rte_cuckoo_hash.c, rte_cmp_generic.h) and for 8 byte ring elements
(rte_ring_elem_pvt.h). Scalar code generation is unchanged on x86,
but the compiler can no longer assume alignment when combining
adjacent accesses, so hash and ring perf results would be welcome,
particularly on arm.


Scott Mitchell (1):
  eal: RTE_PTR_ADD/SUB API improvements

Stephen Hemminger (4):
  test: fix jhash 32 bit key type
  eal: make unaligned really unaligned
  net/mlx5: drop unnecessary STRICT_ALIGN
  arm: remove no longer used RTE_ARCH_STRICT_ALIGN

 app/test-pmd/cmdline_flow.c                 |   4 +-
 app/test/test_common.c                      | 507 +++++++++++++++++++-
 app/test/test_hash_functions.c              |  14 +-
 config/arm/meson.build                      |   1 -
 doc/guides/rel_notes/release_26_11.rst      |  20 +
 drivers/bus/cdx/cdx_vfio.c                  |  13 +-
 drivers/bus/pci/linux/pci.c                 |   6 +-
 drivers/bus/vmbus/linux/vmbus_uio.c         |   6 +-
 drivers/common/cnxk/roc_cpt_debug.c         |  12 +-
 drivers/common/cnxk/roc_ml.c                |   4 +-
 drivers/common/cnxk/roc_nix_bpf.c           |   2 +-
 drivers/common/cnxk/roc_nix_inl.h           |   4 +-
 drivers/common/cnxk/roc_nix_inl_dp.h        |   8 +-
 drivers/common/mlx5/mlx5_common_mr.c        |   2 +-
 drivers/dma/idxd/idxd_pci.c                 |   2 +-
 drivers/dma/odm/odm_dmadev.c                |   4 +-
 drivers/event/cnxk/cn10k_worker.c           |  32 +-
 drivers/event/cnxk/cn20k_worker.c           |  32 +-
 drivers/mempool/bucket/rte_mempool_bucket.c |   7 +-
 drivers/net/cxgbe/sge.c                     |   4 +-
 drivers/net/ena/ena_ethdev.c                |  10 +-
 drivers/net/mlx4/mlx4_txq.c                 |   3 +-
 drivers/net/mlx5/mlx5_tx.h                  |  12 +-
 lib/eal/common/eal_common_fbarray.c         |   2 +-
 lib/eal/common/eal_common_memory.c          |  29 +-
 lib/eal/common/eal_common_options.c         |   3 +-
 lib/eal/common/malloc_elem.h                |  34 +-
 lib/eal/freebsd/eal_memory.c                |   4 +
 lib/eal/include/rte_common.h                | 188 +++++++-
 lib/eal/linux/eal_memalloc.c                |   5 +
 lib/eal/linux/eal_memory.c                  |   7 +
 lib/eal/windows/eal_memalloc.c              |   5 +
 lib/graph/rte_graph.h                       |   4 +-
 lib/latencystats/rte_latencystats.c         |   3 +
 lib/mbuf/rte_mbuf.c                         |   2 +
 lib/mbuf/rte_mbuf.h                         |   3 +
 lib/member/rte_xxh64_avx512.h               |   6 +-
 lib/mempool/rte_mempool.h                   |   5 +
 lib/pdcp/pdcp_entity.h                      |   8 +-
 lib/vhost/vhost_user.c                      |  13 +-
 40 files changed, 870 insertions(+), 160 deletions(-)

-- 
2.53.0



More information about the dev mailing list