Re: Pass a map to a global BPF function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 13, 2021 at 10:44 AM Zvi Effron <zeffron@xxxxxxxxxxxxx> 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.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux