From: Jesper Dangaard Brouer <jbrouer@redhat.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
"Desouza, Ederson" <ederson.desouza@intel.com>
Cc: brouer@redhat.com, "Swiatkowski,
Michal" <michal.swiatkowski@intel.com>,
"xdp-hints@xdp-project.net" <xdp-hints@xdp-project.net>,
"Lobakin, Alexandr" <alexandr.lobakin@intel.com>,
"Karlsson, Magnus" <magnus.karlsson@intel.com>,
"saeed@kernel.org" <saeed@kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"andrii.nakryiko@gmail.com" <andrii.nakryiko@gmail.com>
Subject: Re: A look into XDP hints for AF_XDP
Date: Wed, 7 Jul 2021 18:38:14 +0200 [thread overview]
Message-ID: <e05c1241-fdd7-19ae-26b4-cd4088057963@redhat.com> (raw)
In-Reply-To: <CAADnVQ+7mJhWzFR45n8RsFmo9M7UmumVRTQ7k+jH=fTr-5A4gA@mail.gmail.com>
On 25/06/2021 00.39, Alexei Starovoitov wrote:
> On Thu, Jun 24, 2021 at 3:18 PM Desouza, Ederson
> <ederson.desouza@intel.com> wrote:
>> Wait - it may be done in user space by libbpf, but it needs the
>> instrumented object code. It won't work for pure user space
>> applications, like those which use AF_XDP. Unless we're going to build
>> them in a special way, like we do for the kernel side of BPF
>> applications.
> It can be made to work. See my reply to Magnus.
> It's not a lot of code to make that happen.
I agree with Alexei, it will not be a lot of code to interpret the BTF
info in userspace.
In userspace AF_XDP code, we could simply decode the offset of e.g.
member named "rxhash32" and validate that the expected size is 32 bit (4
bytes). Then we store the offset associated with rxhash32 for a given
BTF-ID. When AF_XDP program see BTF-ID it can lookup the offset of
rxhash32 and move those 4-bytes into a variable for rxhash32.
Implementation details (sorry to complicate this slightly): Because
metadata area grows with a negative offset seen from ctx->data, and
AF_XDP descriptor don't know the size of metadata area (like XDP does).
Then the offset we store (e.g. associated with rxhash32) need to be
converted to a negative offset from packet ctx->data start.
--Jesper
next prev parent reply other threads:[~2021-07-07 16:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 0:10 Desouza, Ederson
2021-06-24 19:54 ` Jesper Dangaard Brouer
2021-06-24 21:54 ` Desouza, Ederson
2021-06-24 22:17 ` Desouza, Ederson
2021-06-24 22:39 ` Alexei Starovoitov
2021-07-07 16:38 ` Jesper Dangaard Brouer [this message]
2021-07-07 22:26 ` Andrii Nakryiko
2021-07-15 19:34 ` Desouza, Ederson
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
List information: https://lists.xdp-project.net/postorius/lists/xdp-hints.xdp-project.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e05c1241-fdd7-19ae-26b4-cd4088057963@redhat.com \
--to=jbrouer@redhat.com \
--cc=alexandr.lobakin@intel.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=ederson.desouza@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=michal.swiatkowski@intel.com \
--cc=saeed@kernel.org \
--cc=xdp-hints@xdp-project.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox