1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
Description: backport of dpdk 16.07 fix for LP: #1570466
Backported from this discussion
http://dpdk.org/dev/patchwork/patch/12103/
Not accepted yet, but likely to be accepted in some form once tested and
confirmed.
Update 2016-05-17:
Moving to 16.04 this now applies as-is without modifications, dropping the
former backport changes.
Also along the discussion vserver-fh is now initialized with -1 to avoid
accidentially deleting the first connected port if we delete another not yet
connected port.
Forwarded: yes (based on an upstream discussion)
Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Last-Update: 2016-05-17
Index: dpdk/lib/librte_vhost/vhost_user/vhost-net-user.c
===================================================================
--- dpdk.orig/lib/librte_vhost/vhost_user/vhost-net-user.c
+++ dpdk/lib/librte_vhost/vhost_user/vhost-net-user.c
@@ -310,6 +310,7 @@ vserver_new_vq_conn(int fd, void *dat, _
}
vdev_ctx.fh = fh;
+ vserver->fh = fh;
size = strnlen(vserver->path, PATH_MAX);
vhost_set_ifname(vdev_ctx, vserver->path,
size);
@@ -486,6 +487,7 @@ rte_vhost_driver_register(const char *pa
}
vserver->path = strdup(path);
+ vserver->fh = -1;
ret = fdset_add(&g_vhost_server.fdset, vserver->listenfd,
vserver_new_vq_conn, NULL, vserver);
@@ -520,6 +522,11 @@ rte_vhost_driver_unregister(const char *
for (i = 0; i < g_vhost_server.vserver_cnt; i++) {
if (!strcmp(g_vhost_server.server[i]->path, path)) {
+ struct vhost_device_ctx ctx;
+
+ ctx.fh = g_vhost_server.server[i]->fh;
+ vhost_destroy_device(ctx);
+
fdset_del(&g_vhost_server.fdset,
g_vhost_server.server[i]->listenfd);
Index: dpdk/lib/librte_vhost/vhost_user/vhost-net-user.h
===================================================================
--- dpdk.orig/lib/librte_vhost/vhost_user/vhost-net-user.h
+++ dpdk/lib/librte_vhost/vhost_user/vhost-net-user.h
@@ -43,6 +43,7 @@
struct vhost_server {
char *path; /**< The path the uds is bind to. */
int listenfd; /**< The listener sockfd. */
+ uint32_t fh;
};
/* refer to hw/virtio/vhost-user.c */
|