From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 52E8E471E7; Sun, 11 Jan 2026 17:06:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D3CA24060B; Sun, 11 Jan 2026 17:06:30 +0100 (CET) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by mails.dpdk.org (Postfix) with ESMTP id 0D9574028F for ; Sun, 11 Jan 2026 17:06:30 +0100 (CET) Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-4ee257e56aaso51135641cf.0 for ; Sun, 11 Jan 2026 08:06:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768147589; x=1768752389; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4Q29+XNJ3Lyjq2LuC3aTQK6noVtfadZ6xcZ7PVCpkF0=; b=a/lD5LOh53khwR4aFeZ9NGv0URC/1mVdX2srtnzCizVRySTkAC3/xIGK4Q5Jesoe6d CsuM+6TKp9yKdZ5wLEB20X3GU3JBoWT59+Pd5qtaOvUQ/pIg9XS/p9LVk16kgYTILKHS GM9RPeHAUktkj8QbR8Ob/rwcTfxxaIq/PrKpxPI4SnZBgz5TKXZN44iPqoFXimEK7Xs5 2mGStxqXb+79v5StgVEmBJyDGUs9rQ5ED5XgzTaf5r2sp67WEaQfmcjBk+w5kzV0MhRR c9dzmYfDKjNnRk9f01YGH2yenTNErwYR+p1nUpVj6AhjUNAKjbbmn7/e7FM/ycuqfwkG 0Cow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768147589; x=1768752389; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state: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p7uI X-Google-Smtp-Source: AGHT+IHjOZvnK7KlkvHMsDkv6NIi9N+WMQwbCPkyXDnllzDedrX0HqTXqd64bv846Up1lg6Yp5mwgQ== X-Received: by 2002:a05:622a:1307:b0:4ee:1dd0:5a50 with SMTP id d75a77b69052e-4ffb3e65dfemr193012671cf.17.1768147589173; Sun, 11 Jan 2026 08:06:29 -0800 (PST) Received: from st57p01nt-relayp02.apple.com ([2600:1000:b19c:b9d9:b0a4:2ee1:3986:5e9d]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ffa8d3d34fsm106575561cf.4.2026.01.11.08.06.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 11 Jan 2026 08:06:28 -0800 (PST) From: scott.k.mitch1@gmail.com To: dev@dpdk.org Cc: mb@smartsharesystems.com, stephen@networkplumber.org, Scott Mitchell Subject: [PATCH v4 0/2] eal: RTE_PTR_ADD/SUB char* for compiler optimizations Date: Sun, 11 Jan 2026 11:06:24 -0500 Message-Id: <20260111160626.2103-1-scott.k.mitch1@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Scott Mitchell 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)