From: "Morten Brørup" <mb@smartsharesystems.com>
To: "David Marchand" <david.marchand@redhat.com>,
"Stephen Hemminger" <stephen@networkplumber.org>
Cc: <dev@dpdk.org>, <stable@dpdk.org>,
"Ciara Loftus" <ciara.loftus@intel.com>,
"Maryam Tahhan" <mtahhan@redhat.com>,
"Xiaolong Ye" <xiaolong.ye@intel.com>,
"Kevin Laatz" <kevin.laatz@intel.com>,
"Thomas Monjalon" <thomas@monjalon.net>
Subject: RE: [PATCH] net/af_xdp: fix external mbuf transmit
Date: Mon, 12 Jan 2026 14:59:03 +0100 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65655@smartserver.smartshare.dk> (raw)
In-Reply-To: <CAJFAV8yvx_eLo9_wBDrzW-G+qiUYftGC1xUdAT6bLeCTVaxcoA@mail.gmail.com>
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Monday, 12 January 2026 08.59
>
> Hello,
>
> On Mon, 12 Jan 2026 at 02:04, Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> > #### Warning (Minor)
> >
> > **Implicit boolean comparison:** The `RTE_MBUF_DIRECT(mbuf)` macro
> returns an integer-like value (0 or non-zero). Per DPDK guidelines,
> explicit comparison with zero is preferred for integers:
> >
> > ```c
> > // Suggested (strict interpretation):
> > if (RTE_MBUF_DIRECT(mbuf) != 0 && mbuf->pool == umem->mb_pool) {
> > ```
> >
> > However, this macro is semantically boolean and is commonly used in
> direct form throughout DPDK. This is a stylistic preference, not a
> blocking issue.
>
> All callers in DPDK are using this macro as a boolean, and I found no
> opensource project doing differently.
> I would either fix the macro or change nothing at all.
The macro's return type is int, not bool.
However, it is defined as "!something()", so it returns only 0 or 1:
https://elixir.bootlin.com/dpdk/v25.11/source/lib/mbuf/rte_mbuf_core.h#L732
Also in DPDK 24.11:
https://elixir.bootlin.com/dpdk/v24.11/source/lib/mbuf/rte_mbuf_core.h#L715
And in DPDK 17.11:
https://elixir.bootlin.com/dpdk/v17.11/source/lib/librte_mbuf/rte_mbuf.h#L714
Haven't gone further back in history. :-)
prev parent reply other threads:[~2026-01-12 13:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 12:54 [PATCH] net/af_xdp: fix external mbuf transmit David Marchand
2026-01-12 1:03 ` Stephen Hemminger
2026-01-12 7:58 ` David Marchand
2026-01-12 13:59 ` Morten Brørup [this message]
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=98CBD80474FA8B44BF855DF32C47DC35F65655@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=ciara.loftus@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=kevin.laatz@intel.com \
--cc=mtahhan@redhat.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=xiaolong.ye@intel.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