DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: scott.k.mitch1@gmail.com
Cc: dev@dpdk.org, mb@smartsharesystems.com
Subject: Re: [PATCH v3 v3 1/2] eal: RTE_PTR_ADD/SUB char* for compiler optimizations
Date: Sun, 11 Jan 2026 11:07:41 -0800	[thread overview]
Message-ID: <20260111110741.03cca1e4@phoenix.local> (raw)
In-Reply-To: <20260111160059.293-2-scott.k.mitch1@gmail.com>

On Sun, 11 Jan 2026 11:00:58 -0500
scott.k.mitch1@gmail.com wrote:

> +#define RTE_PTR_ADD(ptr, x) \
> +	(__extension__ ({ \
> +		/* Diagnostics suppressed for internal macro operations only. \
> +		 * Compiler type-checks all _Generic branches even when unselected, \
> +		 * triggering warnings with no external impact. */ \
> +		__rte_diagnostic_push \
> +		__rte_diagnostic_ignored_wcast_qual \
> +		/* Uses uintptr_t arithmetic for integer types (API compatibility), \
> +		 * and char* arithmetic for pointer types (enables optimization). */ \
> +		__auto_type _ptr_result = _Generic((ptr), \

NAK
No ignoring cast qualifiers. Is this just to preserve const?

DPDK does not guarantee API compatibility across versions, only ABI.

Why not clarify the code by using inline?

static inline void *__rte_ptr_offset(void *ptr, long delta)
{
	return (char *)ptr + delta;
}

#define RTE_PTR_ADD(ptr, x) __rte_ptr_offset(ptr, (long)(x))
#define RTE_PTR_SUB(ptr, x) __rte_ptr_offset(ptr, -(long)(x))

What about RTE_PTR_SUB() and RTE_PTR_DIFF()?



  reply	other threads:[~2026-01-11 19:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-11 16:00 [PATCH v3 0/2] " scott.k.mitch1
2026-01-11 16:00 ` [PATCH v3 v3 1/2] " scott.k.mitch1
2026-01-11 19:07   ` Stephen Hemminger [this message]
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

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=20260111110741.03cca1e4@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=scott.k.mitch1@gmail.com \
    /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).