Re: [RFC PATCH] bpf: cpumap: report queue_index to xdp_rxq_info
From: bot+bpf-ci
Date: Sat Apr 11 2026 - 14:31:29 EST
> diff --git a/include/net/xdp.h b/include/net/xdp.h
> --- a/include/net/xdp.h
> +++ b/include/net/xdp.h
> @@ -297,10 +297,11 @@ struct xdp_frame {
> u32 headroom;
> u32 metasize; /* uses lower 8-bits */
> /* Lifetime of xdp_rxq_info is limited to NAPI/enqueue time,
> - * while mem_type is valid on remote CPU.
> + * while mem_type and queue_index are valid on remote CPU.
> */
> enum xdp_mem_type mem_type:32;
> struct net_device *dev_rx; /* used by cpumap */
> + u32 queue_index; /* used by cpumap */
> u32 frame_sz;
> u32 flags; /* supported values defined in xdp_buff_flags */
> };
Is the updated comment accurate for all paths?
xdp_convert_buff_to_frame() has an early return for the zero-copy
path:
if (xdp->rxq->mem.type == MEM_TYPE_XSK_BUFF_POOL)
return xdp_convert_zc_to_xdp_frame(xdp);
xdp_convert_zc_to_xdp_frame() zeroes the frame with memset and
explicitly sets mem_type but never sets queue_index:
net/core/xdp.c:xdp_convert_zc_to_xdp_frame() {
...
memset(xdpf, 0, sizeof(*xdpf));
...
xdpf->mem_type = MEM_TYPE_PAGE_ORDER0;
/* queue_index is not set -- remains 0 from memset */
...
}
The comment says queue_index is "valid on remote CPU" but for
zero-copy converted frames it will always be 0 regardless of which
hardware queue originated the packet.
> @@ -441,6 +442,7 @@ struct xdp_frame *xdp_convert_buff_to_frame(struct xdp_buff *xdp)
>
> /* rxq only valid until napi_schedule ends, convert to xdp_mem_type */
> xdp_frame->mem_type = xdp->rxq->mem.type;
> + xdp_frame->queue_index = xdp->rxq->queue_index;
>
> return xdp_frame;
This assignment is only reached for the non-ZC path. Should
xdp_convert_zc_to_xdp_frame() also set queue_index from
xdp->rxq->queue_index to match?
---
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/24288456014