Re: [PATCH net-next 3/7] net: Admit native XDP on provider queues
From: Stanislav Fomichev
Date: Thu Nov 19 2026 - 19:32:20 EST
On 11/17, Björn Töpel wrote:
> XDP and memory providers are currently rejected on the same device.
> Header-split RX keeps headers in normal memory, so a program can
> filter packets without reading the provider payload.
>
> Keep this restriction unless the driver declares xdp_unreadable
> support. Admit native XDP in either attach order on these drivers.
> Existing header-split checks require frags-aware programs.
>
> The driver must mark provider fragments and reject XDP_TX while those
> fragments remain. The core rejects helper access and frame redirects.
>
> Keep generic and hardware-offloaded XDP rejected. Generic XDP builds
> an xdp_buff from an skb without carrying the unreadable flag. Its
> transmit and redirect paths also bypass the native driver guard.
>
> Signed-off-by: Björn Töpel <bjorn@xxxxxxxxxx>
> ---
> Documentation/networking/netmem.rst | 8 ++++++++
> include/net/netdev_queues.h | 6 ++++++
> include/net/xdp.h | 5 ++---
> net/core/dev.c | 28 ++++++++++++++++++++++++++--
> net/core/dev.h | 1 +
> net/core/netdev_rx_queue.c | 2 +-
> 6 files changed, 44 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/networking/netmem.rst b/Documentation/networking/netmem.rst
> index 6871dcdd700c..1ac94fc9d667 100644
> --- a/Documentation/networking/netmem.rst
> +++ b/Documentation/networking/netmem.rst
> @@ -131,6 +131,14 @@ Driver RX Requirements
> circulation times, such as when userspace holds a reference in zerocopy
> scenarios.
>
> +8. XDP programs run next to unreadable memory providers only if the driver
> + sets netdev_queue_mgmt_ops.xdp_unreadable, and only in native mode. The
> + programs see the headers in the linear part, and helpers that reach
> + unreadable fragments fail. Attach payload fragments with
> + xdp_buff_add_frag(), which marks unreadable ones, and drop XDP_TX of a
> + buffer for which xdp_buff_is_frag_unreadable() is true: the payload is
> + mapped for receive only. Redirects of such a buffer fail in the core.
> +
> Driver TX Requirements
> ======================
>
> diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h
> index c5335e935b7d..4f6702b284b4 100644
> --- a/include/net/netdev_queues.h
> +++ b/include/net/netdev_queues.h
> @@ -199,6 +199,11 @@ enum {
> *
> * @supported_params: Bitmask of supported parameters, see QCFG_*.
> *
> + * @xdp_unreadable: Native XDP programs may run on queues with unreadable
> + * memory providers. The driver builds XDP buffers with
> + * xdp_buff_add_frag(), and drops XDP_TX of a buffer for
> + * which xdp_buff_is_frag_unreadable() is true.
> + *
> * Note that @ndo_queue_mem_alloc and @ndo_queue_mem_free may be called while
> * the interface is closed. @ndo_queue_start and @ndo_queue_stop will only
> * be called for an interface which is open.
> @@ -229,6 +234,7 @@ struct netdev_queue_mgmt_ops {
> struct netlink_ext_ack *extack);
>
> unsigned int supported_params;
> + bool xdp_unreadable;
Any reason this is not a new QCFG_ in supported_params ?