[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171221164228.1d1a89b0@redhat.com>
Date: Thu, 21 Dec 2017 16:42:28 +0100
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Jason Wang <jasowang@...hat.com>
Cc: Daniel Borkmann <borkmann@...earbox.net>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Willem de Bruijn <willemb@...gle.com>,
"Michael S. Tsirkin" <mst@...hat.com>, netdev@...r.kernel.org,
dsahern@...il.com, gospo@...adcom.com, bjorn.topel@...el.com,
michael.chan@...adcom.com, brouer@...hat.com
Subject: Re: [bpf-next V1-RFC PATCH 10/14] tun: setup xdp_rxq_info
On Wed, 20 Dec 2017 15:48:01 +0800
Jason Wang <jasowang@...hat.com> wrote:
> > diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> > index e367d6310353..f1df08c2c541 100644
> > --- a/drivers/net/tun.c
> > +++ b/drivers/net/tun.c
> > @@ -180,6 +180,7 @@ struct tun_file {
> > struct list_head next;
> > struct tun_struct *detached;
> > struct skb_array tx_array;
> > + struct xdp_rxq_info xdp_rxq;
> > };
> >
> > struct tun_flow_entry {
> > @@ -687,8 +688,10 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
> > tun->dev->reg_state == NETREG_REGISTERED)
> > unregister_netdevice(tun->dev);
> > }
> > - if (tun)
> > + if (tun) {
> > skb_array_cleanup(&tfile->tx_array);
> > + xdp_rxq_info_unreg(&tfile->xdp_rxq);
> > + }
> > sock_put(&tfile->sk);
> > }
> > }
> > @@ -728,11 +731,15 @@ static void tun_detach_all(struct net_device *dev)
> > tun_napi_del(tun, tfile);
> > /* Drop read queue */
> > tun_queue_purge(tfile);
> > + skb_array_cleanup(&tfile->tx_array);
>
> Looks like this is unnecessary, skb array will be cleaned up only when
> fd is closed otherwise there will be a double free.
What code path is called on "fd close" which call skb_array_cleanup() ?
(Is it __tun_detach()?)
Then, I guess I don't need below xdp_rxq_info_unreg() either, right?
> > + xdp_rxq_info_unreg(&tfile->xdp_rxq);
> > sock_put(&tfile->sk);
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
Powered by blists - more mailing lists