Re: [PATCH RFC 0/4] Add XDP RX queue index metadata via kfuncs

Stanislav Fomichev
2025-09-24T22:31:36Z

On 09/24, Mehdi Ben Hadj Khelifa wrote:
> On 9/23/25 9:45 PM, Stanislav Fomichev wrote:
> > On 09/23, Mehdi Ben Hadj Khelifa wrote:
> > > ---
> > > Mehdi Ben Hadj Khelifa (4):
> > > netlink: specs: Add XDP RX queue index to XDP metadata
> > > net: xdp: Add xmo_rx_queue_index callback
> > > uapi: netdev: Add XDP RX queue index metadata flags
> > > net: veth: Implement RX queue index XDP hint
> > >
> > > Documentation/netlink/specs/netdev.yaml | 5 +++++
> > > drivers/net/veth.c | 12 ++++++++++++
> > > include/net/xdp.h | 5 +++++
> > > include/uapi/linux/netdev.h | 3 +++
> > > net/core/xdp.c | 15 +++++++++++++++
> > > tools/include/uapi/linux/netdev.h | 3 +++
> > > 6 files changed, 43 insertions(+)
> > > ---
> > > base-commit: 07e27ad16399afcd693be20211b0dfae63e0615f
> > > this is the commit of tag: v6.17-rc7 on the mainline.
> > > This patch series is intended to make a base for setting
> > > queue_index in the xdp_rxq_info struct in bpf/cpumap.c to
> > > the right index. Although that part I still didn't figure
> > > out yet,I m searching for my guidance to do that as well
> > > as for the correctness of the patches in this series.
>
> > But why do you need a kfunc getter? You can already get rxq index
> > via xdp_md rx_queue_index.
>
> Hi Stanislav, When i was looking at the available information or recent
> similar patches to populate the queue_index in xdp_rxq_info inside of
> the cpu map of an ebpf program to run xdp. i stumbled upon this:
> https://lkml.rescloud.iu.edu/2506.1/02808.html
>
> which suggests that in order to that, a struct called "xdp_rx_meta" should
> be the route to do that. In my navigation of code i only found
> the closest thing to that is xdp_rx_metadata which is an enum. I tried to
> follow was done for other metadata there like timestamp in order to see if
> that gets me closer to do that. which was stupid with the information that i
> have now but for my lack of experience (this is my first patch) i tried to
> reason with the code.So yeah, since xdp_md is the structure for transfering
> metadata to ebpf programs that use xdp. it's useless to have a kfunc to
> expose queue_index since it's already present there. But how would one try
> to populate the queue_index in xdp_rxq_info in cpu_map_bpf_prog_run_xdp()?
> Any sort of hints or guides would be much appreciated.
> Thank you for your time.

I don't really understand what queue_index means for the cpu map. It is
a kernel thread doing work, there is no queue. Maybe whoever added
the todo can clarify?