1 | The following changes since commit 6632f6ff96f0537fc34cdc00c760656fc62e23c5: | 1 | The following changes since commit c74e62ee3e2dc2955e07d004c71badecb68a84eb: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/famz/tags/block-and-testing-pull-request' into staging (2017-07-17 11:46:36 +0100) | 3 | Merge remote-tracking branch 'remotes/rth/tags/cota-target-pull-request' into staging (2018-05-11 15:41:29 +0100) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the git repository at: |
6 | 6 | ||
7 | https://github.com/jasowang/qemu.git tags/net-pull-request | 7 | https://github.com/jasowang/qemu.git tags/net-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 189ae6bb5ce1f5a322f8691d00fe942ba43dd601: | 9 | for you to fetch changes up to 0e0266c2e475b82b39a757c875fa03e64272fbe7: |
10 | 10 | ||
11 | virtio-net: fix offload ctrl endian (2017-07-17 20:13:56 +0800) | 11 | net: Get rid of 'vlan' terminology and use 'hub' instead in the doc files (2018-05-14 15:47:14 +0800) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | 14 | ||
15 | - fix virtio-net ctrl offload endian | 15 | ---------------------------------------------------------------- |
16 | - vnet header support for variou COLO netfilters and compare thread | 16 | Thomas Huth (4): |
17 | net: Fix memory leak in net_param_nic() | ||
18 | net: Remove the deprecated "vlan" parameter | ||
19 | net: Get rid of 'vlan' terminology and use 'hub' instead in the source files | ||
20 | net: Get rid of 'vlan' terminology and use 'hub' instead in the doc files | ||
17 | 21 | ||
18 | ---------------------------------------------------------------- | 22 | docs/qdev-device-use.txt | 3 -- |
19 | Jason Wang (1): | 23 | hw/core/qdev-properties-system.c | 80 ---------------------------------------- |
20 | virtio-net: fix offload ctrl endian | 24 | include/hw/qdev-properties.h | 3 -- |
21 | 25 | include/net/net.h | 1 - | |
22 | Michal Privoznik (1): | 26 | net/hub.c | 7 ++-- |
23 | virtion-net: Prefer is_power_of_2() | 27 | net/net.c | 18 ++++----- |
24 | 28 | net/slirp.c | 8 ++-- | |
25 | Zhang Chen (12): | 29 | net/tap.c | 4 +- |
26 | net: Add vnet_hdr_len arguments in NetClientState | 30 | qapi/net.json | 15 ++++---- |
27 | net/net.c: Add vnet_hdr support in SocketReadState | 31 | qemu-doc.texi | 51 ++++++++++++------------- |
28 | net/filter-mirror.c: Introduce parameter for filter_send() | 32 | qemu-options.hx | 29 ++++++--------- |
29 | net/filter-mirror.c: Make filter mirror support vnet support. | 33 | 11 files changed, 58 insertions(+), 161 deletions(-) |
30 | net/filter-mirror.c: Add new option to enable vnet support for filter-redirector | ||
31 | net/colo.c: Make vnet_hdr_len as packet property | ||
32 | net/colo-compare.c: Introduce parameter for compare_chr_send() | ||
33 | net/colo-compare.c: Make colo-compare support vnet_hdr_len | ||
34 | net/colo.c: Add vnet packet parse feature in colo-proxy | ||
35 | net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare | ||
36 | net/filter-rewriter.c: Make filter-rewriter support vnet_hdr_len | ||
37 | docs/colo-proxy.txt: Update colo-proxy usage of net driver with vnet_header | ||
38 | |||
39 | docs/colo-proxy.txt | 26 ++++++++++++++++ | ||
40 | hw/net/virtio-net.c | 4 ++- | ||
41 | include/net/net.h | 10 ++++-- | ||
42 | net/colo-compare.c | 84 ++++++++++++++++++++++++++++++++++++++++++--------- | ||
43 | net/colo.c | 9 +++--- | ||
44 | net/colo.h | 4 ++- | ||
45 | net/filter-mirror.c | 75 +++++++++++++++++++++++++++++++++++++++++---- | ||
46 | net/filter-rewriter.c | 37 ++++++++++++++++++++++- | ||
47 | net/net.c | 37 ++++++++++++++++++++--- | ||
48 | net/socket.c | 8 ++--- | ||
49 | qemu-options.hx | 19 ++++++------ | ||
50 | 11 files changed, 265 insertions(+), 48 deletions(-) | ||
51 | 34 | ||
52 | 35 | diff view generated by jsdifflib |
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | We add a flag to decide whether net_fill_rstate() need read | 3 | The early exits in case of errors leak the memory allocated for nd_id. |
4 | the vnet_hdr_len or not. | 4 | Fix it by using a "goto out" to the cleanup at the end of the function |
5 | instead. | ||
5 | 6 | ||
6 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Suggested-by: Jason Wang <jasowang@redhat.com> | 8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
8 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 10 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
9 | --- | 11 | --- |
10 | include/net/net.h | 9 +++++++-- | 12 | net/net.c | 6 ++++-- |
11 | net/colo-compare.c | 4 ++-- | 13 | 1 file changed, 4 insertions(+), 2 deletions(-) |
12 | net/filter-mirror.c | 2 +- | ||
13 | net/net.c | 36 ++++++++++++++++++++++++++++++++---- | ||
14 | net/socket.c | 8 ++++---- | ||
15 | 5 files changed, 46 insertions(+), 13 deletions(-) | ||
16 | 14 | ||
17 | diff --git a/include/net/net.h b/include/net/net.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/include/net/net.h | ||
20 | +++ b/include/net/net.h | ||
21 | @@ -XXX,XX +XXX,XX @@ typedef struct NICState { | ||
22 | } NICState; | ||
23 | |||
24 | struct SocketReadState { | ||
25 | - int state; /* 0 = getting length, 1 = getting data */ | ||
26 | + /* 0 = getting length, 1 = getting vnet header length, 2 = getting data */ | ||
27 | + int state; | ||
28 | + /* This flag decide whether to read the vnet_hdr_len field */ | ||
29 | + bool vnet_hdr; | ||
30 | uint32_t index; | ||
31 | uint32_t packet_len; | ||
32 | + uint32_t vnet_hdr_len; | ||
33 | uint8_t buf[NET_BUFSIZE]; | ||
34 | SocketReadStateFinalize *finalize; | ||
35 | }; | ||
36 | @@ -XXX,XX +XXX,XX @@ ssize_t qemu_deliver_packet_iov(NetClientState *sender, | ||
37 | void print_net_client(Monitor *mon, NetClientState *nc); | ||
38 | void hmp_info_network(Monitor *mon, const QDict *qdict); | ||
39 | void net_socket_rs_init(SocketReadState *rs, | ||
40 | - SocketReadStateFinalize *finalize); | ||
41 | + SocketReadStateFinalize *finalize, | ||
42 | + bool vnet_hdr); | ||
43 | |||
44 | /* NIC info */ | ||
45 | |||
46 | diff --git a/net/colo-compare.c b/net/colo-compare.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/net/colo-compare.c | ||
49 | +++ b/net/colo-compare.c | ||
50 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_complete(UserCreatable *uc, Error **errp) | ||
51 | return; | ||
52 | } | ||
53 | |||
54 | - net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize); | ||
55 | - net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize); | ||
56 | + net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize, false); | ||
57 | + net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize, false); | ||
58 | |||
59 | g_queue_init(&s->conn_list); | ||
60 | |||
61 | diff --git a/net/filter-mirror.c b/net/filter-mirror.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/net/filter-mirror.c | ||
64 | +++ b/net/filter-mirror.c | ||
65 | @@ -XXX,XX +XXX,XX @@ static void filter_redirector_setup(NetFilterState *nf, Error **errp) | ||
66 | } | ||
67 | } | ||
68 | |||
69 | - net_socket_rs_init(&s->rs, redirector_rs_finalize); | ||
70 | + net_socket_rs_init(&s->rs, redirector_rs_finalize, false); | ||
71 | |||
72 | if (s->indev) { | ||
73 | chr = qemu_chr_find(s->indev); | ||
74 | diff --git a/net/net.c b/net/net.c | 15 | diff --git a/net/net.c b/net/net.c |
75 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
76 | --- a/net/net.c | 17 | --- a/net/net.c |
77 | +++ b/net/net.c | 18 | +++ b/net/net.c |
78 | @@ -XXX,XX +XXX,XX @@ QemuOptsList qemu_net_opts = { | 19 | @@ -XXX,XX +XXX,XX @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp) |
79 | }; | 20 | g_free(mac); |
80 | 21 | if (ret) { | |
81 | void net_socket_rs_init(SocketReadState *rs, | 22 | error_setg(errp, "invalid syntax for ethernet address"); |
82 | - SocketReadStateFinalize *finalize) | 23 | - return -1; |
83 | + SocketReadStateFinalize *finalize, | 24 | + goto out; |
84 | + bool vnet_hdr) | 25 | } |
85 | { | 26 | if (is_multicast_ether_addr(ni->macaddr.a)) { |
86 | rs->state = 0; | 27 | error_setg(errp, "NIC cannot have multicast MAC address"); |
87 | + rs->vnet_hdr = vnet_hdr; | 28 | - return -1; |
88 | rs->index = 0; | 29 | + ret = -1; |
89 | rs->packet_len = 0; | 30 | + goto out; |
90 | + rs->vnet_hdr_len = 0; | 31 | } |
91 | memset(rs->buf, 0, sizeof(rs->buf)); | 32 | } |
92 | rs->finalize = finalize; | 33 | qemu_macaddr_default_if_unset(&ni->macaddr); |
34 | @@ -XXX,XX +XXX,XX @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp) | ||
35 | nb_nics++; | ||
36 | } | ||
37 | |||
38 | +out: | ||
39 | g_free(nd_id); | ||
40 | return ret; | ||
93 | } | 41 | } |
94 | @@ -XXX,XX +XXX,XX @@ int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size) | ||
95 | unsigned int l; | ||
96 | |||
97 | while (size > 0) { | ||
98 | - /* reassemble a packet from the network */ | ||
99 | - switch (rs->state) { /* 0 = getting length, 1 = getting data */ | ||
100 | + /* Reassemble a packet from the network. | ||
101 | + * 0 = getting length. | ||
102 | + * 1 = getting vnet header length. | ||
103 | + * 2 = getting data. | ||
104 | + */ | ||
105 | + switch (rs->state) { | ||
106 | case 0: | ||
107 | l = 4 - rs->index; | ||
108 | if (l > size) { | ||
109 | @@ -XXX,XX +XXX,XX @@ int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size) | ||
110 | /* got length */ | ||
111 | rs->packet_len = ntohl(*(uint32_t *)rs->buf); | ||
112 | rs->index = 0; | ||
113 | - rs->state = 1; | ||
114 | + if (rs->vnet_hdr) { | ||
115 | + rs->state = 1; | ||
116 | + } else { | ||
117 | + rs->state = 2; | ||
118 | + rs->vnet_hdr_len = 0; | ||
119 | + } | ||
120 | } | ||
121 | break; | ||
122 | case 1: | ||
123 | + l = 4 - rs->index; | ||
124 | + if (l > size) { | ||
125 | + l = size; | ||
126 | + } | ||
127 | + memcpy(rs->buf + rs->index, buf, l); | ||
128 | + buf += l; | ||
129 | + size -= l; | ||
130 | + rs->index += l; | ||
131 | + if (rs->index == 4) { | ||
132 | + /* got vnet header length */ | ||
133 | + rs->vnet_hdr_len = ntohl(*(uint32_t *)rs->buf); | ||
134 | + rs->index = 0; | ||
135 | + rs->state = 2; | ||
136 | + } | ||
137 | + break; | ||
138 | + case 2: | ||
139 | l = rs->packet_len - rs->index; | ||
140 | if (l > size) { | ||
141 | l = size; | ||
142 | diff --git a/net/socket.c b/net/socket.c | ||
143 | index XXXXXXX..XXXXXXX 100644 | ||
144 | --- a/net/socket.c | ||
145 | +++ b/net/socket.c | ||
146 | @@ -XXX,XX +XXX,XX @@ static void net_socket_send(void *opaque) | ||
147 | closesocket(s->fd); | ||
148 | |||
149 | s->fd = -1; | ||
150 | - net_socket_rs_init(&s->rs, net_socket_rs_finalize); | ||
151 | + net_socket_rs_init(&s->rs, net_socket_rs_finalize, false); | ||
152 | s->nc.link_down = true; | ||
153 | memset(s->nc.info_str, 0, sizeof(s->nc.info_str)); | ||
154 | |||
155 | @@ -XXX,XX +XXX,XX @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer, | ||
156 | s->fd = fd; | ||
157 | s->listen_fd = -1; | ||
158 | s->send_fn = net_socket_send_dgram; | ||
159 | - net_socket_rs_init(&s->rs, net_socket_rs_finalize); | ||
160 | + net_socket_rs_init(&s->rs, net_socket_rs_finalize, false); | ||
161 | net_socket_read_poll(s, true); | ||
162 | |||
163 | /* mcast: save bound address as dst */ | ||
164 | @@ -XXX,XX +XXX,XX @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer, | ||
165 | |||
166 | s->fd = fd; | ||
167 | s->listen_fd = -1; | ||
168 | - net_socket_rs_init(&s->rs, net_socket_rs_finalize); | ||
169 | + net_socket_rs_init(&s->rs, net_socket_rs_finalize, false); | ||
170 | |||
171 | /* Disable Nagle algorithm on TCP sockets to reduce latency */ | ||
172 | socket_set_nodelay(fd); | ||
173 | @@ -XXX,XX +XXX,XX @@ static int net_socket_listen_init(NetClientState *peer, | ||
174 | s->fd = -1; | ||
175 | s->listen_fd = fd; | ||
176 | s->nc.link_down = true; | ||
177 | - net_socket_rs_init(&s->rs, net_socket_rs_finalize); | ||
178 | + net_socket_rs_init(&s->rs, net_socket_rs_finalize, false); | ||
179 | |||
180 | qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s); | ||
181 | return 0; | ||
182 | -- | 42 | -- |
183 | 2.7.4 | 43 | 2.7.4 |
184 | 44 | ||
185 | 45 | diff view generated by jsdifflib |
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Add vnet_hdr_len arguments in NetClientState | 3 | It's been marked as deprecated since QEMU v2.9.0, so that should have |
4 | that make other module get real vnet_hdr_len easily. | 4 | been enough time for everybody to either just drop unnecessary "vlan=0" |
5 | 5 | parameters, to switch to the modern -device + -netdev syntax for connecting | |
6 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 6 | guest NICs with host network backends, or to switch to the "hubport" netdev |
7 | in case hubs are really wanted instead. | ||
8 | |||
9 | Buglink: https://bugs.launchpad.net/qemu/+bug/658904 | ||
10 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
11 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
7 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 12 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
8 | --- | 13 | --- |
9 | include/net/net.h | 1 + | 14 | docs/qdev-device-use.txt | 3 -- |
10 | net/net.c | 1 + | 15 | hw/core/qdev-properties-system.c | 80 ---------------------------------------- |
11 | 2 files changed, 2 insertions(+) | 16 | include/hw/qdev-properties.h | 3 -- |
12 | 17 | include/net/net.h | 1 - | |
18 | net/net.c | 12 ++---- | ||
19 | qapi/net.json | 15 ++++---- | ||
20 | qemu-doc.texi | 9 ----- | ||
21 | qemu-options.hx | 29 ++++++--------- | ||
22 | 8 files changed, 22 insertions(+), 130 deletions(-) | ||
23 | |||
24 | diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/docs/qdev-device-use.txt | ||
27 | +++ b/docs/qdev-device-use.txt | ||
28 | @@ -XXX,XX +XXX,XX @@ devices and ne2k_isa are. | ||
29 | |||
30 | Some PCI devices aren't available with -net nic, e.g. i82558a. | ||
31 | |||
32 | -To connect to a VLAN instead of an ordinary host part, replace | ||
33 | -netdev=NET-ID by vlan=VLAN. | ||
34 | - | ||
35 | === Graphics Devices === | ||
36 | |||
37 | Host and guest part of graphics devices have always been separate. | ||
38 | diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/core/qdev-properties-system.c | ||
41 | +++ b/hw/core/qdev-properties-system.c | ||
42 | @@ -XXX,XX +XXX,XX @@ const PropertyInfo qdev_prop_netdev = { | ||
43 | .set = set_netdev, | ||
44 | }; | ||
45 | |||
46 | -/* --- vlan --- */ | ||
47 | - | ||
48 | -static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t len) | ||
49 | -{ | ||
50 | - NetClientState **ptr = qdev_get_prop_ptr(dev, prop); | ||
51 | - | ||
52 | - if (*ptr) { | ||
53 | - int id; | ||
54 | - if (!net_hub_id_for_client(*ptr, &id)) { | ||
55 | - return snprintf(dest, len, "%d", id); | ||
56 | - } | ||
57 | - } | ||
58 | - | ||
59 | - return snprintf(dest, len, "<null>"); | ||
60 | -} | ||
61 | - | ||
62 | -static void get_vlan(Object *obj, Visitor *v, const char *name, void *opaque, | ||
63 | - Error **errp) | ||
64 | -{ | ||
65 | - DeviceState *dev = DEVICE(obj); | ||
66 | - Property *prop = opaque; | ||
67 | - NetClientState **ptr = qdev_get_prop_ptr(dev, prop); | ||
68 | - int32_t id = -1; | ||
69 | - | ||
70 | - if (*ptr) { | ||
71 | - int hub_id; | ||
72 | - if (!net_hub_id_for_client(*ptr, &hub_id)) { | ||
73 | - id = hub_id; | ||
74 | - } | ||
75 | - } | ||
76 | - | ||
77 | - visit_type_int32(v, name, &id, errp); | ||
78 | -} | ||
79 | - | ||
80 | -static void set_vlan(Object *obj, Visitor *v, const char *name, void *opaque, | ||
81 | - Error **errp) | ||
82 | -{ | ||
83 | - DeviceState *dev = DEVICE(obj); | ||
84 | - Property *prop = opaque; | ||
85 | - NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop); | ||
86 | - NetClientState **ptr = &peers_ptr->ncs[0]; | ||
87 | - Error *local_err = NULL; | ||
88 | - int32_t id; | ||
89 | - NetClientState *hubport; | ||
90 | - | ||
91 | - if (dev->realized) { | ||
92 | - qdev_prop_set_after_realize(dev, name, errp); | ||
93 | - return; | ||
94 | - } | ||
95 | - | ||
96 | - visit_type_int32(v, name, &id, &local_err); | ||
97 | - if (local_err) { | ||
98 | - error_propagate(errp, local_err); | ||
99 | - return; | ||
100 | - } | ||
101 | - if (id == -1) { | ||
102 | - *ptr = NULL; | ||
103 | - return; | ||
104 | - } | ||
105 | - if (*ptr) { | ||
106 | - error_set_from_qdev_prop_error(errp, -EINVAL, dev, prop, name); | ||
107 | - return; | ||
108 | - } | ||
109 | - | ||
110 | - hubport = net_hub_port_find(id); | ||
111 | - if (!hubport) { | ||
112 | - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, | ||
113 | - name, prop->info->name); | ||
114 | - return; | ||
115 | - } | ||
116 | - *ptr = hubport; | ||
117 | -} | ||
118 | - | ||
119 | -const PropertyInfo qdev_prop_vlan = { | ||
120 | - .name = "int32", | ||
121 | - .description = "Integer VLAN id to connect to", | ||
122 | - .print = print_vlan, | ||
123 | - .get = get_vlan, | ||
124 | - .set = set_vlan, | ||
125 | -}; | ||
126 | |||
127 | void qdev_prop_set_drive(DeviceState *dev, const char *name, | ||
128 | BlockBackend *value, Error **errp) | ||
129 | diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h | ||
130 | index XXXXXXX..XXXXXXX 100644 | ||
131 | --- a/include/hw/qdev-properties.h | ||
132 | +++ b/include/hw/qdev-properties.h | ||
133 | @@ -XXX,XX +XXX,XX @@ extern const PropertyInfo qdev_prop_bios_chs_trans; | ||
134 | extern const PropertyInfo qdev_prop_fdc_drive_type; | ||
135 | extern const PropertyInfo qdev_prop_drive; | ||
136 | extern const PropertyInfo qdev_prop_netdev; | ||
137 | -extern const PropertyInfo qdev_prop_vlan; | ||
138 | extern const PropertyInfo qdev_prop_pci_devfn; | ||
139 | extern const PropertyInfo qdev_prop_blocksize; | ||
140 | extern const PropertyInfo qdev_prop_pci_host_devaddr; | ||
141 | @@ -XXX,XX +XXX,XX @@ extern const PropertyInfo qdev_prop_off_auto_pcibar; | ||
142 | DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*) | ||
143 | #define DEFINE_PROP_NETDEV(_n, _s, _f) \ | ||
144 | DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers) | ||
145 | -#define DEFINE_PROP_VLAN(_n, _s, _f) \ | ||
146 | - DEFINE_PROP(_n, _s, _f, qdev_prop_vlan, NICPeers) | ||
147 | #define DEFINE_PROP_DRIVE(_n, _s, _f) \ | ||
148 | DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *) | ||
149 | #define DEFINE_PROP_MACADDR(_n, _s, _f) \ | ||
13 | diff --git a/include/net/net.h b/include/net/net.h | 150 | diff --git a/include/net/net.h b/include/net/net.h |
14 | index XXXXXXX..XXXXXXX 100644 | 151 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/net/net.h | 152 | --- a/include/net/net.h |
16 | +++ b/include/net/net.h | 153 | +++ b/include/net/net.h |
17 | @@ -XXX,XX +XXX,XX @@ struct NetClientState { | 154 | @@ -XXX,XX +XXX,XX @@ typedef struct NICConf { |
18 | unsigned int queue_index; | 155 | |
19 | unsigned rxfilter_notify_enabled:1; | 156 | #define DEFINE_NIC_PROPERTIES(_state, _conf) \ |
20 | int vring_enable; | 157 | DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \ |
21 | + int vnet_hdr_len; | 158 | - DEFINE_PROP_VLAN("vlan", _state, _conf.peers), \ |
22 | QTAILQ_HEAD(NetFilterHead, NetFilterState) filters; | 159 | DEFINE_PROP_NETDEV("netdev", _state, _conf.peers) |
23 | }; | 160 | |
24 | 161 | ||
25 | diff --git a/net/net.c b/net/net.c | 162 | diff --git a/net/net.c b/net/net.c |
26 | index XXXXXXX..XXXXXXX 100644 | 163 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/net/net.c | 164 | --- a/net/net.c |
28 | +++ b/net/net.c | 165 | +++ b/net/net.c |
29 | @@ -XXX,XX +XXX,XX @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len) | 166 | @@ -XXX,XX +XXX,XX @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp) |
30 | return; | 167 | const Netdev *netdev; |
168 | const char *name; | ||
169 | NetClientState *peer = NULL; | ||
170 | - static bool vlan_warned; | ||
171 | |||
172 | if (is_netdev) { | ||
173 | netdev = object; | ||
174 | @@ -XXX,XX +XXX,XX @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp) | ||
175 | return -1; | ||
176 | } | ||
177 | |||
178 | - /* Do not add to a vlan if it's a nic with a netdev= parameter. */ | ||
179 | + /* Do not add to a hub if it's a nic with a netdev= parameter. */ | ||
180 | if (netdev->type != NET_CLIENT_DRIVER_NIC || | ||
181 | !opts->u.nic.has_netdev) { | ||
182 | - peer = net_hub_add_port(net->has_vlan ? net->vlan : 0, NULL, NULL); | ||
183 | - } | ||
184 | - | ||
185 | - if (net->has_vlan && !vlan_warned) { | ||
186 | - error_report("'vlan' is deprecated. Please use 'netdev' instead."); | ||
187 | - vlan_warned = true; | ||
188 | + peer = net_hub_add_port(0, NULL, NULL); | ||
189 | } | ||
31 | } | 190 | } |
32 | 191 | ||
33 | + nc->vnet_hdr_len = len; | 192 | @@ -XXX,XX +XXX,XX @@ void qmp_set_link(const char *name, bool up, Error **errp) |
34 | nc->info->set_vnet_hdr_len(nc, len); | 193 | * If the peer is a HUBPORT or a backend, we do not change the |
35 | } | 194 | * link status. |
36 | 195 | * | |
196 | - * This behavior is compatible with qemu vlans where there could be | ||
197 | + * This behavior is compatible with qemu hubs where there could be | ||
198 | * multiple clients that can still communicate with each other in | ||
199 | * disconnected mode. For now maintain this compatibility. | ||
200 | */ | ||
201 | diff --git a/qapi/net.json b/qapi/net.json | ||
202 | index XXXXXXX..XXXXXXX 100644 | ||
203 | --- a/qapi/net.json | ||
204 | +++ b/qapi/net.json | ||
205 | @@ -XXX,XX +XXX,XX @@ | ||
206 | ## | ||
207 | # @NetdevTapOptions: | ||
208 | # | ||
209 | -# Connect the host TAP network interface name to the VLAN. | ||
210 | +# Used to configure a host TAP network interface backend. | ||
211 | # | ||
212 | # @ifname: interface name | ||
213 | # | ||
214 | @@ -XXX,XX +XXX,XX @@ | ||
215 | ## | ||
216 | # @NetdevSocketOptions: | ||
217 | # | ||
218 | -# Connect the VLAN to a remote VLAN in another QEMU virtual machine using a TCP | ||
219 | -# socket connection. | ||
220 | +# Socket netdevs are used to establish a network connection to another | ||
221 | +# QEMU virtual machine via a TCP socket. | ||
222 | # | ||
223 | # @fd: file descriptor of an already opened socket | ||
224 | # | ||
225 | @@ -XXX,XX +XXX,XX @@ | ||
226 | ## | ||
227 | # @NetdevL2TPv3Options: | ||
228 | # | ||
229 | -# Connect the VLAN to Ethernet over L2TPv3 Static tunnel | ||
230 | +# Configure an Ethernet over L2TPv3 tunnel. | ||
231 | # | ||
232 | # @src: source address | ||
233 | # | ||
234 | @@ -XXX,XX +XXX,XX @@ | ||
235 | ## | ||
236 | # @NetdevVdeOptions: | ||
237 | # | ||
238 | -# Connect the VLAN to a vde switch running on the host. | ||
239 | +# Connect to a vde switch running on the host. | ||
240 | # | ||
241 | # @sock: socket path | ||
242 | # | ||
243 | @@ -XXX,XX +XXX,XX @@ | ||
244 | # | ||
245 | # Captures the configuration of a network device; legacy. | ||
246 | # | ||
247 | -# @vlan: vlan number | ||
248 | -# | ||
249 | # @id: identifier for monitor commands | ||
250 | # | ||
251 | # @name: identifier for monitor commands, ignored if @id is present | ||
252 | @@ -XXX,XX +XXX,XX @@ | ||
253 | # @opts: device type specific properties (legacy) | ||
254 | # | ||
255 | # Since: 1.2 | ||
256 | +# | ||
257 | +# 'vlan' - removed with 2.12 | ||
258 | ## | ||
259 | { 'struct': 'NetLegacy', | ||
260 | 'data': { | ||
261 | - '*vlan': 'int32', | ||
262 | '*id': 'str', | ||
263 | '*name': 'str', | ||
264 | 'opts': 'NetLegacyOptions' } } | ||
265 | diff --git a/qemu-doc.texi b/qemu-doc.texi | ||
266 | index XXXXXXX..XXXXXXX 100644 | ||
267 | --- a/qemu-doc.texi | ||
268 | +++ b/qemu-doc.texi | ||
269 | @@ -XXX,XX +XXX,XX @@ with ``-device ...,netdev=x''), or ``-nic user,smb=/some/dir'' | ||
270 | (for embedded NICs). The new syntax allows different settings to be | ||
271 | provided per NIC. | ||
272 | |||
273 | -@subsection -net vlan (since 2.9.0) | ||
274 | - | ||
275 | -The ``-net vlan=NN'' argument was mostly used to attach separate | ||
276 | -network backends to different virtual NICs. This is the default | ||
277 | -behavior for ``-netdev'' and ``-nic''. You can connect multiple | ||
278 | -``-netdev'' and ``-nic'' devices to the same network using the | ||
279 | -"hubport" network backend, created with ``-netdev hubport,hubid=NN,...'' | ||
280 | -and ``-nic hubport,hubid=NN''. | ||
281 | - | ||
282 | @subsection -drive cyls=...,heads=...,secs=...,trans=... (since 2.10.0) | ||
283 | |||
284 | The drive geometry arguments are replaced by the the geometry arguments | ||
285 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
286 | index XXXXXXX..XXXXXXX 100644 | ||
287 | --- a/qemu-options.hx | ||
288 | +++ b/qemu-options.hx | ||
289 | @@ -XXX,XX +XXX,XX @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, | ||
290 | " configure a vhost-user network, backed by a chardev 'dev'\n" | ||
291 | #endif | ||
292 | "-netdev hubport,id=str,hubid=n[,netdev=nd]\n" | ||
293 | - " configure a hub port on QEMU VLAN 'n'\n", QEMU_ARCH_ALL) | ||
294 | + " configure a hub port on the hub with ID 'n'\n", QEMU_ARCH_ALL) | ||
295 | DEF("nic", HAS_ARG, QEMU_OPTION_nic, | ||
296 | "--nic [tap|bridge|" | ||
297 | #ifdef CONFIG_SLIRP | ||
298 | @@ -XXX,XX +XXX,XX @@ DEF("nic", HAS_ARG, QEMU_OPTION_nic, | ||
299 | " provided a 'user' network connection)\n", | ||
300 | QEMU_ARCH_ALL) | ||
301 | DEF("net", HAS_ARG, QEMU_OPTION_net, | ||
302 | - "-net nic[,vlan=n][,netdev=nd][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n" | ||
303 | + "-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n" | ||
304 | " configure or create an on-board (or machine default) NIC and\n" | ||
305 | - " connect it either to VLAN 'n' or the netdev 'nd' (for pluggable\n" | ||
306 | - " NICs please use '-device devtype,netdev=nd' instead)\n" | ||
307 | + " connect it to hub 0 (please use -nic unless you need a hub)\n" | ||
308 | "-net [" | ||
309 | #ifdef CONFIG_SLIRP | ||
310 | "user|" | ||
311 | @@ -XXX,XX +XXX,XX @@ DEF("net", HAS_ARG, QEMU_OPTION_net, | ||
312 | #ifdef CONFIG_NETMAP | ||
313 | "netmap|" | ||
314 | #endif | ||
315 | - "socket][,vlan=n][,option][,option][,...]\n" | ||
316 | + "socket][,option][,option][,...]\n" | ||
317 | " old way to initialize a host network interface\n" | ||
318 | " (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL) | ||
319 | STEXI | ||
320 | @@ -XXX,XX +XXX,XX @@ qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,sha | ||
321 | Create a hub port on the emulated hub with ID @var{hubid}. | ||
322 | |||
323 | The hubport netdev lets you connect a NIC to a QEMU emulated hub instead of a | ||
324 | -single netdev. @code{-net} and @code{-device} with the parameter @option{vlan} | ||
325 | -(deprecated), or @code{-nic hubport} can also be used to connect a | ||
326 | -network device or a NIC to a hub. Alternatively, you can also connect the | ||
327 | -hubport to another netdev with ID @var{nd} by using the @option{netdev=@var{nd}} | ||
328 | -option. | ||
329 | +single netdev. Alternatively, you can also connect the hubport to another | ||
330 | +netdev with ID @var{nd} by using the @option{netdev=@var{nd}} option. | ||
331 | |||
332 | -@item -net nic[,vlan=@var{n}][,netdev=@var{nd}][,macaddr=@var{mac}][,model=@var{type}] [,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}] | ||
333 | +@item -net nic[,netdev=@var{nd}][,macaddr=@var{mac}][,model=@var{type}] [,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}] | ||
334 | @findex -net | ||
335 | Legacy option to configure or create an on-board (or machine default) Network | ||
336 | -Interface Card(NIC) and connect it either to the emulated hub port ("vlan") | ||
337 | -with number @var{n} (@var{n} = 0 is the default), or to the netdev @var{nd}. | ||
338 | +Interface Card(NIC) and connect it either to the emulated hub with ID 0 (i.e. | ||
339 | +the default hub), or to the netdev @var{nd}. | ||
340 | The NIC is an e1000 by default on the PC target. Optionally, the MAC address | ||
341 | can be changed to @var{mac}, the device address set to @var{addr} (PCI cards | ||
342 | only), and a @var{name} can be assigned for use in monitor commands. | ||
343 | @@ -XXX,XX +XXX,XX @@ that the card should have; this option currently only affects virtio cards; set | ||
344 | NIC is created. QEMU can emulate several different models of network card. | ||
345 | Use @code{-net nic,model=help} for a list of available devices for your target. | ||
346 | |||
347 | -@item -net user|tap|bridge|socket|l2tpv3|vde[,...][,vlan=@var{n}][,name=@var{name}] | ||
348 | +@item -net user|tap|bridge|socket|l2tpv3|vde[,...][,name=@var{name}] | ||
349 | Configure a host network backend (with the options corresponding to the same | ||
350 | -@option{-netdev} option) and connect it to the emulated hub ("vlan") with the | ||
351 | -number @var{n} (default is number 0). Use @var{name} to specify the name of the | ||
352 | -hub port. | ||
353 | +@option{-netdev} option) and connect it to the emulated hub 0 (the default | ||
354 | +hub). Use @var{name} to specify the name of the hub port. | ||
355 | ETEXI | ||
356 | |||
357 | STEXI | ||
37 | -- | 358 | -- |
38 | 2.7.4 | 359 | 2.7.4 |
39 | 360 | ||
40 | 361 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | This patch change the filter_send() parameter from CharBackend to MirrorState, | ||
4 | we can get more information like vnet_hdr(We use it to support packet with vnet_header). | ||
5 | |||
6 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
7 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
8 | --- | ||
9 | net/filter-mirror.c | 10 +++++----- | ||
10 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
11 | |||
12 | diff --git a/net/filter-mirror.c b/net/filter-mirror.c | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/net/filter-mirror.c | ||
15 | +++ b/net/filter-mirror.c | ||
16 | @@ -XXX,XX +XXX,XX @@ typedef struct MirrorState { | ||
17 | SocketReadState rs; | ||
18 | } MirrorState; | ||
19 | |||
20 | -static int filter_send(CharBackend *chr_out, | ||
21 | +static int filter_send(MirrorState *s, | ||
22 | const struct iovec *iov, | ||
23 | int iovcnt) | ||
24 | { | ||
25 | @@ -XXX,XX +XXX,XX @@ static int filter_send(CharBackend *chr_out, | ||
26 | } | ||
27 | |||
28 | len = htonl(size); | ||
29 | - ret = qemu_chr_fe_write_all(chr_out, (uint8_t *)&len, sizeof(len)); | ||
30 | + ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof(len)); | ||
31 | if (ret != sizeof(len)) { | ||
32 | goto err; | ||
33 | } | ||
34 | |||
35 | buf = g_malloc(size); | ||
36 | iov_to_buf(iov, iovcnt, 0, buf, size); | ||
37 | - ret = qemu_chr_fe_write_all(chr_out, (uint8_t *)buf, size); | ||
38 | + ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)buf, size); | ||
39 | g_free(buf); | ||
40 | if (ret != size) { | ||
41 | goto err; | ||
42 | @@ -XXX,XX +XXX,XX @@ static ssize_t filter_mirror_receive_iov(NetFilterState *nf, | ||
43 | MirrorState *s = FILTER_MIRROR(nf); | ||
44 | int ret; | ||
45 | |||
46 | - ret = filter_send(&s->chr_out, iov, iovcnt); | ||
47 | + ret = filter_send(s, iov, iovcnt); | ||
48 | if (ret) { | ||
49 | error_report("filter mirror send failed(%s)", strerror(-ret)); | ||
50 | } | ||
51 | @@ -XXX,XX +XXX,XX @@ static ssize_t filter_redirector_receive_iov(NetFilterState *nf, | ||
52 | int ret; | ||
53 | |||
54 | if (qemu_chr_fe_backend_connected(&s->chr_out)) { | ||
55 | - ret = filter_send(&s->chr_out, iov, iovcnt); | ||
56 | + ret = filter_send(s, iov, iovcnt); | ||
57 | if (ret) { | ||
58 | error_report("filter redirector send failed(%s)", strerror(-ret)); | ||
59 | } | ||
60 | -- | ||
61 | 2.7.4 | ||
62 | |||
63 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | We add the vnet_hdr_support option for filter-mirror, default is disabled. | ||
4 | If you use virtio-net-pci or other driver needs vnet_hdr, please enable it. | ||
5 | You can use it for example: | ||
6 | -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0,vnet_hdr_support | ||
7 | |||
8 | If it has vnet_hdr_support flag, we will change the sending packet format from | ||
9 | struct {int size; const uint8_t buf[];} to {int size; int vnet_hdr_len; const uint8_t buf[];}. | ||
10 | make other module(like colo-compare) know how to parse net packet correctly. | ||
11 | |||
12 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
13 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
14 | --- | ||
15 | net/filter-mirror.c | 42 +++++++++++++++++++++++++++++++++++++++++- | ||
16 | qemu-options.hx | 5 ++--- | ||
17 | 2 files changed, 43 insertions(+), 4 deletions(-) | ||
18 | |||
19 | diff --git a/net/filter-mirror.c b/net/filter-mirror.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/net/filter-mirror.c | ||
22 | +++ b/net/filter-mirror.c | ||
23 | @@ -XXX,XX +XXX,XX @@ typedef struct MirrorState { | ||
24 | CharBackend chr_in; | ||
25 | CharBackend chr_out; | ||
26 | SocketReadState rs; | ||
27 | + bool vnet_hdr; | ||
28 | } MirrorState; | ||
29 | |||
30 | static int filter_send(MirrorState *s, | ||
31 | const struct iovec *iov, | ||
32 | int iovcnt) | ||
33 | { | ||
34 | + NetFilterState *nf = NETFILTER(s); | ||
35 | int ret = 0; | ||
36 | ssize_t size = 0; | ||
37 | uint32_t len = 0; | ||
38 | @@ -XXX,XX +XXX,XX @@ static int filter_send(MirrorState *s, | ||
39 | goto err; | ||
40 | } | ||
41 | |||
42 | + if (s->vnet_hdr) { | ||
43 | + /* | ||
44 | + * If vnet_hdr = on, we send vnet header len to make other | ||
45 | + * module(like colo-compare) know how to parse net | ||
46 | + * packet correctly. | ||
47 | + */ | ||
48 | + ssize_t vnet_hdr_len; | ||
49 | + | ||
50 | + vnet_hdr_len = nf->netdev->vnet_hdr_len; | ||
51 | + | ||
52 | + len = htonl(vnet_hdr_len); | ||
53 | + ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof(len)); | ||
54 | + if (ret != sizeof(len)) { | ||
55 | + goto err; | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | buf = g_malloc(size); | ||
60 | iov_to_buf(iov, iovcnt, 0, buf, size); | ||
61 | ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)buf, size); | ||
62 | @@ -XXX,XX +XXX,XX @@ static void filter_redirector_setup(NetFilterState *nf, Error **errp) | ||
63 | } | ||
64 | } | ||
65 | |||
66 | - net_socket_rs_init(&s->rs, redirector_rs_finalize, false); | ||
67 | + net_socket_rs_init(&s->rs, redirector_rs_finalize, s->vnet_hdr); | ||
68 | |||
69 | if (s->indev) { | ||
70 | chr = qemu_chr_find(s->indev); | ||
71 | @@ -XXX,XX +XXX,XX @@ static void filter_mirror_set_outdev(Object *obj, | ||
72 | } | ||
73 | } | ||
74 | |||
75 | +static bool filter_mirror_get_vnet_hdr(Object *obj, Error **errp) | ||
76 | +{ | ||
77 | + MirrorState *s = FILTER_MIRROR(obj); | ||
78 | + | ||
79 | + return s->vnet_hdr; | ||
80 | +} | ||
81 | + | ||
82 | +static void filter_mirror_set_vnet_hdr(Object *obj, bool value, Error **errp) | ||
83 | +{ | ||
84 | + MirrorState *s = FILTER_MIRROR(obj); | ||
85 | + | ||
86 | + s->vnet_hdr = value; | ||
87 | +} | ||
88 | + | ||
89 | static char *filter_redirector_get_outdev(Object *obj, Error **errp) | ||
90 | { | ||
91 | MirrorState *s = FILTER_REDIRECTOR(obj); | ||
92 | @@ -XXX,XX +XXX,XX @@ static void filter_redirector_set_outdev(Object *obj, | ||
93 | |||
94 | static void filter_mirror_init(Object *obj) | ||
95 | { | ||
96 | + MirrorState *s = FILTER_MIRROR(obj); | ||
97 | + | ||
98 | object_property_add_str(obj, "outdev", filter_mirror_get_outdev, | ||
99 | filter_mirror_set_outdev, NULL); | ||
100 | + | ||
101 | + s->vnet_hdr = false; | ||
102 | + object_property_add_bool(obj, "vnet_hdr_support", | ||
103 | + filter_mirror_get_vnet_hdr, | ||
104 | + filter_mirror_set_vnet_hdr, NULL); | ||
105 | } | ||
106 | |||
107 | static void filter_redirector_init(Object *obj) | ||
108 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
109 | index XXXXXXX..XXXXXXX 100644 | ||
110 | --- a/qemu-options.hx | ||
111 | +++ b/qemu-options.hx | ||
112 | @@ -XXX,XX +XXX,XX @@ queue @var{all|rx|tx} is an option that can be applied to any netfilter. | ||
113 | @option{tx}: the filter is attached to the transmit queue of the netdev, | ||
114 | where it will receive packets sent by the netdev. | ||
115 | |||
116 | -@item -object filter-mirror,id=@var{id},netdev=@var{netdevid},outdev=@var{chardevid}[,queue=@var{all|rx|tx}] | ||
117 | +@item -object filter-mirror,id=@var{id},netdev=@var{netdevid},outdev=@var{chardevid},queue=@var{all|rx|tx}[,vnet_hdr_support] | ||
118 | |||
119 | -filter-mirror on netdev @var{netdevid},mirror net packet to chardev | ||
120 | -@var{chardevid} | ||
121 | +filter-mirror on netdev @var{netdevid},mirror net packet to chardev@var{chardevid}, if it has the vnet_hdr_support flag, filter-mirror will mirror packet with vnet_hdr_len. | ||
122 | |||
123 | @item -object filter-redirector,id=@var{id},netdev=@var{netdevid},indev=@var{chardevid}, | ||
124 | outdev=@var{chardevid}[,queue=@var{all|rx|tx}] | ||
125 | -- | ||
126 | 2.7.4 | ||
127 | |||
128 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | We add the vnet_hdr_support option for filter-redirector, default is disabled. | ||
4 | If you use virtio-net-pci net driver or other driver needs vnet_hdr, please enable it. | ||
5 | Because colo-compare or other modules needs the vnet_hdr_len to parse | ||
6 | packet, we add this new option send the len to others. | ||
7 | You can use it for example: | ||
8 | -object filter-redirector,id=r0,netdev=hn0,queue=tx,outdev=red0,vnet_hdr_support | ||
9 | |||
10 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
11 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
12 | --- | ||
13 | net/filter-mirror.c | 23 +++++++++++++++++++++++ | ||
14 | qemu-options.hx | 6 +++--- | ||
15 | 2 files changed, 26 insertions(+), 3 deletions(-) | ||
16 | |||
17 | diff --git a/net/filter-mirror.c b/net/filter-mirror.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/net/filter-mirror.c | ||
20 | +++ b/net/filter-mirror.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void filter_redirector_set_outdev(Object *obj, | ||
22 | s->outdev = g_strdup(value); | ||
23 | } | ||
24 | |||
25 | +static bool filter_redirector_get_vnet_hdr(Object *obj, Error **errp) | ||
26 | +{ | ||
27 | + MirrorState *s = FILTER_REDIRECTOR(obj); | ||
28 | + | ||
29 | + return s->vnet_hdr; | ||
30 | +} | ||
31 | + | ||
32 | +static void filter_redirector_set_vnet_hdr(Object *obj, | ||
33 | + bool value, | ||
34 | + Error **errp) | ||
35 | +{ | ||
36 | + MirrorState *s = FILTER_REDIRECTOR(obj); | ||
37 | + | ||
38 | + s->vnet_hdr = value; | ||
39 | +} | ||
40 | + | ||
41 | static void filter_mirror_init(Object *obj) | ||
42 | { | ||
43 | MirrorState *s = FILTER_MIRROR(obj); | ||
44 | @@ -XXX,XX +XXX,XX @@ static void filter_mirror_init(Object *obj) | ||
45 | |||
46 | static void filter_redirector_init(Object *obj) | ||
47 | { | ||
48 | + MirrorState *s = FILTER_REDIRECTOR(obj); | ||
49 | + | ||
50 | object_property_add_str(obj, "indev", filter_redirector_get_indev, | ||
51 | filter_redirector_set_indev, NULL); | ||
52 | object_property_add_str(obj, "outdev", filter_redirector_get_outdev, | ||
53 | filter_redirector_set_outdev, NULL); | ||
54 | + | ||
55 | + s->vnet_hdr = false; | ||
56 | + object_property_add_bool(obj, "vnet_hdr_support", | ||
57 | + filter_redirector_get_vnet_hdr, | ||
58 | + filter_redirector_set_vnet_hdr, NULL); | ||
59 | } | ||
60 | |||
61 | static void filter_mirror_fini(Object *obj) | ||
62 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/qemu-options.hx | ||
65 | +++ b/qemu-options.hx | ||
66 | @@ -XXX,XX +XXX,XX @@ queue @var{all|rx|tx} is an option that can be applied to any netfilter. | ||
67 | |||
68 | filter-mirror on netdev @var{netdevid},mirror net packet to chardev@var{chardevid}, if it has the vnet_hdr_support flag, filter-mirror will mirror packet with vnet_hdr_len. | ||
69 | |||
70 | -@item -object filter-redirector,id=@var{id},netdev=@var{netdevid},indev=@var{chardevid}, | ||
71 | -outdev=@var{chardevid}[,queue=@var{all|rx|tx}] | ||
72 | +@item -object filter-redirector,id=@var{id},netdev=@var{netdevid},indev=@var{chardevid},outdev=@var{chardevid},queue=@var{all|rx|tx}[,vnet_hdr_support] | ||
73 | |||
74 | filter-redirector on netdev @var{netdevid},redirect filter's net packet to chardev | ||
75 | -@var{chardevid},and redirect indev's packet to filter. | ||
76 | +@var{chardevid},and redirect indev's packet to filter.if it has the vnet_hdr_support flag, | ||
77 | +filter-redirector will redirect packet with vnet_hdr_len. | ||
78 | Create a filter-redirector we need to differ outdev id from indev id, id can not | ||
79 | be the same. we can just use indev or outdev, but at least one of indev or outdev | ||
80 | need to be specified. | ||
81 | -- | ||
82 | 2.7.4 | ||
83 | |||
84 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | We can use this property flush and send packet with vnet_hdr_len. | ||
4 | |||
5 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
6 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
7 | --- | ||
8 | net/colo-compare.c | 8 ++++++-- | ||
9 | net/colo.c | 3 ++- | ||
10 | net/colo.h | 4 +++- | ||
11 | net/filter-rewriter.c | 2 +- | ||
12 | 4 files changed, 12 insertions(+), 5 deletions(-) | ||
13 | |||
14 | diff --git a/net/colo-compare.c b/net/colo-compare.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/net/colo-compare.c | ||
17 | +++ b/net/colo-compare.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static int packet_enqueue(CompareState *s, int mode) | ||
19 | Connection *conn; | ||
20 | |||
21 | if (mode == PRIMARY_IN) { | ||
22 | - pkt = packet_new(s->pri_rs.buf, s->pri_rs.packet_len); | ||
23 | + pkt = packet_new(s->pri_rs.buf, | ||
24 | + s->pri_rs.packet_len, | ||
25 | + s->pri_rs.vnet_hdr_len); | ||
26 | } else { | ||
27 | - pkt = packet_new(s->sec_rs.buf, s->sec_rs.packet_len); | ||
28 | + pkt = packet_new(s->sec_rs.buf, | ||
29 | + s->sec_rs.packet_len, | ||
30 | + s->sec_rs.vnet_hdr_len); | ||
31 | } | ||
32 | |||
33 | if (parse_packet_early(pkt)) { | ||
34 | diff --git a/net/colo.c b/net/colo.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/net/colo.c | ||
37 | +++ b/net/colo.c | ||
38 | @@ -XXX,XX +XXX,XX @@ void connection_destroy(void *opaque) | ||
39 | g_slice_free(Connection, conn); | ||
40 | } | ||
41 | |||
42 | -Packet *packet_new(const void *data, int size) | ||
43 | +Packet *packet_new(const void *data, int size, int vnet_hdr_len) | ||
44 | { | ||
45 | Packet *pkt = g_slice_new(Packet); | ||
46 | |||
47 | pkt->data = g_memdup(data, size); | ||
48 | pkt->size = size; | ||
49 | pkt->creation_ms = qemu_clock_get_ms(QEMU_CLOCK_HOST); | ||
50 | + pkt->vnet_hdr_len = vnet_hdr_len; | ||
51 | |||
52 | return pkt; | ||
53 | } | ||
54 | diff --git a/net/colo.h b/net/colo.h | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/net/colo.h | ||
57 | +++ b/net/colo.h | ||
58 | @@ -XXX,XX +XXX,XX @@ typedef struct Packet { | ||
59 | int size; | ||
60 | /* Time of packet creation, in wall clock ms */ | ||
61 | int64_t creation_ms; | ||
62 | + /* Get vnet_hdr_len from filter */ | ||
63 | + uint32_t vnet_hdr_len; | ||
64 | } Packet; | ||
65 | |||
66 | typedef struct ConnectionKey { | ||
67 | @@ -XXX,XX +XXX,XX @@ Connection *connection_get(GHashTable *connection_track_table, | ||
68 | ConnectionKey *key, | ||
69 | GQueue *conn_list); | ||
70 | void connection_hashtable_reset(GHashTable *connection_track_table); | ||
71 | -Packet *packet_new(const void *data, int size); | ||
72 | +Packet *packet_new(const void *data, int size, int vnet_hdr_len); | ||
73 | void packet_destroy(void *opaque, void *user_data); | ||
74 | |||
75 | #endif /* QEMU_COLO_PROXY_H */ | ||
76 | diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c | ||
77 | index XXXXXXX..XXXXXXX 100644 | ||
78 | --- a/net/filter-rewriter.c | ||
79 | +++ b/net/filter-rewriter.c | ||
80 | @@ -XXX,XX +XXX,XX @@ static ssize_t colo_rewriter_receive_iov(NetFilterState *nf, | ||
81 | char *buf = g_malloc0(size); | ||
82 | |||
83 | iov_to_buf(iov, iovcnt, 0, buf, size); | ||
84 | - pkt = packet_new(buf, size); | ||
85 | + pkt = packet_new(buf, size, 0); | ||
86 | g_free(buf); | ||
87 | |||
88 | /* | ||
89 | -- | ||
90 | 2.7.4 | ||
91 | |||
92 | diff view generated by jsdifflib |
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | This patch change the compare_chr_send() parameter from CharBackend to CompareState, | 3 | 'vlan' is very confusing since it does not mean something like IEEE |
4 | we can get more information like vnet_hdr(We use it to support packet with vnet_header). | 4 | 802.1Q, but rather emulated hubs, so let's switch to that terminology |
5 | instead. | ||
5 | 6 | ||
6 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 7 | Buglink: https://bugs.launchpad.net/qemu/+bug/658904 |
8 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
9 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
7 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 10 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
8 | --- | 11 | --- |
9 | net/colo-compare.c | 14 +++++++------- | 12 | net/hub.c | 7 +++---- |
10 | 1 file changed, 7 insertions(+), 7 deletions(-) | 13 | net/slirp.c | 8 ++++---- |
14 | net/tap.c | 4 ++-- | ||
15 | 3 files changed, 9 insertions(+), 10 deletions(-) | ||
11 | 16 | ||
12 | diff --git a/net/colo-compare.c b/net/colo-compare.c | 17 | diff --git a/net/hub.c b/net/hub.c |
13 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/net/colo-compare.c | 19 | --- a/net/hub.c |
15 | +++ b/net/colo-compare.c | 20 | +++ b/net/hub.c |
16 | @@ -XXX,XX +XXX,XX @@ enum { | 21 | @@ -XXX,XX +XXX,XX @@ |
17 | SECONDARY_IN, | 22 | |
18 | }; | 23 | /* |
19 | 24 | * A hub broadcasts incoming packets to all its ports except the source port. | |
20 | -static int compare_chr_send(CharBackend *out, | 25 | - * Hubs can be used to provide independent network segments, also confusingly |
21 | +static int compare_chr_send(CompareState *s, | 26 | - * named the QEMU 'vlan' feature. |
22 | const uint8_t *buf, | 27 | + * Hubs can be used to provide independent emulated network segments. |
23 | uint32_t size); | 28 | */ |
24 | 29 | ||
25 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_connection(void *opaque, void *user_data) | 30 | typedef struct NetHub NetHub; |
31 | @@ -XXX,XX +XXX,XX @@ void net_hub_check_clients(void) | ||
32 | } | ||
26 | } | 33 | } |
27 | 34 | if (has_host_dev && !has_nic) { | |
28 | if (result) { | 35 | - warn_report("vlan %d with no nics", hub->id); |
29 | - ret = compare_chr_send(&s->chr_out, pkt->data, pkt->size); | 36 | + warn_report("hub %d with no nics", hub->id); |
30 | + ret = compare_chr_send(s, pkt->data, pkt->size); | 37 | } |
31 | if (ret < 0) { | 38 | if (has_nic && !has_host_dev) { |
32 | error_report("colo_send_primary_packet failed"); | 39 | - warn_report("vlan %d is not connected to host network", hub->id); |
33 | } | 40 | + warn_report("hub %d is not connected to host network", hub->id); |
34 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_connection(void *opaque, void *user_data) | 41 | } |
35 | } | 42 | } |
36 | } | 43 | } |
37 | 44 | diff --git a/net/slirp.c b/net/slirp.c | |
38 | -static int compare_chr_send(CharBackend *out, | 45 | index XXXXXXX..XXXXXXX 100644 |
39 | +static int compare_chr_send(CompareState *s, | 46 | --- a/net/slirp.c |
40 | const uint8_t *buf, | 47 | +++ b/net/slirp.c |
41 | uint32_t size) | 48 | @@ -XXX,XX +XXX,XX @@ static SlirpState *slirp_lookup(Monitor *mon, const char *hub_id, |
42 | { | 49 | if (hub_id) { |
43 | @@ -XXX,XX +XXX,XX @@ static int compare_chr_send(CharBackend *out, | 50 | nc = net_hub_find_client_by_name(strtol(hub_id, NULL, 0), name); |
44 | return 0; | 51 | if (!nc) { |
52 | - monitor_printf(mon, "unrecognized (vlan-id, stackname) pair\n"); | ||
53 | + monitor_printf(mon, "unrecognized (hub-id, stackname) pair\n"); | ||
54 | return NULL; | ||
55 | } | ||
56 | } else { | ||
57 | @@ -XXX,XX +XXX,XX @@ void hmp_info_usernet(Monitor *mon, const QDict *qdict) | ||
58 | |||
59 | QTAILQ_FOREACH(s, &slirp_stacks, entry) { | ||
60 | int id; | ||
61 | - bool got_vlan_id = net_hub_id_for_client(&s->nc, &id) == 0; | ||
62 | - monitor_printf(mon, "VLAN %d (%s):\n", | ||
63 | - got_vlan_id ? id : -1, | ||
64 | + bool got_hub_id = net_hub_id_for_client(&s->nc, &id) == 0; | ||
65 | + monitor_printf(mon, "Hub %d (%s):\n", | ||
66 | + got_hub_id ? id : -1, | ||
67 | s->nc.name); | ||
68 | slirp_connection_info(s->slirp, mon); | ||
45 | } | 69 | } |
46 | 70 | diff --git a/net/tap.c b/net/tap.c | |
47 | - ret = qemu_chr_fe_write_all(out, (uint8_t *)&len, sizeof(len)); | 71 | index XXXXXXX..XXXXXXX 100644 |
48 | + ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof(len)); | 72 | --- a/net/tap.c |
49 | if (ret != sizeof(len)) { | 73 | +++ b/net/tap.c |
50 | goto err; | 74 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, |
75 | queues = tap->has_queues ? tap->queues : 1; | ||
76 | vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL; | ||
77 | |||
78 | - /* QEMU vlans does not support multiqueue tap, in this case peer is set. | ||
79 | + /* QEMU hubs do not support multiqueue tap, in this case peer is set. | ||
80 | * For -netdev, peer is always NULL. */ | ||
81 | if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) { | ||
82 | - error_setg(errp, "Multiqueue tap cannot be used with QEMU vlans"); | ||
83 | + error_setg(errp, "Multiqueue tap cannot be used with hubs"); | ||
84 | return -1; | ||
51 | } | 85 | } |
52 | 86 | ||
53 | - ret = qemu_chr_fe_write_all(out, (uint8_t *)buf, size); | ||
54 | + ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)buf, size); | ||
55 | if (ret != size) { | ||
56 | goto err; | ||
57 | } | ||
58 | @@ -XXX,XX +XXX,XX @@ static void compare_pri_rs_finalize(SocketReadState *pri_rs) | ||
59 | |||
60 | if (packet_enqueue(s, PRIMARY_IN)) { | ||
61 | trace_colo_compare_main("primary: unsupported packet in"); | ||
62 | - compare_chr_send(&s->chr_out, pri_rs->buf, pri_rs->packet_len); | ||
63 | + compare_chr_send(s, pri_rs->buf, pri_rs->packet_len); | ||
64 | } else { | ||
65 | /* compare connection */ | ||
66 | g_queue_foreach(&s->conn_list, colo_compare_connection, s); | ||
67 | @@ -XXX,XX +XXX,XX @@ static void colo_flush_packets(void *opaque, void *user_data) | ||
68 | |||
69 | while (!g_queue_is_empty(&conn->primary_list)) { | ||
70 | pkt = g_queue_pop_head(&conn->primary_list); | ||
71 | - compare_chr_send(&s->chr_out, pkt->data, pkt->size); | ||
72 | + compare_chr_send(s, pkt->data, pkt->size); | ||
73 | packet_destroy(pkt, NULL); | ||
74 | } | ||
75 | while (!g_queue_is_empty(&conn->secondary_list)) { | ||
76 | -- | 87 | -- |
77 | 2.7.4 | 88 | 2.7.4 |
78 | 89 | ||
79 | 90 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | We add the vnet_hdr_support option for colo-compare, default is disabled. | ||
4 | If you use virtio-net-pci or other driver needs vnet_hdr, please enable it. | ||
5 | You can use it for example: | ||
6 | -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,vnet_hdr_support | ||
7 | |||
8 | COLO-compare can get vnet header length from filter, | ||
9 | Add vnet_hdr_len to struct packet and output packet with | ||
10 | the vnet_hdr_len. | ||
11 | |||
12 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
13 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
14 | --- | ||
15 | net/colo-compare.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++------- | ||
16 | qemu-options.hx | 4 ++-- | ||
17 | 2 files changed, 55 insertions(+), 9 deletions(-) | ||
18 | |||
19 | diff --git a/net/colo-compare.c b/net/colo-compare.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/net/colo-compare.c | ||
22 | +++ b/net/colo-compare.c | ||
23 | @@ -XXX,XX +XXX,XX @@ typedef struct CompareState { | ||
24 | CharBackend chr_out; | ||
25 | SocketReadState pri_rs; | ||
26 | SocketReadState sec_rs; | ||
27 | + bool vnet_hdr; | ||
28 | |||
29 | /* connection list: the connections belonged to this NIC could be found | ||
30 | * in this list. | ||
31 | @@ -XXX,XX +XXX,XX @@ enum { | ||
32 | |||
33 | static int compare_chr_send(CompareState *s, | ||
34 | const uint8_t *buf, | ||
35 | - uint32_t size); | ||
36 | + uint32_t size, | ||
37 | + uint32_t vnet_hdr_len); | ||
38 | |||
39 | static gint seq_sorter(Packet *a, Packet *b, gpointer data) | ||
40 | { | ||
41 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_connection(void *opaque, void *user_data) | ||
42 | } | ||
43 | |||
44 | if (result) { | ||
45 | - ret = compare_chr_send(s, pkt->data, pkt->size); | ||
46 | + ret = compare_chr_send(s, | ||
47 | + pkt->data, | ||
48 | + pkt->size, | ||
49 | + pkt->vnet_hdr_len); | ||
50 | if (ret < 0) { | ||
51 | error_report("colo_send_primary_packet failed"); | ||
52 | } | ||
53 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_connection(void *opaque, void *user_data) | ||
54 | |||
55 | static int compare_chr_send(CompareState *s, | ||
56 | const uint8_t *buf, | ||
57 | - uint32_t size) | ||
58 | + uint32_t size, | ||
59 | + uint32_t vnet_hdr_len) | ||
60 | { | ||
61 | int ret = 0; | ||
62 | uint32_t len = htonl(size); | ||
63 | @@ -XXX,XX +XXX,XX @@ static int compare_chr_send(CompareState *s, | ||
64 | goto err; | ||
65 | } | ||
66 | |||
67 | + if (s->vnet_hdr) { | ||
68 | + /* | ||
69 | + * We send vnet header len make other module(like filter-redirector) | ||
70 | + * know how to parse net packet correctly. | ||
71 | + */ | ||
72 | + len = htonl(vnet_hdr_len); | ||
73 | + ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof(len)); | ||
74 | + if (ret != sizeof(len)) { | ||
75 | + goto err; | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)buf, size); | ||
80 | if (ret != size) { | ||
81 | goto err; | ||
82 | @@ -XXX,XX +XXX,XX @@ static void compare_set_outdev(Object *obj, const char *value, Error **errp) | ||
83 | s->outdev = g_strdup(value); | ||
84 | } | ||
85 | |||
86 | +static bool compare_get_vnet_hdr(Object *obj, Error **errp) | ||
87 | +{ | ||
88 | + CompareState *s = COLO_COMPARE(obj); | ||
89 | + | ||
90 | + return s->vnet_hdr; | ||
91 | +} | ||
92 | + | ||
93 | +static void compare_set_vnet_hdr(Object *obj, | ||
94 | + bool value, | ||
95 | + Error **errp) | ||
96 | +{ | ||
97 | + CompareState *s = COLO_COMPARE(obj); | ||
98 | + | ||
99 | + s->vnet_hdr = value; | ||
100 | +} | ||
101 | + | ||
102 | static void compare_pri_rs_finalize(SocketReadState *pri_rs) | ||
103 | { | ||
104 | CompareState *s = container_of(pri_rs, CompareState, pri_rs); | ||
105 | |||
106 | if (packet_enqueue(s, PRIMARY_IN)) { | ||
107 | trace_colo_compare_main("primary: unsupported packet in"); | ||
108 | - compare_chr_send(s, pri_rs->buf, pri_rs->packet_len); | ||
109 | + compare_chr_send(s, | ||
110 | + pri_rs->buf, | ||
111 | + pri_rs->packet_len, | ||
112 | + pri_rs->vnet_hdr_len); | ||
113 | } else { | ||
114 | /* compare connection */ | ||
115 | g_queue_foreach(&s->conn_list, colo_compare_connection, s); | ||
116 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_complete(UserCreatable *uc, Error **errp) | ||
117 | return; | ||
118 | } | ||
119 | |||
120 | - net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize, false); | ||
121 | - net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize, false); | ||
122 | + net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize, s->vnet_hdr); | ||
123 | + net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize, s->vnet_hdr); | ||
124 | |||
125 | g_queue_init(&s->conn_list); | ||
126 | |||
127 | @@ -XXX,XX +XXX,XX @@ static void colo_flush_packets(void *opaque, void *user_data) | ||
128 | |||
129 | while (!g_queue_is_empty(&conn->primary_list)) { | ||
130 | pkt = g_queue_pop_head(&conn->primary_list); | ||
131 | - compare_chr_send(s, pkt->data, pkt->size); | ||
132 | + compare_chr_send(s, | ||
133 | + pkt->data, | ||
134 | + pkt->size, | ||
135 | + pkt->vnet_hdr_len); | ||
136 | packet_destroy(pkt, NULL); | ||
137 | } | ||
138 | while (!g_queue_is_empty(&conn->secondary_list)) { | ||
139 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_class_init(ObjectClass *oc, void *data) | ||
140 | |||
141 | static void colo_compare_init(Object *obj) | ||
142 | { | ||
143 | + CompareState *s = COLO_COMPARE(obj); | ||
144 | + | ||
145 | object_property_add_str(obj, "primary_in", | ||
146 | compare_get_pri_indev, compare_set_pri_indev, | ||
147 | NULL); | ||
148 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_init(Object *obj) | ||
149 | object_property_add_str(obj, "outdev", | ||
150 | compare_get_outdev, compare_set_outdev, | ||
151 | NULL); | ||
152 | + | ||
153 | + s->vnet_hdr = false; | ||
154 | + object_property_add_bool(obj, "vnet_hdr_support", compare_get_vnet_hdr, | ||
155 | + compare_set_vnet_hdr, NULL); | ||
156 | } | ||
157 | |||
158 | static void colo_compare_finalize(Object *obj) | ||
159 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
160 | index XXXXXXX..XXXXXXX 100644 | ||
161 | --- a/qemu-options.hx | ||
162 | +++ b/qemu-options.hx | ||
163 | @@ -XXX,XX +XXX,XX @@ Dump the network traffic on netdev @var{dev} to the file specified by | ||
164 | The file format is libpcap, so it can be analyzed with tools such as tcpdump | ||
165 | or Wireshark. | ||
166 | |||
167 | -@item -object colo-compare,id=@var{id},primary_in=@var{chardevid},secondary_in=@var{chardevid}, | ||
168 | -outdev=@var{chardevid} | ||
169 | +@item -object colo-compare,id=@var{id},primary_in=@var{chardevid},secondary_in=@var{chardevid},outdev=@var{chardevid}[,vnet_hdr_support] | ||
170 | |||
171 | Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@var{chardevid}, than compare primary packet with | ||
172 | secondary packet. If the packets are same, we will output primary | ||
173 | packet to outdev@var{chardevid}, else we will notify colo-frame | ||
174 | do checkpoint and send primary packet to outdev@var{chardevid}. | ||
175 | +if it has the vnet_hdr_support flag, colo compare will send/recv packet with vnet_hdr_len. | ||
176 | |||
177 | we must use it with the help of filter-mirror and filter-redirector. | ||
178 | |||
179 | -- | ||
180 | 2.7.4 | ||
181 | |||
182 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | Make colo-compare and filter-rewriter can parse vnet packet. | ||
4 | |||
5 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
6 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
7 | --- | ||
8 | net/colo.c | 6 +++--- | ||
9 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
10 | |||
11 | diff --git a/net/colo.c b/net/colo.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/net/colo.c | ||
14 | +++ b/net/colo.c | ||
15 | @@ -XXX,XX +XXX,XX @@ int parse_packet_early(Packet *pkt) | ||
16 | { | ||
17 | int network_length; | ||
18 | static const uint8_t vlan[] = {0x81, 0x00}; | ||
19 | - uint8_t *data = pkt->data; | ||
20 | + uint8_t *data = pkt->data + pkt->vnet_hdr_len; | ||
21 | uint16_t l3_proto; | ||
22 | ssize_t l2hdr_len = eth_get_l2_hdr_length(data); | ||
23 | |||
24 | - if (pkt->size < ETH_HLEN) { | ||
25 | + if (pkt->size < ETH_HLEN + pkt->vnet_hdr_len) { | ||
26 | trace_colo_proxy_main("pkt->size < ETH_HLEN"); | ||
27 | return 1; | ||
28 | } | ||
29 | @@ -XXX,XX +XXX,XX @@ int parse_packet_early(Packet *pkt) | ||
30 | } | ||
31 | |||
32 | network_length = pkt->ip->ip_hl * 4; | ||
33 | - if (pkt->size < l2hdr_len + network_length) { | ||
34 | + if (pkt->size < l2hdr_len + network_length + pkt->vnet_hdr_len) { | ||
35 | trace_colo_proxy_main("pkt->size < network_header + network_length"); | ||
36 | return 1; | ||
37 | } | ||
38 | -- | ||
39 | 2.7.4 | ||
40 | |||
41 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | COLO-Proxy just focus on packet payload, so we skip vnet header. | ||
4 | |||
5 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
6 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
7 | --- | ||
8 | net/colo-compare.c | 8 ++++++-- | ||
9 | 1 file changed, 6 insertions(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/net/colo-compare.c b/net/colo-compare.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/net/colo-compare.c | ||
14 | +++ b/net/colo-compare.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset) | ||
16 | sec_ip_src, sec_ip_dst); | ||
17 | } | ||
18 | |||
19 | + offset = ppkt->vnet_hdr_len + offset; | ||
20 | + | ||
21 | if (ppkt->size == spkt->size) { | ||
22 | - return memcmp(ppkt->data + offset, spkt->data + offset, | ||
23 | + return memcmp(ppkt->data + offset, | ||
24 | + spkt->data + offset, | ||
25 | spkt->size - offset); | ||
26 | } else { | ||
27 | trace_colo_compare_main("Net packet size are not the same"); | ||
28 | @@ -XXX,XX +XXX,XX @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt) | ||
29 | */ | ||
30 | if (ptcp->th_off > 5) { | ||
31 | ptrdiff_t tcp_offset; | ||
32 | + | ||
33 | tcp_offset = ppkt->transport_header - (uint8_t *)ppkt->data | ||
34 | - + (ptcp->th_off * 4); | ||
35 | + + (ptcp->th_off * 4) - ppkt->vnet_hdr_len; | ||
36 | res = colo_packet_compare_common(ppkt, spkt, tcp_offset); | ||
37 | } else if (ptcp->th_sum == stcp->th_sum) { | ||
38 | res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN); | ||
39 | -- | ||
40 | 2.7.4 | ||
41 | |||
42 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | We add the vnet_hdr_support option for filter-rewriter, default is disabled. | ||
4 | If you use virtio-net-pci or other driver needs vnet_hdr, please enable it. | ||
5 | You can use it for example: | ||
6 | -object filter-rewriter,id=rew0,netdev=hn0,queue=all,vnet_hdr_support | ||
7 | |||
8 | We get the vnet_hdr_len from NetClientState that make us | ||
9 | parse net packet correctly. | ||
10 | |||
11 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
12 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
13 | --- | ||
14 | net/filter-rewriter.c | 37 ++++++++++++++++++++++++++++++++++++- | ||
15 | qemu-options.hx | 4 ++-- | ||
16 | 2 files changed, 38 insertions(+), 3 deletions(-) | ||
17 | |||
18 | diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/net/filter-rewriter.c | ||
21 | +++ b/net/filter-rewriter.c | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | #include "qemu-common.h" | ||
24 | #include "qapi/error.h" | ||
25 | #include "qapi/qmp/qerror.h" | ||
26 | +#include "qemu/error-report.h" | ||
27 | #include "qapi-visit.h" | ||
28 | #include "qom/object.h" | ||
29 | #include "qemu/main-loop.h" | ||
30 | @@ -XXX,XX +XXX,XX @@ typedef struct RewriterState { | ||
31 | NetQueue *incoming_queue; | ||
32 | /* hashtable to save connection */ | ||
33 | GHashTable *connection_track_table; | ||
34 | + bool vnet_hdr; | ||
35 | } RewriterState; | ||
36 | |||
37 | static void filter_rewriter_flush(NetFilterState *nf) | ||
38 | @@ -XXX,XX +XXX,XX @@ static ssize_t colo_rewriter_receive_iov(NetFilterState *nf, | ||
39 | ConnectionKey key; | ||
40 | Packet *pkt; | ||
41 | ssize_t size = iov_size(iov, iovcnt); | ||
42 | + ssize_t vnet_hdr_len = 0; | ||
43 | char *buf = g_malloc0(size); | ||
44 | |||
45 | iov_to_buf(iov, iovcnt, 0, buf, size); | ||
46 | - pkt = packet_new(buf, size, 0); | ||
47 | + | ||
48 | + if (s->vnet_hdr) { | ||
49 | + vnet_hdr_len = nf->netdev->vnet_hdr_len; | ||
50 | + } | ||
51 | + | ||
52 | + pkt = packet_new(buf, size, vnet_hdr_len); | ||
53 | g_free(buf); | ||
54 | |||
55 | /* | ||
56 | @@ -XXX,XX +XXX,XX @@ static void colo_rewriter_setup(NetFilterState *nf, Error **errp) | ||
57 | s->incoming_queue = qemu_new_net_queue(qemu_netfilter_pass_to_next, nf); | ||
58 | } | ||
59 | |||
60 | +static bool filter_rewriter_get_vnet_hdr(Object *obj, Error **errp) | ||
61 | +{ | ||
62 | + RewriterState *s = FILTER_COLO_REWRITER(obj); | ||
63 | + | ||
64 | + return s->vnet_hdr; | ||
65 | +} | ||
66 | + | ||
67 | +static void filter_rewriter_set_vnet_hdr(Object *obj, | ||
68 | + bool value, | ||
69 | + Error **errp) | ||
70 | +{ | ||
71 | + RewriterState *s = FILTER_COLO_REWRITER(obj); | ||
72 | + | ||
73 | + s->vnet_hdr = value; | ||
74 | +} | ||
75 | + | ||
76 | +static void filter_rewriter_init(Object *obj) | ||
77 | +{ | ||
78 | + RewriterState *s = FILTER_COLO_REWRITER(obj); | ||
79 | + | ||
80 | + s->vnet_hdr = false; | ||
81 | + object_property_add_bool(obj, "vnet_hdr_support", | ||
82 | + filter_rewriter_get_vnet_hdr, | ||
83 | + filter_rewriter_set_vnet_hdr, NULL); | ||
84 | +} | ||
85 | + | ||
86 | static void colo_rewriter_class_init(ObjectClass *oc, void *data) | ||
87 | { | ||
88 | NetFilterClass *nfc = NETFILTER_CLASS(oc); | ||
89 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo colo_rewriter_info = { | ||
90 | .name = TYPE_FILTER_REWRITER, | ||
91 | .parent = TYPE_NETFILTER, | ||
92 | .class_init = colo_rewriter_class_init, | ||
93 | + .instance_init = filter_rewriter_init, | ||
94 | .instance_size = sizeof(RewriterState), | ||
95 | }; | ||
96 | |||
97 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
98 | index XXXXXXX..XXXXXXX 100644 | ||
99 | --- a/qemu-options.hx | ||
100 | +++ b/qemu-options.hx | ||
101 | @@ -XXX,XX +XXX,XX @@ Create a filter-redirector we need to differ outdev id from indev id, id can not | ||
102 | be the same. we can just use indev or outdev, but at least one of indev or outdev | ||
103 | need to be specified. | ||
104 | |||
105 | -@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid}[,queue=@var{all|rx|tx}] | ||
106 | +@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},queue=@var{all|rx|tx},[vnet_hdr_support] | ||
107 | |||
108 | Filter-rewriter is a part of COLO project.It will rewrite tcp packet to | ||
109 | secondary from primary to keep secondary tcp connection,and rewrite | ||
110 | tcp packet to primary from secondary make tcp packet can be handled by | ||
111 | -client. | ||
112 | +client.if it has the vnet_hdr_support flag, we can parse packet with vnet header. | ||
113 | |||
114 | usage: | ||
115 | colo secondary: | ||
116 | -- | ||
117 | 2.7.4 | ||
118 | |||
119 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
4 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
5 | --- | ||
6 | docs/colo-proxy.txt | 26 ++++++++++++++++++++++++++ | ||
7 | 1 file changed, 26 insertions(+) | ||
8 | |||
9 | diff --git a/docs/colo-proxy.txt b/docs/colo-proxy.txt | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/docs/colo-proxy.txt | ||
12 | +++ b/docs/colo-proxy.txt | ||
13 | @@ -XXX,XX +XXX,XX @@ Secondary(ip:3.3.3.8): | ||
14 | -chardev socket,id=red1,host=3.3.3.3,port=9004 | ||
15 | -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 | ||
16 | -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 | ||
17 | +-object filter-rewriter,id=f3,netdev=hn0,queue=all | ||
18 | + | ||
19 | +If you want to use virtio-net-pci or other driver with vnet_header: | ||
20 | + | ||
21 | +Primary(ip:3.3.3.3): | ||
22 | +-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown | ||
23 | +-device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66 | ||
24 | +-chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait | ||
25 | +-chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait | ||
26 | +-chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait | ||
27 | +-chardev socket,id=compare0-0,host=3.3.3.3,port=9001 | ||
28 | +-chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait | ||
29 | +-chardev socket,id=compare_out0,host=3.3.3.3,port=9005 | ||
30 | +-object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0,vnet_hdr_support | ||
31 | +-object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out,vnet_hdr_support | ||
32 | +-object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0,vnet_hdr_support | ||
33 | +-object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,vnet_hdr_support | ||
34 | + | ||
35 | +Secondary(ip:3.3.3.8): | ||
36 | +-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown | ||
37 | +-device e1000,netdev=hn0,mac=52:a4:00:12:78:66 | ||
38 | +-chardev socket,id=red0,host=3.3.3.3,port=9003 | ||
39 | +-chardev socket,id=red1,host=3.3.3.3,port=9004 | ||
40 | +-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0,vnet_hdr_support | ||
41 | +-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1,vnet_hdr_support | ||
42 | +-object filter-rewriter,id=f3,netdev=hn0,queue=all,vnet_hdr_support | ||
43 | |||
44 | Note: | ||
45 | a.COLO-proxy must work with COLO-frame and Block-replication. | ||
46 | -- | ||
47 | 2.7.4 | ||
48 | |||
49 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Michal Privoznik <mprivozn@redhat.com> | ||
2 | 1 | ||
3 | We have a function that checks if given number is power of two. | ||
4 | We should prefer it instead of expanding the check on our own. | ||
5 | |||
6 | Signed-off-by: Michal Privoznik <mprivozn@redhat.com> | ||
7 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
8 | --- | ||
9 | hw/net/virtio-net.c | 2 +- | ||
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/hw/net/virtio-net.c | ||
15 | +++ b/hw/net/virtio-net.c | ||
16 | @@ -XXX,XX +XXX,XX @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) | ||
17 | */ | ||
18 | if (n->net_conf.rx_queue_size < VIRTIO_NET_RX_QUEUE_MIN_SIZE || | ||
19 | n->net_conf.rx_queue_size > VIRTQUEUE_MAX_SIZE || | ||
20 | - (n->net_conf.rx_queue_size & (n->net_conf.rx_queue_size - 1))) { | ||
21 | + !is_power_of_2(n->net_conf.rx_queue_size)) { | ||
22 | error_setg(errp, "Invalid rx_queue_size (= %" PRIu16 "), " | ||
23 | "must be a power of 2 between %d and %d.", | ||
24 | n->net_conf.rx_queue_size, VIRTIO_NET_RX_QUEUE_MIN_SIZE, | ||
25 | -- | ||
26 | 2.7.4 | ||
27 | |||
28 | diff view generated by jsdifflib |
1 | Spec said offloads should be le64, so use virtio_ldq_p() to guarantee | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | valid endian. | ||
3 | 2 | ||
4 | Fixes: 644c98587d4c ("virtio-net: dynamic network offloads configuration") | 3 | 'vlan' is very confusing since it does not mean something like IEEE |
5 | Cc: qemu-stable@nongnu.org | 4 | 802.1Q, but rather emulated hubs, so let's switch to that terminology |
6 | Cc: Dmitry Fleytman <dfleytma@redhat.com> | 5 | instead. While we're at it, move the subsection about hub a little bit |
6 | downward in the documentation (it's not as important anymore as it was | ||
7 | before the invention of the -netdev parameter), and extend it a little | ||
8 | bit. | ||
9 | |||
10 | Buglink: https://bugs.launchpad.net/qemu/+bug/658904 | ||
11 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
12 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
7 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 13 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
8 | --- | 14 | --- |
9 | hw/net/virtio-net.c | 2 ++ | 15 | qemu-doc.texi | 42 +++++++++++++++++++++++------------------- |
10 | 1 file changed, 2 insertions(+) | 16 | 1 file changed, 23 insertions(+), 19 deletions(-) |
11 | 17 | ||
12 | diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c | 18 | diff --git a/qemu-doc.texi b/qemu-doc.texi |
13 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/net/virtio-net.c | 20 | --- a/qemu-doc.texi |
15 | +++ b/hw/net/virtio-net.c | 21 | +++ b/qemu-doc.texi |
16 | @@ -XXX,XX +XXX,XX @@ static int virtio_net_handle_offloads(VirtIONet *n, uint8_t cmd, | 22 | @@ -XXX,XX +XXX,XX @@ state is not saved or restored properly (in particular USB). |
17 | if (cmd == VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET) { | 23 | @node pcsys_network |
18 | uint64_t supported_offloads; | 24 | @section Network emulation |
19 | 25 | ||
20 | + offloads = virtio_ldq_p(vdev, &offloads); | 26 | -QEMU can simulate several network cards (PCI or ISA cards on the PC |
27 | -target) and can connect them to an arbitrary number of Virtual Local | ||
28 | -Area Networks (VLANs). Host TAP devices can be connected to any QEMU | ||
29 | -VLAN. VLAN can be connected between separate instances of QEMU to | ||
30 | -simulate large networks. For simpler usage, a non privileged user mode | ||
31 | -network stack can replace the TAP device to have a basic network | ||
32 | -connection. | ||
33 | - | ||
34 | -@subsection VLANs | ||
35 | - | ||
36 | -QEMU simulates several VLANs. A VLAN can be symbolised as a virtual | ||
37 | -connection between several network devices. These devices can be for | ||
38 | -example QEMU virtual Ethernet cards or virtual Host ethernet devices | ||
39 | -(TAP devices). | ||
40 | +QEMU can simulate several network cards (e.g. PCI or ISA cards on the PC | ||
41 | +target) and can connect them to a network backend on the host or an emulated | ||
42 | +hub. The various host network backends can either be used to connect the NIC of | ||
43 | +the guest to a real network (e.g. by using a TAP devices or the non-privileged | ||
44 | +user mode network stack), or to other guest instances running in another QEMU | ||
45 | +process (e.g. by using the socket host network backend). | ||
46 | |||
47 | @subsection Using TAP network interfaces | ||
48 | |||
49 | @@ -XXX,XX +XXX,XX @@ network). The virtual network configuration is the following: | ||
50 | |||
51 | @example | ||
52 | |||
53 | - QEMU VLAN <------> Firewall/DHCP server <-----> Internet | ||
54 | + guest (10.0.2.15) <------> Firewall/DHCP server <-----> Internet | ||
55 | | (10.0.2.2) | ||
56 | | | ||
57 | ----> DNS server (10.0.2.3) | ||
58 | @@ -XXX,XX +XXX,XX @@ When using the @option{'-netdev user,hostfwd=...'} option, TCP or UDP | ||
59 | connections can be redirected from the host to the guest. It allows for | ||
60 | example to redirect X11, telnet or SSH connections. | ||
61 | |||
62 | -@subsection Connecting VLANs between QEMU instances | ||
63 | +@subsection Hubs | ||
21 | + | 64 | + |
22 | if (!n->has_vnet_hdr) { | 65 | +QEMU can simulate several hubs. A hub can be thought of as a virtual connection |
23 | return VIRTIO_NET_ERR; | 66 | +between several network devices. These devices can be for example QEMU virtual |
24 | } | 67 | +ethernet cards or virtual Host ethernet devices (TAP devices). You can connect |
68 | +guest NICs or host network backends to such a hub using the @option{-netdev | ||
69 | +hubport} or @option{-nic hubport} options. The legacy @option{-net} option | ||
70 | +also connects the given device to the emulated hub with ID 0 (i.e. the default | ||
71 | +hub) unless you specify a netdev with @option{-net nic,netdev=xxx} here. | ||
72 | + | ||
73 | +@subsection Connecting emulated networks between QEMU instances | ||
74 | |||
75 | -Using the @option{-net socket} option, it is possible to make VLANs | ||
76 | -that span several QEMU instances. See @ref{sec_invocation} to have a | ||
77 | -basic example. | ||
78 | +Using the @option{-netdev socket} (or @option{-nic socket} or | ||
79 | +@option{-net socket}) option, it is possible to create emulated | ||
80 | +networks that span several QEMU instances. | ||
81 | +See the description of the @option{-netdev socket} option in the | ||
82 | +@ref{sec_invocation,,Invocation chapter} to have a basic example. | ||
83 | |||
84 | @node pcsys_other_devs | ||
85 | @section Other Devices | ||
25 | -- | 86 | -- |
26 | 2.7.4 | 87 | 2.7.4 |
27 | 88 | ||
28 | 89 | diff view generated by jsdifflib |