XDP hardware hints discussion mail archive
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <jbrouer@redhat.com>
To: "Desouza, Ederson" <ederson.desouza@intel.com>
Cc: brouer@redhat.com,
	"xdp-hints@xdp-project.net" <xdp-hints@xdp-project.net>,
	Eelco Chaudron <echaudro@redhat.com>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: [xdp-hints] XDP-hints via local BTF info
Date: Wed, 17 Nov 2021 18:22:38 +0100	[thread overview]
Message-ID: <f2ea5784-c5b0-e7b8-422e-a677ff10589a@redhat.com> (raw)

Hi Ederson and others,

I've coded up an XDP + AF_XDP application[1] that creates and shares 
XDP-hints via BTF from XDP-prog to AF_XDP.

As explained in README[2] file, API for decoding the BTF data-structures 
in userspace have been placed into separate files lib_xsk_extend.c and 
lib_xsk_extend.h.
The API is based on what Ederson proposed[3], but I have heavily 
modified the API while using it in the AF_XDP app.  I've kept the 
hashmap optimization for now, but ended-up not using it... so I will 
propose removing it(?).
My hope is we can discuss and mature the API together, before proposing 
the API to be included in either libbpf or libxdp.

Notice no kernel changes required.  Everything works today with what BTF 
info are provided in the BPF ELF-object file.
Later, we want to extend the NIC drivers with the same kind of BTF info 
that describe the metadata area (our XDP-hints).  For now, AF_XDP 
userspace will instead get the BTF-info from decoding the ELF-object 
file.  Thus, for now the XDP BPF-prog will be the creator/provider of 
the XDP-hints layout.

The requirement for being a valid XDP-hints data-struct is that the last 
member in the struct is named "btf_id" and have size 4 bytes (32-bit).
With BTF the struct "string" names and member names becomes important, 
and is something that userspace will be "searching" for, to establish if 
a driver/BPF-prog provide a specific XDP-hints data structure.
There is no restriction on what the XDP-hints struct should be named, 
but we might want some conversions when added this to the kernel drivers.

Open to feedback,
-Jesper


  [1] 
https://github.com/xdp-project/bpf-examples/tree/master/AF_XDP-interaction

  [2] 
https://github.com/xdp-project/bpf-examples/blob/master/AF_XDP-interaction/README.org#xdp-hints-via-local-btf-info

  [3] 
https://lore.kernel.org/bpf/20210803010331.39453-15-ederson.desouza@intel.com/


             reply	other threads:[~2021-11-17 17:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 17:22 Jesper Dangaard Brouer [this message]
2021-11-17 20:07 ` [xdp-hints] " Karlsson, Magnus
2021-11-17 22:48   ` Toke Høiland-Jørgensen
2021-11-18  8:05     ` Karlsson, Magnus
2021-11-18 14:30       ` Jesper Dangaard Brouer
2021-11-18 14:57         ` Karlsson, Magnus
2021-11-18 15:18         ` John Fastabend
2021-11-19 14:53           ` Toke Høiland-Jørgensen
2021-11-22 12:45             ` [xdp-hints] Basic/Dumb question WAS(Re: " Jamal Hadi Salim
2021-11-22 13:59               ` [xdp-hints] " Toke Høiland-Jørgensen
2021-11-22 15:31                 ` Tom Herbert
2021-11-22 18:25                   ` Toke Høiland-Jørgensen
2021-11-22 12:57             ` [xdp-hints] " Alexander Lobakin
2021-11-24 11:54               ` Jesper Dangaard Brouer
2021-11-25 20:04                 ` Alexander Lobakin

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=f2ea5784-c5b0-e7b8-422e-a677ff10589a@redhat.com \
    --to=jbrouer@redhat.com \
    --cc=andrii@kernel.org \
    --cc=brouer@redhat.com \
    --cc=echaudro@redhat.com \
    --cc=ederson.desouza@intel.com \
    --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