DPDK patches and discussions
 help / color / mirror / Atom feed
From: scott.k.mitch1@gmail.com
To: dev@dpdk.org
Cc: mb@smartsharesystems.com, stephen@networkplumber.org,
	Scott Mitchell <scott.k.mitch1@gmail.com>
Subject: [PATCH v4 0/2] eal: RTE_PTR_ADD/SUB char* for compiler optimizations
Date: Sun, 11 Jan 2026 11:06:24 -0500	[thread overview]
Message-ID: <20260111160626.2103-1-scott.k.mitch1@gmail.com> (raw)

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 v4:
- Fixed duplicate "v3 v3" in subject line from v3

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)


             reply	other threads:[~2026-01-11 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-11 16:06 scott.k.mitch1 [this message]
2026-01-11 16:06 ` [PATCH v4 1/2] " scott.k.mitch1
2026-01-11 16:06 ` [PATCH v4 2/2] mailmap: add Scott Mitchell scott.k.mitch1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260111160626.2103-1-scott.k.mitch1@gmail.com \
    --to=scott.k.mitch1@gmail.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).