xref: /linux/include/net/netns/bpf.h (revision aebb51ec3db2a871d74b4afad3f9914812acf120)
1a3fd7ceeSJakub Sitnicki /* SPDX-License-Identifier: GPL-2.0 */
2a3fd7ceeSJakub Sitnicki /*
3a3fd7ceeSJakub Sitnicki  * BPF programs attached to network namespace
4a3fd7ceeSJakub Sitnicki  */
5a3fd7ceeSJakub Sitnicki 
6a3fd7ceeSJakub Sitnicki #ifndef __NETNS_BPF_H__
7a3fd7ceeSJakub Sitnicki #define __NETNS_BPF_H__
8a3fd7ceeSJakub Sitnicki 
9*aebb51ecSJakub Kicinski #include <linux/list.h>
10a3fd7ceeSJakub Sitnicki 
11a3fd7ceeSJakub Sitnicki struct bpf_prog;
12695c1214SJakub Sitnicki struct bpf_prog_array;
13a3fd7ceeSJakub Sitnicki 
14*aebb51ecSJakub Kicinski enum netns_bpf_attach_type {
15*aebb51ecSJakub Kicinski 	NETNS_BPF_INVALID = -1,
16*aebb51ecSJakub Kicinski 	NETNS_BPF_FLOW_DISSECTOR = 0,
17*aebb51ecSJakub Kicinski 	NETNS_BPF_SK_LOOKUP,
18*aebb51ecSJakub Kicinski 	MAX_NETNS_BPF_ATTACH_TYPE
19*aebb51ecSJakub Kicinski };
20*aebb51ecSJakub Kicinski 
21a3fd7ceeSJakub Sitnicki struct netns_bpf {
22695c1214SJakub Sitnicki 	/* Array of programs to run compiled from progs or links */
23695c1214SJakub Sitnicki 	struct bpf_prog_array __rcu *run_array[MAX_NETNS_BPF_ATTACH_TYPE];
24695c1214SJakub Sitnicki 	struct bpf_prog *progs[MAX_NETNS_BPF_ATTACH_TYPE];
25ab53cad9SJakub Sitnicki 	struct list_head links[MAX_NETNS_BPF_ATTACH_TYPE];
26a3fd7ceeSJakub Sitnicki };
27a3fd7ceeSJakub Sitnicki 
28a3fd7ceeSJakub Sitnicki #endif /* __NETNS_BPF_H__ */
29