Re: Access to a BPF map from a module

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

 




On 07/07/2021 01:53, Alexei Starovoitov wrote:
On Mon, Jul 5, 2021 at 9:00 AM Anton Ivanov
<anton.ivanov@xxxxxxxxxxxxxxxxx> wrote:
Hi List,

I have the following problem.

I want to perform some operations on a bpf map from a loadable module. The map is instantiated elsewhere and pinned.

How do I go about to obtain the map inside the module?

bpf_map_get* functions are not exported at present so they are not available. Is there another way besides them to fetch a bpf map "by fs name" in a kernel module?

If the access limitation is intentional, may I ask what is the actual rationale behind this decision?
BPF objects (like maps) and BPF infra are not extensible or accessible
from modules.

Programs are.

You can grab a program using bpf_prog_get_type_path and use it. It is an exported symbol.

The only thing missing is an equivalent of bpf_prog_get_type_path for maps, let's say bpf_map_get_path

In fact, I already have a patch for that too. I wanted to understand the rationale behind the restriction before submitting it.

That is intentional to make sure that BPF development stays on the public
mailing list and within the kernel.
If you could describe your use case we hopefully will be able to come
up with upstreamable

Build a switchdev switch to be used in conjunction with the normal kernel bridge/routing infra which uses BPF "firmware"

Rationale:

1. So people can play with switchdev and smartnics in general without having esoteric hardware

2. So people can play with these both on the kernel side and on the "guts/internals" side.

alternative to your proprietary module.
I intend to upstream it. In fact the WIP is already on github.

--
Anton R. Ivanov
https://www.kot-begemot.co.uk/





[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