diff options
| author | Kui-Feng Lee <[email protected]> | 2023-03-23 03:24:00 +0000 |
|---|---|---|
| committer | Martin KaFai Lau <[email protected]> | 2023-03-23 05:53:02 +0000 |
| commit | 68b04864ca425d1894c96b8141d4fba1181f11cb (patch) | |
| tree | 66aa6314f9efbba3b8a6ec8363b6b127ed4f016b /tools/lib/bpf/libbpf.c | |
| parent | net: Update an existing TCP congestion control algorithm. (diff) | |
| download | kernel-68b04864ca425d1894c96b8141d4fba1181f11cb.tar.gz kernel-68b04864ca425d1894c96b8141d4fba1181f11cb.zip | |
bpf: Create links for BPF struct_ops maps.
Make bpf_link support struct_ops. Previously, struct_ops were always
used alone without any associated links. Upon updating its value, a
struct_ops would be activated automatically. Yet other BPF program
types required to make a bpf_link with their instances before they
could become active. Now, however, you can create an inactive
struct_ops, and create a link to activate it later.
With bpf_links, struct_ops has a behavior similar to other BPF program
types. You can pin/unpin them from their links and the struct_ops will
be deactivated when its link is removed while previously need someone
to delete the value for it to be deactivated.
bpf_links are responsible for registering their associated
struct_ops. You can only use a struct_ops that has the BPF_F_LINK flag
set to create a bpf_link, while a structs without this flag behaves in
the same manner as before and is registered upon updating its value.
The BPF_LINK_TYPE_STRUCT_OPS serves a dual purpose. Not only is it
used to craft the links for BPF struct_ops programs, but also to
create links for BPF struct_ops them-self. Since the links of BPF
struct_ops programs are only used to create trampolines internally,
they are never seen in other contexts. Thus, they can be reused for
struct_ops themself.
To maintain a reference to the map supporting this link, we add
bpf_struct_ops_link as an additional type. The pointer of the map is
RCU and won't be necessary until later in the patchset.
Signed-off-by: Kui-Feng Lee <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin KaFai Lau <[email protected]>
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
0 files changed, 0 insertions, 0 deletions
