From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Zvi Effron <zeffron@riotgames.com>, bpf <bpf@vger.kernel.org>
Cc: Xdp <xdp-newbies@vger.kernel.org>
Subject: Re: Pass a map to a global BPF function
Date: Tue, 21 Sep 2021 13:04:03 -0700 [thread overview]
Message-ID: <CAADnVQJYmOrTq47r413WDcVurv8hL0zS4yUdgwghanA6ffxSXw@mail.gmail.com> (raw)
In-Reply-To: <CAC1LvL0670CWq183g54w3HGsByjcBaBL2rrTP1PyTbbYfm76iw@mail.gmail.com>
On Mon, Sep 13, 2021 at 10:44 AM Zvi Effron <zeffron@riotgames.com> wrote:
>
> Hi all,
>
> We have some map-of-arrays that we use for tracking labeled metrics in
> our XDP code. The inner map tracks the metrics for a given label,
> which is the key in the outer map.
>
> Our XDP code calls several global BPF functions (freplaced, so can't
> be inlined). Currently, each global function has to make a lookup to
> get the inner map to record its metrics. Now that non-context pointers
> can be passed to global BPF functions, is it possible to pass maps to
> these global functions?
The program can pass a pointer to struct bpf_map and the verifier
will recognize it as PTR_TO_BTF_ID.
It won't be a CONST_PTR_TO_MAP, so secondary lookup won't be
allowed, but if that's the desired use case then the verifier can be extended
to recognize it.
prev parent reply other threads:[~2021-09-21 20:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 17:43 Pass a map to a global BPF function Zvi Effron
2021-09-21 20:04 ` Alexei Starovoitov [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=CAADnVQJYmOrTq47r413WDcVurv8hL0zS4yUdgwghanA6ffxSXw@mail.gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=xdp-newbies@vger.kernel.org \
--cc=zeffron@riotgames.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 read-only IMAP folder(s) and NNTP newsgroup(s).