[dpdk-dev,v2,4/4] vhost: change method to get device in reset_owner

Message ID 1445247869-713-5-git-send-email-jerome.jutteau@outscale.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Jerome Jutteau Oct. 19, 2015, 9:44 a.m. UTC
  Using get_config_ll_entry in reset_owner don't show any error when the
device is not found. This patch fix this by using get_device instead
instead of get_config_ll_entry.

Signed-off-by: Jerome Jutteau <jerome.jutteau@outscale.com>
---
 lib/librte_vhost/virtio-net.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
  

Patch

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index ec6a575..a6ab245 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -398,18 +398,17 @@  set_owner(struct vhost_device_ctx ctx)
 static int
 reset_owner(struct vhost_device_ctx ctx)
 {
-	struct virtio_net_config_ll *ll_dev;
+	struct virtio_net *dev;
 	uint64_t device_fh;
 
-	ll_dev = get_config_ll_entry(ctx);
-	if (ll_dev == NULL)
+	dev = get_device(ctx);
+	if (dev == NULL)
 		return -1;
-	device_fh = ll_dev->dev.device_fh;
-
-	cleanup_device(&ll_dev->dev);
-	init_device(&ll_dev->dev);
-	ll_dev->dev.device_fh = device_fh;
 
+	device_fh = dev->device_fh;
+	cleanup_device(dev);
+	init_device(dev);
+	dev->device_fh = device_fh;
 	return 0;
 }