]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commita06394296ef1cd6cfd6a7a31bac19b953907fe5c
treed2a534fa853babdc3d941994efab13a9e0de988c
parenta20196ed8a8092003f6a7e401ceb879c5c6a01df
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