Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / include / net / bpf_sk_storage.h
blob0e85713f56df3cd020c2cb3ce31fbc65a8992383
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019 Facebook */
3 #ifndef _BPF_SK_STORAGE_H
4 #define _BPF_SK_STORAGE_H
6 #include <linux/rculist.h>
7 #include <linux/list.h>
8 #include <linux/hash.h>
9 #include <linux/types.h>
10 #include <linux/spinlock.h>
11 #include <linux/bpf.h>
12 #include <net/sock.h>
13 #include <uapi/linux/sock_diag.h>
14 #include <uapi/linux/btf.h>
15 #include <linux/bpf_local_storage.h>
17 struct sock;
19 void bpf_sk_storage_free(struct sock *sk);
21 extern const struct bpf_func_proto bpf_sk_storage_get_proto;
22 extern const struct bpf_func_proto bpf_sk_storage_delete_proto;
23 extern const struct bpf_func_proto bpf_sk_storage_get_tracing_proto;
24 extern const struct bpf_func_proto bpf_sk_storage_delete_tracing_proto;
26 struct bpf_local_storage_elem;
27 struct bpf_sk_storage_diag;
28 struct sk_buff;
29 struct nlattr;
30 struct sock;
32 #ifdef CONFIG_BPF_SYSCALL
33 int bpf_sk_storage_clone(const struct sock *sk, struct sock *newsk);
34 struct bpf_sk_storage_diag *
35 bpf_sk_storage_diag_alloc(const struct nlattr *nla_stgs);
36 void bpf_sk_storage_diag_free(struct bpf_sk_storage_diag *diag);
37 int bpf_sk_storage_diag_put(struct bpf_sk_storage_diag *diag,
38 struct sock *sk, struct sk_buff *skb,
39 int stg_array_type,
40 unsigned int *res_diag_size);
41 #else
42 static inline int bpf_sk_storage_clone(const struct sock *sk,
43 struct sock *newsk)
45 return 0;
47 static inline struct bpf_sk_storage_diag *
48 bpf_sk_storage_diag_alloc(const struct nlattr *nla)
50 return NULL;
52 static inline void bpf_sk_storage_diag_free(struct bpf_sk_storage_diag *diag)
55 static inline int bpf_sk_storage_diag_put(struct bpf_sk_storage_diag *diag,
56 struct sock *sk, struct sk_buff *skb,
57 int stg_array_type,
58 unsigned int *res_diag_size)
60 return 0;
62 #endif
64 #endif /* _BPF_SK_STORAGE_H */