[PATCH] net/af_xdp: fix external mbuf transmit
Morten Brørup
mb at smartsharesystems.com
Mon Jan 12 14:59:03 CET 2026
> From: David Marchand [mailto:david.marchand at redhat.com]
> Sent: Monday, 12 January 2026 08.59
>
> Hello,
>
> On Mon, 12 Jan 2026 at 02:04, Stephen Hemminger
> <stephen at 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. :-)
More information about the stable
mailing list