[PATCH 0/2] xdp: propagate rx queue_index through xdp_frame
From: Anand Kumar Shaw
Date: Tue Feb 17 2026 - 09:33:21 EST
When an XDP frame is redirected via cpumap or devmap, the original RX
queue index is lost. BPF programs running on the second-stage
(SEC("xdp/cpumap") or SEC("xdp/devmap")) always see ctx->rx_queue_index
as 0, and SKBs built from xdp_frame lack proper RX queue metadata.
This series adds a queue_index field to struct xdp_frame, populates it
during the xdp_buff to xdp_frame conversion (both normal and zero-copy
paths), and consumes it in cpumap and devmap when reconstructing
xdp_rxq_info. It also calls skb_record_rx_queue() in
__xdp_build_skb_from_frame(), resolving a documented gap.
Patch 1 adds the field and populates it in the conversion paths.
Patch 2 sets rxq.queue_index in cpumap and devmap, resolving a TODO
left since the original cpumap implementation.
struct xdp_frame grows by 4 bytes (40 -> 44 bytes), still within a
single 64-byte cacheline.
Anand Kumar Shaw (2):
xdp: propagate queue_index through xdp_frame
bpf: report queue_index to xdp_rxq_info in cpumap and devmap
include/net/xdp.h | 2 ++
kernel/bpf/cpumap.c | 2 +-
kernel/bpf/devmap.c | 1 +
net/core/xdp.c | 3 ++-
4 files changed, 6 insertions(+), 2 deletions(-)
--
2.39.5 (Apple Git-154)