diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-10-09 20:30:14 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-10 22:30:16 +0300 |
commit | d66f2b91f95b56e31772b9faa0d036cd2e53cb02 (patch) | |
tree | 7443577f00bc649d464047dba4b3ece5fa0fb7e2 /include/net/dst_metadata.h | |
parent | c9c35995bcf812ee8136f634c25bc6ccc3021d4c (diff) | |
download | linux-d66f2b91f95b56e31772b9faa0d036cd2e53cb02.tar.xz |
bpf: don't rely on the verifier lock for metadata_dst allocation
bpf_skb_set_tunnel_*() functions require allocation of per-cpu
metadata_dst. The allocation happens upon verification of the
first program using those helpers. In preparation for removing
the verifier lock, use cmpxchg() to make sure we only allocate
the metadata_dsts once.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dst_metadata.h')
-rw-r--r-- | include/net/dst_metadata.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h index 9fba2ebf6dda..87a0bb8d449f 100644 --- a/include/net/dst_metadata.h +++ b/include/net/dst_metadata.h @@ -87,6 +87,7 @@ static inline int skb_metadata_dst_cmp(const struct sk_buff *skb_a, void metadata_dst_free(struct metadata_dst *); struct metadata_dst *metadata_dst_alloc(u8 optslen, enum metadata_type type, gfp_t flags); +void metadata_dst_free_percpu(struct metadata_dst __percpu *md_dst); struct metadata_dst __percpu * metadata_dst_alloc_percpu(u8 optslen, enum metadata_type type, gfp_t flags); |