Skip to content

xdp: propagate rx queue_index through xdp_frame

Anand Kumar Shaw bpf lkml netdev 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 2 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 2 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] xdp: propagate rx queue_index through xdp_frame

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(-)
Signature · 1 line
2.39.5 (Apple Git-154)