Skip to contentSkip to conversation

vhost-vdpa: Add qemu_close in vhost_vdpa_cleanup

PATCH In review Cindy Lu 2 participants 4 messages Oct 16, 2020 – Oct 19, 2020 Networking

lore
Share & tools
lore

Cindy Lu

author
#0 lore raw

PATCH v2 1/2 vhost-vdpa: Add qemu_close in vhost_vdpa_cleanup

fix the bug that fd will still open after the cleanup

---
 net/vhost-vdpa.c | 4 ++++
 1 file changed, 4 insertions(+)
net/vhost-vdpa.c +4 -0
index bc0e0d2d35..0480b92102 100644
@@ -144,6 +144,10 @@ static void vhost_vdpa_cleanup(NetClientState *nc)
         g_free(s->vhost_net);
         s->vhost_net = NULL;
     }
+     if (s->vhost_vdpa.device_fd >= 0) {
+        qemu_close(s->vhost_vdpa.device_fd);
+        s->vhost_vdpa.device_fd = -1;
+    }
 }
 
 static bool vhost_vdpa_has_vnet_hdr(NetClientState *nc)
Signature · 1 line
2.21.3
author
#1 lore raw

PATCH v2 2/2 net: Add vhost-vdpa in show_netdevs()

Fix the bug that while Check qemu supported netdev, there is no vhost-vdpa

---
 net/net.c | 3 +++
 1 file changed, 3 insertions(+)
net/net.c +3 -0
index 7a2a0fb5ac..794c652282 100644
@@ -1049,6 +1049,9 @@ static void show_netdevs(void)
 #endif
 #ifdef CONFIG_POSIX
         "vhost-user",
+#endif
+#ifdef CONFIG_VHOST_VDPA
+        "vhost-vdpa",
 #endif
     };
 
Signature · 1 line
2.21.3
Acked-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] net: Add vhost-vdpa in show_netdevs()

Quoted 13 lines · Cindy Lu

Fix the bug that while Check qemu supported netdev, there is no vhost-vdpa

---
  net/net.c | 3 +++
  1 file changed, 3 insertions(+)
net/net.c +0 -0
index 7a2a0fb5ac..794c652282 100644

net/net.c static void show_netdevs(void) · line 1056

Quoted 8 lines
net/net.c +3 -0
@@ -1049,6 +1049,9 @@ static void show_netdevs(void)
  #endif
  #ifdef CONFIG_POSIX
          "vhost-user",
+#endif
+#ifdef CONFIG_VHOST_VDPA
+        "vhost-vdpa",
  #endif
      };
Quoted 1 line
Acked-by on v2 1/2
#3 lore raw
In reply to Cindy Lu
Quoted 12 lines · Cindy Lu

fix the bug that fd will still open after the cleanup

---
  net/vhost-vdpa.c | 4 ++++
  1 file changed, 4 insertions(+)
net/vhost-vdpa.c +0 -0
index bc0e0d2d35..0480b92102 100644

net/vhost-vdpa.c static void vhost_vdpa_cleanup(NetClientState *nc) · line 153

Quoted 10 lines
net/vhost-vdpa.c +4 -0
@@ -144,6 +144,10 @@ static void vhost_vdpa_cleanup(NetClientState *nc)
          g_free(s->vhost_net);
          s->vhost_net = NULL;
      }
+     if (s->vhost_vdpa.device_fd >= 0) {
+        qemu_close(s->vhost_vdpa.device_fd);
+        s->vhost_vdpa.device_fd = -1;
+    }
  }
 
  static bool vhost_vdpa_has_vnet_hdr(NetClientState *nc)