OSDN Git Service

virtio_net: wrap rtnl_lock in test for calling with lock already held
authorJohn Fastabend <john.fastabend@gmail.com>
Fri, 3 Feb 2017 03:14:32 +0000 (19:14 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Feb 2017 15:05:11 +0000 (10:05 -0500)
commit473153291b8a131c86787fd9b076a529573e2c19
treed2a534fa853babdc3d941994efab13a9e0de988c
parent152bff377653047c2a69c226435e2c3fd316b592
virtio_net: wrap rtnl_lock in test for calling with lock already held

For XDP use case and to allow ethtool reset tests it is useful to be
able to use reset paths from contexts where rtnl lock is already
held.

This requries updating virtnet_set_queues and free_receive_bufs the
two places where rtnl_lock is taken in virtio_net. To do this we
use the following pattern,

_foo(...) { do stuff }
foo(...) { rtnl_lock(); _foo(...); rtnl_unlock()};

this allows us to use freeze()/restore() flow from both contexts.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c