From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Florian Kauer <florian.kauer@linutronix.de>, xdp-newbies@vger.kernel.org
Cc: Ferenc Fejes <ferenc.fejes@ericsson.com>
Subject: Re: Different packet handling after bpf_redirect_map with BPF_F_BROADCAST
Date: Thu, 04 Jul 2024 17:36:37 +0200 [thread overview]
Message-ID: <87cynt9nju.fsf@toke.dk> (raw)
In-Reply-To: <96e2f767-1dfc-4036-b7f8-3132e372048d@linutronix.de>
Florian Kauer <florian.kauer@linutronix.de> writes:
> On 7/4/24 16:51, Toke Høiland-Jørgensen wrote:
>> Florian Kauer <florian.kauer@linutronix.de> writes:
>>
>>>>>>> 3. Extend the kernel with a way to let the xdp/devmap prog know from
>>>>>>> which DEVMAP entry its execution originates (like an additional entry
>>>>>>> in the bpf_devmap_val that is then set in the xdp_md).
>>>>>>
>>>>>> This could be useful in any case, so I would personally be fine with
>>>>>> adding something like this (for both devmap and cpumap) :)
>>>>>
>>>>> Would you prefer a simple u32 (or similar) that could then be used as
>>>>> index for an array or a more complex data structure/void* to fill
>>>>> with arbitrary data?
>>>>
>>>> Well, the API for map indexing specifies a u64 map index, so just
>>>> reusing that would be the simplest :)
>>>
>>> u64? Now I am confused:
>>> "The key type is an unsigned 32-bit integer (4 bytes)"
>>> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/bpf/map_array.rst?h=next-20240703
>>
>> That's the documentation for array maps. Devmap is documented here:
>
> Well, an array map would be where I would search for the needed information
> (like the VLAN tag) after the redirect.
>
> But I guess you meant not just "reusing" the TYPE of the devmap map index
> for another field in bpf_devmap_val, but actually reusing the devmap index
> itself and write it into the xdp_md, right? Then, of course, it would be
> a u64 (and needs to be truncated when indexing the array with the VLAN
> tags).
Yes, exactly. The "you are currently running in this devmap slot"
metadata is something the kernel should provide to the running program
as part of the execution context.
> Makes sense to me. I will try to assemble a patch and send it out for
> discussion.
Cool :)
-Toke
prev parent reply other threads:[~2024-07-04 15:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 10:19 Different packet handling after bpf_redirect_map with BPF_F_BROADCAST Florian Kauer
2024-07-04 11:20 ` Toke Høiland-Jørgensen
2024-07-04 12:00 ` Florian Kauer
2024-07-04 12:30 ` Toke Høiland-Jørgensen
2024-07-04 13:08 ` Florian Kauer
2024-07-04 14:51 ` Toke Høiland-Jørgensen
2024-07-04 15:20 ` Florian Kauer
2024-07-04 15:36 ` Toke Høiland-Jørgensen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cynt9nju.fsf@toke.dk \
--to=toke@redhat.com \
--cc=ferenc.fejes@ericsson.com \
--cc=florian.kauer@linutronix.de \
--cc=xdp-newbies@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.