From: Jakub Kicinski <kuba@kernel.org>
To: John Fastabend <john.fastabend@gmail.com>
Cc: Yonghong Song <yhs@meta.com>,
hawk@kernel.org, daniel@iogearbox.net, davem@davemloft.net,
ast@kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org,
sdf@google.com
Subject: Re: [1/2 bpf-next] bpf: expose net_device from xdp for metadata
Date: Wed, 16 Nov 2022 11:46:33 -0800 [thread overview]
Message-ID: <20221116114633.6a297935@kernel.org> (raw)
In-Reply-To: <63728784e2d15_43f25208be@john.notmuch>
On Mon, 14 Nov 2022 10:23:00 -0800 John Fastabend wrote:
> > > The other piece I would like to get out of the xdp ctx is the
> > > rx descriptor of the device. I want to use this to pull out info
> > > about the received buffer for debug mostly, but could also grab
> > > some fields that are useful for us to track. That we can likely
> > > do this,
> > >
> > > ctx->rxdesc
> >
> > I think it is possible. Adding rxdesc to xdp_buff as
> > unsigned char *rxdesc;
> > or
> > void *rxdesc;
We should avoid having to add fields to structures just to expose
them to BPF. Would the approach that Stan uses not work here?
Having the driver place the desc pointer in a well known location
on the stack and kfunc or some other magic resolve it?
> > and using bpf_get_kern_btf_id(kctx->rxdesc, expected_btf_id)
> > to get a btf id for rxdesc. Here we assume there is
> > a struct available for rxdesc in vmlinux.h.
> > Then you can trace through rxdesc with direct memory
> > access.
>
> The trickest part here is that the rxdesc btf_id depends on
> what device we are attached to. So would need something to
> resolve the btf_id from attached device.
Right, driver needs to get involved one way or another, so it can
return "how to get to the descriptor given a xdp_buff pointer"
as well as the btf_id or dynptr params.
(Sorry, I'm only catching up with the xdp hw field discussions
now so this may have already been discussed elsewhere..)
next prev parent reply other threads:[~2022-11-16 19:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 21:52 [0/2 bpf-next] Expose netdev in XDP progs with BTF_ID John Fastabend
2022-11-09 21:52 ` [1/2 bpf-next] bpf: expose net_device from xdp for metadata John Fastabend
2022-11-10 1:37 ` Yonghong Song
2022-11-10 2:17 ` John Fastabend
2022-11-10 12:45 ` Toke Høiland-Jørgensen
2022-11-10 16:53 ` Yonghong Song
2022-11-10 17:02 ` John Fastabend
2022-11-11 10:51 ` Jesper Dangaard Brouer
2022-11-11 15:15 ` Yonghong Song
2022-11-10 16:46 ` Yonghong Song
2022-11-10 22:58 ` John Fastabend
2022-11-10 23:11 ` John Fastabend
2022-11-11 6:34 ` Yonghong Song
2022-11-13 18:27 ` John Fastabend
2022-11-14 16:51 ` Yonghong Song
2022-11-14 18:23 ` John Fastabend
2022-11-16 19:46 ` Jakub Kicinski [this message]
2022-11-11 6:28 ` Yonghong Song
2022-11-11 1:13 ` kernel test robot
2022-11-11 3:04 ` kernel test robot
2022-11-11 5:15 ` kernel test robot
2022-11-09 21:52 ` [2/2 bpf-next] bpf: add selftest to read xdp_md fields John Fastabend
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=20221116114633.6a297935@kernel.org \
--to=kuba@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
--cc=yhs@meta.com \
/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;
as well as URLs for NNTP newsgroup(s).