New upstream version 17.11.5
[deb_dpdk.git] / drivers / net / virtio / virtio_user / virtio_user_dev.c
index 7941271..b13e77f 100644 (file)
@@ -166,12 +166,27 @@ error:
 
 int virtio_user_stop_device(struct virtio_user_dev *dev)
 {
+       struct vhost_vring_state state;
        uint32_t i;
+       int error = 0;
 
        for (i = 0; i < dev->max_queue_pairs; ++i)
                dev->ops->enable_qp(dev, i, 0);
 
-       return 0;
+       /* Stop the backend. */
+       for (i = 0; i < dev->max_queue_pairs * 2; ++i) {
+               state.index = i;
+               if (dev->ops->send_request(dev, VHOST_USER_GET_VRING_BASE,
+                                          &state) < 0) {
+                       PMD_DRV_LOG(ERR, "get_vring_base failed, index=%u\n",
+                                   i);
+                       error = -1;
+                       goto out;
+               }
+       }
+
+out:
+       return error;
 }
 
 static inline void
@@ -270,6 +285,8 @@ virtio_user_fill_intr_handle(struct virtio_user_dev *dev)
        eth_dev->intr_handle->nb_efd = dev->max_queue_pairs;
        eth_dev->intr_handle->max_intr = dev->max_queue_pairs + 1;
        eth_dev->intr_handle->type = RTE_INTR_HANDLE_VDEV;
+       /* For virtio vdev, no need to read counter for clean */
+       eth_dev->intr_handle->efd_counter_size = 0;
        if (dev->vhostfd >= 0)
                eth_dev->intr_handle->fd = dev->vhostfd;