Re: [PATCH] bpf: cpumap: report Rx queue index to xdp_rxq_info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ujwal Kundur <ujwal.kundur@xxxxxxxxx>
Date: Mon,  9 Jun 2025 23:08:52 +0530

> Refer to the Rx queue using a XDP frame's attached netdev and ascertain
> the queue index from it.
> 
> Signed-off-by: Ujwal Kundur <ujwal.kundur@xxxxxxxxx>
> ---
>  kernel/bpf/cpumap.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
> index 67e8a2fc1a99..8230292deac1 100644
> --- a/kernel/bpf/cpumap.c
> +++ b/kernel/bpf/cpumap.c
> @@ -34,6 +34,7 @@
>  #include <linux/btf_ids.h>
>  
>  #include <linux/netdevice.h>
> +#include <net/netdev_rx_queue.h>
>  #include <net/gro.h>
>  
>  /* General idea: XDP packets getting XDP redirected to another CPU,
> @@ -196,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 = get_netdev_rx_queue_index(xdpf->dev_rx->_rx);

I won't repeat what the folks above already told you.

I'll just add that you may want to take a look at Lorenzo's series[0].
Rx queue index is sorta HW hint, so it shouldn't be a problem to add the
corresponding field to xdp_rx_meta.
Then, you can expand cpumap's code to try reading that HW meta if present.

>  
>  		xdp_convert_frame_to_buff(xdpf, &xdp);

[0]
https://lore.kernel.org/bpf/174897275458.1677018.15827867832940584671.stgit@firesoul

Thanks,
Olek




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux