aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2019-10-25 11:34:03 +0100
committerMichael S. Tsirkin <mst@redhat.com>2019-10-29 18:56:45 -0400
commit068ddfa970063730c5a61b06bae336d68de114e1 (patch)
treeccf6e1a4cd98b539cbd7caa53b5596d02d75a131
parent7a064bcc6699151311c2067eea6546da6498ebe7 (diff)
downloadqemu-068ddfa970063730c5a61b06bae336d68de114e1.zip
qemu-068ddfa970063730c5a61b06bae336d68de114e1.tar.gz
qemu-068ddfa970063730c5a61b06bae336d68de114e1.tar.bz2
virtio_net: use RCU_READ_LOCK_GUARD
Use RCU_READ_LOCK_GUARD rather than the manual rcu_read_(un)lock call. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20191025103403.120616-3-dgilbert@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/net/virtio-net.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 314f365..97a5113 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1490,12 +1490,9 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf,
size_t size)
{
- ssize_t r;
+ RCU_READ_LOCK_GUARD();
- rcu_read_lock();
- r = virtio_net_receive_rcu(nc, buf, size);
- rcu_read_unlock();
- return r;
+ return virtio_net_receive_rcu(nc, buf, size);
}
static void virtio_net_rsc_extract_unit4(VirtioNetRscChain *chain,