When packets are redirected via cpumap, the original queue_index information from xdp_rxq_info was lost. This is because the xdp_frame structure did not include a queue_index field. This patch adds a queue_index field to struct xdp_frame and ensures it is properly preserved during the xdp_buff to xdp_frame conversion. Now the queue_index is reported to the xdp_rxq_info. Resolves the TODO comment in cpu_map_bpf_prog_run_xdp(). Signed-off-by: saiaunghlyanhtet --- include/net/xdp.h | 2 ++ kernel/bpf/cpumap.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/net/xdp.h b/include/net/xdp.h index aa742f413c35..feafeed327a2 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -303,6 +303,7 @@ struct xdp_frame { struct net_device *dev_rx; /* used by cpumap */ u32 frame_sz; u32 flags; /* supported values defined in xdp_buff_flags */ + u32 queue_index; }; static __always_inline bool xdp_frame_has_frags(const struct xdp_frame *frame) @@ -421,6 +422,7 @@ int xdp_update_frame_from_buff(const struct xdp_buff *xdp, xdp_frame->metasize = metasize; xdp_frame->frame_sz = xdp->frame_sz; xdp_frame->flags = xdp->flags; + xdp_frame->queue_index = xdp->rxq->queue_index; return 0; } diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c index 04171fbc39cb..f5b2ff17e328 100644 --- a/kernel/bpf/cpumap.c +++ b/kernel/bpf/cpumap.c @@ -195,7 +195,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->queue_index; xdp_convert_frame_to_buff(xdpf, &xdp); -- 2.52.0