[dpdk-dev,v2,1/4] vhost: avoid device identifier to be reset to 0 in reset_owner

Message ID 1445247869-713-2-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
  virtio-net clean and init device after a VHOST_USER_RESET_OWNER.
This reset device identifier to 0 and break ll_root listing logic.
This patch keep the old device identifier and re-write it on the cleaned
device.

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

Patch

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index d0f1764..955a29d 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -399,11 +399,14 @@  static int
 reset_owner(struct vhost_device_ctx ctx)
 {
 	struct virtio_net_config_ll *ll_dev;
+	uint64_t device_fh;
 
 	ll_dev = get_config_ll_entry(ctx);
+	device_fh = ll_dev->dev.device_fh;
 
 	cleanup_device(&ll_dev->dev);
 	init_device(&ll_dev->dev);
+	ll_dev->dev.device_fh = device_fh;
 
 	return 0;
 }