Re: [PATCH 1/2] bpf: preserve rx_queue_index across XDP redirects

From: Jakub Kicinski

Date: Wed Jun 24 2026 - 21:54:57 EST


On Sat, 20 Jun 2026 12:13:13 +0000 Siddharth C wrote:
> diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
> index 5e59ab896f05..8f2d7013620f 100644
> --- a/kernel/bpf/cpumap.c
> +++ b/kernel/bpf/cpumap.c
> @@ -197,7 +197,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu,
>
> rxq.dev = xdpf->dev_rx;
> rxq.mem.type = xdpf->mem_type;
> - /* TODO: report queue_index to xdp_rxq_info */
> + rxq.queue_index = xdpf->rx_queue_index;

Do you actually need this or you're just trying to address the TODO?
You can always store the info you need in the metadata prepend.

> xdp_convert_frame_to_buff(xdpf, &xdp);
>
> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
> index dc7b859e8bbf..f419fa0e53e5 100644
> --- a/kernel/bpf/devmap.c
> +++ b/kernel/bpf/devmap.c
> @@ -339,7 +339,7 @@ static int dev_map_bpf_prog_run(struct bpf_prog *xdp_prog,
> struct net_device *rx_dev)
> {
> struct xdp_txq_info txq = { .dev = tx_dev };
> - struct xdp_rxq_info rxq = { .dev = rx_dev };
> + struct xdp_rxq_info rxq = { };
> struct xdp_buff xdp;
> int i, nframes = 0;
>
> @@ -349,6 +349,9 @@ static int dev_map_bpf_prog_run(struct bpf_prog *xdp_prog,
> int err;
>
> xdp_convert_frame_to_buff(xdpf, &xdp);
> + rxq.dev = rx_dev;
> + rxq.mem.type = xdpf->mem_type;

Why are you setting mem_type?

> + rxq.queue_index = xdpf->rx_queue_index;
> xdp.txq = &txq;
> xdp.rxq = &rxq;