DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v3 0/2] eal: RTE_PTR_ADD/SUB char* for compiler optimizations
@ 2026-01-11 16:00 scott.k.mitch1
  2026-01-11 16:00 ` [PATCH v3 v3 1/2] " scott.k.mitch1
  2026-01-11 16:00 ` [PATCH v3 v3 2/2] mailmap: add Scott Mitchell scott.k.mitch1
  0 siblings, 2 replies; 5+ messages in thread
From: scott.k.mitch1 @ 2026-01-11 16:00 UTC (permalink / raw)
  To: dev; +Cc: mb, stephen, Scott Mitchell

From: Scott Mitchell <scott.k.mitch1@gmail.com>

This series optimizes RTE_PTR_ADD and RTE_PTR_SUB by using char* pointer
arithmetic instead of uintptr_t casts when operating on pointer types.
This enables better compiler optimization, particularly for Clang which
can now recognize simple pointer patterns and apply vectorization, loop
unrolling, and improved assembly.

The implementation uses C11 _Generic to dispatch based on input type,
maintaining full API compatibility while enabling significant performance
improvements in checksum operations (40% for small buffers, up to 8x for
larger buffers).

The first patch contains the core optimization changes and unit tests.
The second patch adds a .mailmap entry for consistent git attribution.

Note on checkpatch warnings: The patches generate checkpatch warnings due to
C11 _Generic syntax not being fully recognized by checkpatch.pl (designed for
kernel C). The warnings are false positives - the code is valid C11 and
follows the same pattern as existing DPDK code (e.g., __rte_constant macro,
rte_bitops.h). The COMPLEX_MACRO warning is explicitly acknowledged by
checkpatch itself as expected for statement expression macros.

Changes in v3:
- Fixed CI build failures on GCC
- Simplified const pointer handling: GCC type-checks all _Generic branches
  including unselected ones, causing errors with the nested _Generic/ternary
  approach used in v2. Now uses simple char* cast for all pointer types,
  which compiles on both GCC and Clang while still achieving the optimization
  goal (char* arithmetic enables compiler optimizations vs uintptr_t).
- Removed Clang-specific pragma for -Wconditional-type-mismatch (no longer
  needed without the ternary operator)

Changes in v2:
- Fixed copyright in test file to Apple Inc. (was Intel Corporation)
- Added checkpatch warning explanation to cover letter

Scott Mitchell (2):
  eal: RTE_PTR_ADD/SUB char* for compiler optimizations
  mailmap: add Scott Mitchell

 .mailmap                     |   1 +
 app/test/meson.build         |   1 +
 app/test/test_ptr_add_sub.c  | 190 +++++++++++++++++++++++++++++++++++
 lib/eal/include/rte_common.h |  60 +++++++++++
 4 files changed, 252 insertions(+)
 create mode 100644 app/test/test_ptr_add_sub.c

--
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-12  0:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-11 16:00 [PATCH v3 0/2] eal: RTE_PTR_ADD/SUB char* for compiler optimizations scott.k.mitch1
2026-01-11 16:00 ` [PATCH v3 v3 1/2] " scott.k.mitch1
2026-01-11 19:07   ` Stephen Hemminger
2026-01-11 16:00 ` [PATCH v3 v3 2/2] mailmap: add Scott Mitchell scott.k.mitch1
2026-01-12  0:06   ` Morten Brørup

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).