1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/mutex.h>
6 #include <uapi/linux/bpf.h>
8 enum netns_bpf_attach_type {
9 NETNS_BPF_INVALID = -1,
10 NETNS_BPF_FLOW_DISSECTOR = 0,
11 MAX_NETNS_BPF_ATTACH_TYPE
14 static inline enum netns_bpf_attach_type
15 to_netns_bpf_attach_type(enum bpf_attach_type attach_type)
17 switch (attach_type) {
18 case BPF_FLOW_DISSECTOR:
19 return NETNS_BPF_FLOW_DISSECTOR;
21 return NETNS_BPF_INVALID;
25 /* Protects updates to netns_bpf */
26 extern struct mutex netns_bpf_mutex;
32 int netns_bpf_prog_query(const union bpf_attr *attr,
33 union bpf_attr __user *uattr);
34 int netns_bpf_prog_attach(const union bpf_attr *attr,
35 struct bpf_prog *prog);
36 int netns_bpf_prog_detach(const union bpf_attr *attr);
37 int netns_bpf_link_create(const union bpf_attr *attr,
38 struct bpf_prog *prog);
40 static inline int netns_bpf_prog_query(const union bpf_attr *attr,
41 union bpf_attr __user *uattr)
46 static inline int netns_bpf_prog_attach(const union bpf_attr *attr,
47 struct bpf_prog *prog)
52 static inline int netns_bpf_prog_detach(const union bpf_attr *attr)
57 static inline int netns_bpf_link_create(const union bpf_attr *attr,
58 struct bpf_prog *prog)
64 #endif /* _BPF_NETNS_H */