Re: [PATCH net-next 01/15] xdp: Let memory providers offer XDP a view of their net_iovs

From: netdev-bot+sashiko

Date: Wed Nov 25 2026 - 09:08:08 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] Two comments in include/net/xdp.h now contradict each other.

--

xdp: Let memory providers offer XDP a view of their net_iovs

This commit lets a net_iov area expose an XDP view: an address and size
for its net_iovs, plus a shift that gives the per-net_iov stride. It adds
xdp_netmem_address() and xdp_frag_address(). The XDP buffer helpers in
net/core/filter.c now use them, so they can read and write frags backed by
net_iovs that have a view.

> diff --git a/include/net/xdp.h b/include/net/xdp.h
> index 07231adfb5f82..1629e347b71fb 100644
> --- a/include/net/xdp.h
> +++ b/include/net/xdp.h
> @@ -164,6 +164,40 @@ xdp_init_buff(struct xdp_buff *xdp, u32 frame_sz, struct xdp_rxq_info *rxq)
> #endif
> }
>
> +/* XDP view of net_iovs: a memory provider may give XDP an address for its
> + * net_iovs, see &net_iov_area.xdp_vaddr. XDP code may read and write a
> + * net_iov only through these helpers, and only if its provider offers a
> + * view; such buffers must not become skb frags or xdp_frames. For the core
> + * and the stack every net_iov stays unreadable: netmem_address() and
> + * skb_frag_address() give NULL for it. A net_iov without a view gives NULL
> + * here too, so a reader that does not use these helpers fails closed.
> + */

[Severity: Low]
This isn't a bug, but does this comment now contradict the older one on
XDP_FLAGS_FRAGS_UNREADABLE in the same header?

include/net/xdp.h:
/* frags have unreadable mem, this can't be true for real XDP packets,
* but drivers may use XDP helpers to construct Rx pkt state even when
* XDP program is not attached.
*/
XDP_FLAGS_FRAGS_UNREADABLE = BIT(2),

The new block says XDP code may read and write net_iov frags when the
provider offers a view. That means XDP programs are expected to run on
buffers with net_iov frags.

xdp_buff_add_frag() still sets the flag for every net_iov frag, whether or
not it has a view. After the later patch "xdp: Run programs on buffers
that must not hold kernel structures", it sets both
XDP_FLAGS_FRAGS_UNREADABLE and XDP_FLAGS_SINK on NET_IOV_XSK frags:

if (unlikely(netmem_is_net_iov(netmem))) {
xdp_buff_set_frag_unreadable(xdp);
/* AF_XDP sink memory may only go to the socket of its queue */
if (netmem_to_net_iov(netmem)->type == NET_IOV_XSK)
xdp->flags |= XDP_FLAGS_SINK;
}

Native XDP programs then run on those buffers, so real XDP packets carry
the flag. At the end of the series, the old comment is unchanged.

Could the XDP_FLAGS_FRAGS_UNREADABLE comment be updated to match?

> +static __always_inline void *xdp_net_iov_address(const struct net_iov *niov)
> +{

[ ... ]

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124112707.118678-1-bjorn%40kernel.org