xsk: simplify AF_XDP socket teardown
[sfrench/cifs-2.6.git] / net / xdp / xsk.c
index 07156f43d29593ffad99dbd14827fc6352969413..a03268454a2762d12b9dec3e0d3858869e34b742 100644 (file)
@@ -366,6 +366,7 @@ static int xsk_release(struct socket *sock)
 
        xskq_destroy(xs->rx);
        xskq_destroy(xs->tx);
+       xdp_put_umem(xs->umem);
 
        sock_orphan(sk);
        sock->sk = NULL;
@@ -713,18 +714,6 @@ static const struct proto_ops xsk_proto_ops = {
        .sendpage       = sock_no_sendpage,
 };
 
-static void xsk_destruct(struct sock *sk)
-{
-       struct xdp_sock *xs = xdp_sk(sk);
-
-       if (!sock_flag(sk, SOCK_DEAD))
-               return;
-
-       xdp_put_umem(xs->umem);
-
-       sk_refcnt_debug_dec(sk);
-}
-
 static int xsk_create(struct net *net, struct socket *sock, int protocol,
                      int kern)
 {
@@ -751,9 +740,6 @@ static int xsk_create(struct net *net, struct socket *sock, int protocol,
 
        sk->sk_family = PF_XDP;
 
-       sk->sk_destruct = xsk_destruct;
-       sk_refcnt_debug_inc(sk);
-
        sock_set_flag(sk, SOCK_RCU_FREE);
 
        xs = xdp_sk(sk);