Re: [PATCH net-next 0/8] Introduce bpf ID
From: Martin KaFai Lau <hidden>
Date: 2017-05-31 04:30:53
On Tue, May 30, 2017 at 06:35:37PM -0600, David Ahern wrote:
On 5/30/17 6:08 PM, Martin KaFai Lau wrote:quoted
This patch series: 1) Introduce ID for both bpf_prog and bpf_map. 2) Add bpf commands to iterate the prog IDs and map IDs of the system. 3) Add bpf commands to get a prog/map fd from an ID 4) Add bpf command to get prog/map info from a fd. The prog/map info is a jump start in this patchset and it is not meant to be a complete list. They can be extended in the future patches.Interesting. This really simplifies the bpf retrieval I have been working on: https://github.com/dsahern/linux/commits/bpf/retrieve-bpf-wip Having the net device, filter, route, socket, cgroup, etc return the ids for attached programs solves the problem of getting a reference to all of the places BPF programs can be placed.
Right, it is the idea. I am also baking some follow-up patches for returning xdp-prog's id through netlink.
This patch set turns an id into a fd, and my patches allow the fd to be used to get the bpf code.