]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Fix ndev mutex and condition variable initialization
authorAsias He <asias.hejun@gmail.com>
Mon, 31 Oct 2011 14:39:41 +0000 (22:39 +0800)
committerPekka Enberg <penberg@kernel.org>
Mon, 31 Oct 2011 16:41:03 +0000 (18:41 +0200)
This patch fixes the initialization of the following variables:

   ndev->io_tx_lock
   ndev->io_rx_lock
   ndev->io_tx_cond
   ndev->io_rx_cond

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/virtio/net.c

index 1b59972e18fdc8e47df019926f86b13ae7c42e64..7cd6794f941f0813fc6fde1f901f63965cdfa63e 100644 (file)
@@ -248,14 +248,14 @@ fail:
 
 static void virtio_net__io_thread_init(struct kvm *kvm, struct net_dev *ndev)
 {
+       pthread_mutex_init(&ndev->io_tx_lock, NULL);
        pthread_mutex_init(&ndev->io_rx_lock, NULL);
-       pthread_cond_init(&ndev->io_tx_cond, NULL);
 
-       pthread_mutex_init(&ndev->io_rx_lock, NULL);
        pthread_cond_init(&ndev->io_tx_cond, NULL);
+       pthread_cond_init(&ndev->io_rx_cond, NULL);
 
-       pthread_create(&ndev->io_rx_thread, NULL, virtio_net_rx_thread, ndev);
        pthread_create(&ndev->io_tx_thread, NULL, virtio_net_tx_thread, ndev);
+       pthread_create(&ndev->io_rx_thread, NULL, virtio_net_rx_thread, ndev);
 }
 
 static inline int tap_ops_tx(struct iovec *iov, u16 out, struct net_dev *ndev)