On Tue, Feb 25, 2020 at 5:57 AM Lorenz Bauer <lmb@xxxxxxxxxxxxxx> wrote: > > The close, unhash and clone handlers from TCP sockmap are actually generic, > and can be reused by UDP sockmap. Move the helpers into the sockmap code base > and expose them. > > Signed-off-by: Lorenz Bauer <lmb@xxxxxxxxxxxxxx> > --- > include/linux/bpf.h | 4 ++- > include/linux/skmsg.h | 28 ---------------- > net/core/sock_map.c | 77 +++++++++++++++++++++++++++++++++++++++++-- > net/ipv4/tcp_bpf.c | 55 ++----------------------------- > 4 files changed, 79 insertions(+), 85 deletions(-) > > diff --git a/include/linux/bpf.h b/include/linux/bpf.h > index 49b1a70e12c8..8422ab6a63d8 100644 > --- a/include/linux/bpf.h > +++ b/include/linux/bpf.h > @@ -1355,6 +1355,8 @@ static inline void bpf_map_offload_map_free(struct bpf_map *map) > #if defined(CONFIG_BPF_STREAM_PARSER) > int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, u32 which); > int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog); > +void sock_map_unhash(struct sock *sk); > +void sock_map_close(struct sock *sk, long timeout); I think we still need dummy version of these two functions in the #else cause?