* [PATCH bpf-next v2] bpf/cpumap.c: Remove unnecessary TODO comment
@ 2025-10-20 17:02 Mehdi Ben Hadj Khelifa
2025-10-21 9:37 ` Jesper Dangaard Brouer
0 siblings, 1 reply; 3+ messages in thread
From: Mehdi Ben Hadj Khelifa @ 2025-10-20 17:02 UTC (permalink / raw)
To: ast, daniel, davem, kuba, hawk, john.fastabend, sdf, andrii,
martin.lau, eddyz87, song, yonghong.song, kpsingh, haoluo, jolsa
Cc: netdev, bpf, linux-kernel, skhan, david.hunter.linux, khalid,
linux-kernel-mentees, Mehdi Ben Hadj Khelifa
After discussion with bpf maintainers[1], queue_index could
be propagated to the remote XDP program by the xdp_md struct[2]
which makes this todo a misguide for future effort.
[1]:https://lore.kernel.org/all/87y0q23j2w.fsf@cloudflare.com/
[2]:https://docs.ebpf.io/linux/helper-function/bpf_xdp_adjust_meta/
Signed-off-by: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@gmail.com>
---
Changelog:
Changes from v1:
-Added a comment to clarify that RX queue_index is lost after the frame
redirection.
Link:https://lore.kernel.org/bpf/d9819687-5b0d-4bfa-9aec-aef71b847383@gmail.com/T/#mcb6a0315f174d02db3c9bc4fa556cc939c87a706
kernel/bpf/cpumap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
index 703e5df1f4ef..6856a4a67840 100644
--- a/kernel/bpf/cpumap.c
+++ b/kernel/bpf/cpumap.c
@@ -195,7 +195,10 @@ 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 */
+ /* The NIC RX queue_index is lost after the frame redirection
+ * but in case of need, it can be passed as a custom XDP
+ * metadata via xdp_md struct to the remote XDP program
+ */
xdp_convert_frame_to_buff(xdpf, &xdp);
--
2.51.1.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next v2] bpf/cpumap.c: Remove unnecessary TODO comment
2025-10-20 17:02 [PATCH bpf-next v2] bpf/cpumap.c: Remove unnecessary TODO comment Mehdi Ben Hadj Khelifa
@ 2025-10-21 9:37 ` Jesper Dangaard Brouer
2025-10-21 11:13 ` Mehdi Ben Hadj Khelifa
0 siblings, 1 reply; 3+ messages in thread
From: Jesper Dangaard Brouer @ 2025-10-21 9:37 UTC (permalink / raw)
To: Mehdi Ben Hadj Khelifa, ast, daniel, davem, kuba, john.fastabend,
sdf, andrii, martin.lau, eddyz87, song, yonghong.song, kpsingh,
haoluo, jolsa
Cc: netdev, bpf, linux-kernel, skhan, david.hunter.linux, khalid,
linux-kernel-mentees
On 20/10/2025 19.02, Mehdi Ben Hadj Khelifa wrote:
> After discussion with bpf maintainers[1], queue_index could
> be propagated to the remote XDP program by the xdp_md struct[2]
> which makes this todo a misguide for future effort.
>
> [1]:https://lore.kernel.org/all/87y0q23j2w.fsf@cloudflare.com/
> [2]:https://docs.ebpf.io/linux/helper-function/bpf_xdp_adjust_meta/
>
> Signed-off-by: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@gmail.com>
> ---
> Changelog:
>
> Changes from v1:
>
> -Added a comment to clarify that RX queue_index is lost after the frame
> redirection.
>
> Link:https://lore.kernel.org/bpf/d9819687-5b0d-4bfa-9aec-aef71b847383@gmail.com/T/#mcb6a0315f174d02db3c9bc4fa556cc939c87a706
> kernel/bpf/cpumap.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
> index 703e5df1f4ef..6856a4a67840 100644
> --- a/kernel/bpf/cpumap.c
> +++ b/kernel/bpf/cpumap.c
> @@ -195,7 +195,10 @@ 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 */
> + /* The NIC RX queue_index is lost after the frame redirection
> + * but in case of need, it can be passed as a custom XDP
> + * metadata via xdp_md struct to the remote XDP program
Argh, saying XDP metadata is accessed via the xdp_md struct is just wrong.
Nacked-by: Jesper Dangaard Brouer <hawk@kernel.org>
> + */
>
> xdp_convert_frame_to_buff(xdpf, &xdp);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next v2] bpf/cpumap.c: Remove unnecessary TODO comment
2025-10-21 9:37 ` Jesper Dangaard Brouer
@ 2025-10-21 11:13 ` Mehdi Ben Hadj Khelifa
0 siblings, 0 replies; 3+ messages in thread
From: Mehdi Ben Hadj Khelifa @ 2025-10-21 11:13 UTC (permalink / raw)
To: Jesper Dangaard Brouer, ast, daniel, davem, kuba, john.fastabend,
sdf, andrii, martin.lau, eddyz87, song, yonghong.song, kpsingh,
haoluo, jolsa
Cc: netdev, bpf, linux-kernel, skhan, david.hunter.linux, khalid,
linux-kernel-mentees
On 10/21/25 10:37 AM, Jesper Dangaard Brouer wrote:
>
>
> On 20/10/2025 19.02, Mehdi Ben Hadj Khelifa wrote:
>> After discussion with bpf maintainers[1], queue_index could
>> be propagated to the remote XDP program by the xdp_md struct[2]
>> which makes this todo a misguide for future effort.
>>
>> [1]:https://lore.kernel.org/all/87y0q23j2w.fsf@cloudflare.com/
>> [2]:https://docs.ebpf.io/linux/helper-function/bpf_xdp_adjust_meta/
>>
>> Signed-off-by: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@gmail.com>
>> ---
>> Changelog:
>>
>> Changes from v1:
>>
>> -Added a comment to clarify that RX queue_index is lost after the frame
>> redirection.
>>
>> Link:https://lore.kernel.org/bpf/d9819687-5b0d-4bfa-9aec-
>> aef71b847383@gmail.com/T/#mcb6a0315f174d02db3c9bc4fa556cc939c87a706
>> kernel/bpf/cpumap.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
>> index 703e5df1f4ef..6856a4a67840 100644
>> --- a/kernel/bpf/cpumap.c
>> +++ b/kernel/bpf/cpumap.c
>> @@ -195,7 +195,10 @@ 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 */
>> + /* The NIC RX queue_index is lost after the frame redirection
>> + * but in case of need, it can be passed as a custom XDP
>> + * metadata via xdp_md struct to the remote XDP program
>
> Argh, saying XDP metadata is accessed via the xdp_md struct is just wrong.
>
Ack, I didn't clarify that XDP metadata should be propagated via the
bpf_xdp_adjust_meta like mentionned in the link[2]... Maybe I was
thinking more in the technical side that xdp_md->data_meta would hold
the value internally... I will send a v3 with appropriate changes.
Thanks for the review.
Best Regards,
Mehdi Ben Hadj Khelifa
> Nacked-by: Jesper Dangaard Brouer <hawk@kernel.org>
>
>> + */
>> xdp_convert_frame_to_buff(xdpf, &xdp);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-21 10:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 17:02 [PATCH bpf-next v2] bpf/cpumap.c: Remove unnecessary TODO comment Mehdi Ben Hadj Khelifa
2025-10-21 9:37 ` Jesper Dangaard Brouer
2025-10-21 11:13 ` Mehdi Ben Hadj Khelifa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox