Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by bot+bpf-ci
Tue, 10 Nov 2026 04:53
Re: [PATCH bpf-next 15/15] docs: net: document the skb core extension area
Author: bot+bpf-ci
Date: Tue, 10 Nov 2026 04:53
Date: Tue, 10 Nov 2026 04:53
80 lines
12094 bytes
12094 bytes
--===============6053616401328202004==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
> docs: net: document the skb core extension area
TL;DR: The docs don't match the code: the "lost metadata" warning may fire
spuriously for BPF_PROG_RUN live frames on native drivers lacking
skb-ext-pass, and may hide a later real warning. Fix the code or the docs?
> diff --git a/Documentation/networking/xdp-rx-metadata.rst b/Documentation/networking/xdp-rx-metadata.rst
> --- a/Documentation/networking/xdp-rx-metadata.rst
> +++ b/Documentation/networking/xdp-rx-metadata.rst
[ ... ]
> +The kernel sets the stored values on the ``skb`` in these cases:
> +
> +- When cpumap or veth builds the ``skb`` from an ``xdp_frame`` after
> + ``XDP_REDIRECT``.
> +- When ``BPF_PROG_RUN`` with ``BPF_F_TEST_XDP_LIVE_FRAMES`` builds the
> + ``skb`` after ``XDP_PASS``.
> +- On ``XDP_PASS``, in a driver with the ``skb-ext-pass`` XDP feature,
> + see `Supported Devices`_.
> +
> +On ``XDP_PASS``, the stored values replace the values that the driver
> +sets from the RX descriptor. On a native XDP driver without the feature,
> +the kernel warns once when the program returns ``XDP_PASS`` with stored
> +values.
This isn't a bug in the text itself, but it doesn't match the code. Can the
warning fire for BPF_PROG_RUN with BPF_F_TEST_XDP_LIVE_FRAMES even though the
kernel does set the stored values there?
xdp_skb_ext_warn_pass() in net/core/xdp.c skips BPF_PROG_RUN only by testing
for the netdev_rx_queue xdp_rxq:
/* Generic XDP and BPF_PROG_RUN use the netdev_rx_queue xdp_rxq */
if (rxq->queue_index < dev->num_rx_queues &&
rxq == &dev->_rx[rxq->queue_index].xdp_rxq)
return;
/* No native XDP, so only generic XDP or BPF_PROG_RUN runs on dev */
if (!(dev->xdp_features & NETDEV_XDP_ACT_BASIC))
return;
In live frames mode the buffers use a private rxq instead.
xdp_test_run_setup() in net/bpf/test_run.c does:
xdp_rxq_info_reg(&xdp->rxq, orig_ctx->rxq->dev, 0, 0);
and xdp_test_run_init_page() passes &xdp->rxq to xdp_init_buff().
So with ctx_in.ingress_ifindex set to a native XDP device that lacks
NETDEV_XDP_ACT_SKB_EXT_PASS (any native driver other than ice or veth), a
program that calls bpf_xdp_skb_ext_store_rx_hash() and returns XDP_PASS gets:
bpf_prog_run_xdp()
xdp_skb_ext_warn_pass()
pr_warn_once("... the stored RX metadata is lost")
while xdp_test_run_batch()->xdp_recv_frames()->__xdp_build_skb_from_frame()
->xdp_skb_ext_to_skb() still applies the values to the skb.
Since this is pr_warn_once(), the false report also uses up the one warning,
so a later real loss on a native driver without the feature is not reported.
Should the warning skip the live frames rxq, or should the documentation say
that BPF_PROG_RUN live frames can warn? The code comes from f5e7dade0555
("xdp: add the skb-ext-pass XDP feature and warn without it"), and no later
commit in the series changes it.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/42755842687
--===============6053616401328202004==--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads