1 | The following changes since commit 56821559f0ba682fe6b367815572e6f974d329ab: | 1 | The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'dgilbert/tags/pull-hmp-20170517' into staging (2017-05-18 13:36:15 +0100) | 3 | Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20201123.0' into staging (2020-11-23 18:51:13 +0000) |
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 82342e91b60a4a078811df4e1a545e57abffa11d: | 9 | for you to fetch changes up to 9925990d01a92564af55f6f69d0f5f59b47609b1: |
10 | 10 | ||
11 | e1000e: Fix ICR "Other" causes clear logic (2017-05-23 10:10:38 +0800) | 11 | net: Use correct default-path macro for downscript (2020-11-24 10:40:17 +0800) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | 14 | ||
15 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
16 | Sameeh Jubran (1): | 16 | Keqian Zhu (1): |
17 | e1000e: Fix ICR "Other" causes clear logic | 17 | net: Use correct default-path macro for downscript |
18 | 18 | ||
19 | Thomas Huth (3): | 19 | Paolo Bonzini (1): |
20 | net/tap: Replace tap-haiku.c and tap-aix.c by a generic tap-stub.c | 20 | net: do not exit on "netdev_add help" monitor command |
21 | net/dump: Issue a warning for the deprecated "-net dump" | ||
22 | hmp / net: Mark host_net_add/remove as deprecated | ||
23 | 21 | ||
24 | Yunjian Wang (1): | 22 | Prasad J Pandit (1): |
25 | virtio-net: fix wild pointer when remove virtio-net queues | 23 | hw/net/e1000e: advance desc_offset in case of null descriptor |
26 | 24 | ||
27 | Zhang Chen (4): | 25 | Yuri Benditovich (1): |
28 | COLO-compare: Improve tcp compare trace event readability | 26 | net: purge queued rx packets on queue deletion |
29 | net/filter-mirror.c: Remove duplicate check code. | ||
30 | net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle | ||
31 | net/filter-rewriter: Remove unused option in filter-rewriter | ||
32 | 27 | ||
33 | hmp-commands.hx | 8 ++-- | 28 | yuanjungong (1): |
34 | hw/net/e1000e_core.c | 10 ++++- | 29 | tap: fix a memory leak |
35 | hw/net/virtio-net.c | 3 ++ | 30 | |
36 | net/Makefile.objs | 15 ++++---- | 31 | hw/net/e1000e_core.c | 8 +++--- |
37 | net/colo-compare.c | 33 ++++++++++------ | 32 | include/net/net.h | 1 + |
38 | net/dump.c | 3 ++ | 33 | monitor/hmp-cmds.c | 6 ++++ |
39 | net/filter-mirror.c | 35 ++++++++--------- | 34 | net/net.c | 80 +++++++++++++++++++++++++++------------------------- |
40 | net/net.c | 13 +++++++ | 35 | net/tap.c | 5 +++- |
41 | net/tap-haiku.c | 87 ------------------------------------------- | 36 | 5 files changed, 57 insertions(+), 43 deletions(-) |
42 | net/{tap-aix.c => tap-stub.c} | 3 +- | ||
43 | net/trace-events | 3 +- | ||
44 | qemu-options.hx | 2 +- | ||
45 | 12 files changed, 80 insertions(+), 135 deletions(-) | ||
46 | delete mode 100644 net/tap-haiku.c | ||
47 | rename net/{tap-aix.c => tap-stub.c} (97%) | ||
48 | 37 | ||
49 | 38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | The files tap-haiku.c and tap-aix.c are identical (except one line | ||
4 | of error message). We should avoid such code duplication, so replace | ||
5 | these by a generic tap-stub.c file instead. | ||
6 | |||
7 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
10 | --- | ||
11 | net/Makefile.objs | 15 +++++----- | ||
12 | net/tap-aix.c | 88 ------------------------------------------------------- | ||
13 | net/tap-haiku.c | 87 ------------------------------------------------------ | ||
14 | net/tap-stub.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
15 | 4 files changed, 95 insertions(+), 182 deletions(-) | ||
16 | delete mode 100644 net/tap-aix.c | ||
17 | delete mode 100644 net/tap-haiku.c | ||
18 | create mode 100644 net/tap-stub.c | ||
19 | |||
20 | diff --git a/net/Makefile.objs b/net/Makefile.objs | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/net/Makefile.objs | ||
23 | +++ b/net/Makefile.objs | ||
24 | @@ -XXX,XX +XXX,XX @@ common-obj-y += socket.o | ||
25 | common-obj-y += dump.o | ||
26 | common-obj-y += eth.o | ||
27 | common-obj-$(CONFIG_L2TPV3) += l2tpv3.o | ||
28 | -common-obj-$(CONFIG_POSIX) += tap.o vhost-user.o | ||
29 | -common-obj-$(CONFIG_LINUX) += tap-linux.o | ||
30 | -common-obj-$(CONFIG_WIN32) += tap-win32.o | ||
31 | -common-obj-$(CONFIG_BSD) += tap-bsd.o | ||
32 | -common-obj-$(CONFIG_SOLARIS) += tap-solaris.o | ||
33 | -common-obj-$(CONFIG_AIX) += tap-aix.o | ||
34 | -common-obj-$(CONFIG_HAIKU) += tap-haiku.o | ||
35 | +common-obj-$(CONFIG_POSIX) += vhost-user.o | ||
36 | common-obj-$(CONFIG_SLIRP) += slirp.o | ||
37 | common-obj-$(CONFIG_VDE) += vde.o | ||
38 | common-obj-$(CONFIG_NETMAP) += netmap.o | ||
39 | @@ -XXX,XX +XXX,XX @@ common-obj-y += colo-compare.o | ||
40 | common-obj-y += colo.o | ||
41 | common-obj-y += filter-rewriter.o | ||
42 | common-obj-y += filter-replay.o | ||
43 | + | ||
44 | +tap-obj-$(CONFIG_LINUX) = tap-linux.o | ||
45 | +tap-obj-$(CONFIG_BSD) = tap-bsd.o | ||
46 | +tap-obj-$(CONFIG_SOLARIS) = tap-solaris.o | ||
47 | +tap-obj-y ?= tap-stub.o | ||
48 | +common-obj-$(CONFIG_POSIX) += tap.o $(tap-obj-y) | ||
49 | +common-obj-$(CONFIG_WIN32) += tap-win32.o | ||
50 | diff --git a/net/tap-aix.c b/net/tap-aix.c | ||
51 | deleted file mode 100644 | ||
52 | index XXXXXXX..XXXXXXX | ||
53 | --- a/net/tap-aix.c | ||
54 | +++ /dev/null | ||
55 | @@ -XXX,XX +XXX,XX @@ | ||
56 | -/* | ||
57 | - * QEMU System Emulator | ||
58 | - * | ||
59 | - * Copyright (c) 2003-2008 Fabrice Bellard | ||
60 | - * | ||
61 | - * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
62 | - * of this software and associated documentation files (the "Software"), to deal | ||
63 | - * in the Software without restriction, including without limitation the rights | ||
64 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
65 | - * copies of the Software, and to permit persons to whom the Software is | ||
66 | - * furnished to do so, subject to the following conditions: | ||
67 | - * | ||
68 | - * The above copyright notice and this permission notice shall be included in | ||
69 | - * all copies or substantial portions of the Software. | ||
70 | - * | ||
71 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
72 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
73 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
74 | - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
75 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
76 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
77 | - * THE SOFTWARE. | ||
78 | - */ | ||
79 | - | ||
80 | -#include "qemu/osdep.h" | ||
81 | -#include "qapi/error.h" | ||
82 | -#include "tap_int.h" | ||
83 | - | ||
84 | -int tap_open(char *ifname, int ifname_size, int *vnet_hdr, | ||
85 | - int vnet_hdr_required, int mq_required, Error **errp) | ||
86 | -{ | ||
87 | - error_setg(errp, "no tap on AIX"); | ||
88 | - return -1; | ||
89 | -} | ||
90 | - | ||
91 | -void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) | ||
92 | -{ | ||
93 | -} | ||
94 | - | ||
95 | -int tap_probe_vnet_hdr(int fd) | ||
96 | -{ | ||
97 | - return 0; | ||
98 | -} | ||
99 | - | ||
100 | -int tap_probe_has_ufo(int fd) | ||
101 | -{ | ||
102 | - return 0; | ||
103 | -} | ||
104 | - | ||
105 | -int tap_probe_vnet_hdr_len(int fd, int len) | ||
106 | -{ | ||
107 | - return 0; | ||
108 | -} | ||
109 | - | ||
110 | -void tap_fd_set_vnet_hdr_len(int fd, int len) | ||
111 | -{ | ||
112 | -} | ||
113 | - | ||
114 | -int tap_fd_set_vnet_le(int fd, int is_le) | ||
115 | -{ | ||
116 | - return -EINVAL; | ||
117 | -} | ||
118 | - | ||
119 | -int tap_fd_set_vnet_be(int fd, int is_be) | ||
120 | -{ | ||
121 | - return -EINVAL; | ||
122 | -} | ||
123 | - | ||
124 | -void tap_fd_set_offload(int fd, int csum, int tso4, | ||
125 | - int tso6, int ecn, int ufo) | ||
126 | -{ | ||
127 | -} | ||
128 | - | ||
129 | -int tap_fd_enable(int fd) | ||
130 | -{ | ||
131 | - return -1; | ||
132 | -} | ||
133 | - | ||
134 | -int tap_fd_disable(int fd) | ||
135 | -{ | ||
136 | - return -1; | ||
137 | -} | ||
138 | - | ||
139 | -int tap_fd_get_ifname(int fd, char *ifname) | ||
140 | -{ | ||
141 | - return -1; | ||
142 | -} | ||
143 | - | ||
144 | diff --git a/net/tap-haiku.c b/net/tap-haiku.c | ||
145 | deleted file mode 100644 | ||
146 | index XXXXXXX..XXXXXXX | ||
147 | --- a/net/tap-haiku.c | ||
148 | +++ /dev/null | ||
149 | @@ -XXX,XX +XXX,XX @@ | ||
150 | -/* | ||
151 | - * QEMU System Emulator | ||
152 | - * | ||
153 | - * Copyright (c) 2003-2008 Fabrice Bellard | ||
154 | - * | ||
155 | - * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
156 | - * of this software and associated documentation files (the "Software"), to deal | ||
157 | - * in the Software without restriction, including without limitation the rights | ||
158 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
159 | - * copies of the Software, and to permit persons to whom the Software is | ||
160 | - * furnished to do so, subject to the following conditions: | ||
161 | - * | ||
162 | - * The above copyright notice and this permission notice shall be included in | ||
163 | - * all copies or substantial portions of the Software. | ||
164 | - * | ||
165 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
166 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
167 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
168 | - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
169 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
170 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
171 | - * THE SOFTWARE. | ||
172 | - */ | ||
173 | - | ||
174 | -#include "qemu/osdep.h" | ||
175 | -#include "qapi/error.h" | ||
176 | -#include "tap_int.h" | ||
177 | - | ||
178 | -int tap_open(char *ifname, int ifname_size, int *vnet_hdr, | ||
179 | - int vnet_hdr_required, int mq_required, Error **errp) | ||
180 | -{ | ||
181 | - error_setg(errp, "no tap on Haiku"); | ||
182 | - return -1; | ||
183 | -} | ||
184 | - | ||
185 | -void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) | ||
186 | -{ | ||
187 | -} | ||
188 | - | ||
189 | -int tap_probe_vnet_hdr(int fd) | ||
190 | -{ | ||
191 | - return 0; | ||
192 | -} | ||
193 | - | ||
194 | -int tap_probe_has_ufo(int fd) | ||
195 | -{ | ||
196 | - return 0; | ||
197 | -} | ||
198 | - | ||
199 | -int tap_probe_vnet_hdr_len(int fd, int len) | ||
200 | -{ | ||
201 | - return 0; | ||
202 | -} | ||
203 | - | ||
204 | -void tap_fd_set_vnet_hdr_len(int fd, int len) | ||
205 | -{ | ||
206 | -} | ||
207 | - | ||
208 | -int tap_fd_set_vnet_le(int fd, int is_le) | ||
209 | -{ | ||
210 | - return -EINVAL; | ||
211 | -} | ||
212 | - | ||
213 | -int tap_fd_set_vnet_be(int fd, int is_be) | ||
214 | -{ | ||
215 | - return -EINVAL; | ||
216 | -} | ||
217 | - | ||
218 | -void tap_fd_set_offload(int fd, int csum, int tso4, | ||
219 | - int tso6, int ecn, int ufo) | ||
220 | -{ | ||
221 | -} | ||
222 | - | ||
223 | -int tap_fd_enable(int fd) | ||
224 | -{ | ||
225 | - return -1; | ||
226 | -} | ||
227 | - | ||
228 | -int tap_fd_disable(int fd) | ||
229 | -{ | ||
230 | - return -1; | ||
231 | -} | ||
232 | - | ||
233 | -int tap_fd_get_ifname(int fd, char *ifname) | ||
234 | -{ | ||
235 | - return -1; | ||
236 | -} | ||
237 | diff --git a/net/tap-stub.c b/net/tap-stub.c | ||
238 | new file mode 100644 | ||
239 | index XXXXXXX..XXXXXXX | ||
240 | --- /dev/null | ||
241 | +++ b/net/tap-stub.c | ||
242 | @@ -XXX,XX +XXX,XX @@ | ||
243 | +/* | ||
244 | + * QEMU System Emulator | ||
245 | + * | ||
246 | + * Copyright (c) 2003-2008 Fabrice Bellard | ||
247 | + * | ||
248 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
249 | + * of this software and associated documentation files (the "Software"), to deal | ||
250 | + * in the Software without restriction, including without limitation the rights | ||
251 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
252 | + * copies of the Software, and to permit persons to whom the Software is | ||
253 | + * furnished to do so, subject to the following conditions: | ||
254 | + * | ||
255 | + * The above copyright notice and this permission notice shall be included in | ||
256 | + * all copies or substantial portions of the Software. | ||
257 | + * | ||
258 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
259 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
260 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
261 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
262 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
263 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
264 | + * THE SOFTWARE. | ||
265 | + */ | ||
266 | + | ||
267 | +#include "qemu/osdep.h" | ||
268 | +#include "qapi/error.h" | ||
269 | +#include "tap_int.h" | ||
270 | + | ||
271 | +int tap_open(char *ifname, int ifname_size, int *vnet_hdr, | ||
272 | + int vnet_hdr_required, int mq_required, Error **errp) | ||
273 | +{ | ||
274 | + error_setg(errp, "tap is not supported in this build"); | ||
275 | + return -1; | ||
276 | +} | ||
277 | + | ||
278 | +void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) | ||
279 | +{ | ||
280 | +} | ||
281 | + | ||
282 | +int tap_probe_vnet_hdr(int fd) | ||
283 | +{ | ||
284 | + return 0; | ||
285 | +} | ||
286 | + | ||
287 | +int tap_probe_has_ufo(int fd) | ||
288 | +{ | ||
289 | + return 0; | ||
290 | +} | ||
291 | + | ||
292 | +int tap_probe_vnet_hdr_len(int fd, int len) | ||
293 | +{ | ||
294 | + return 0; | ||
295 | +} | ||
296 | + | ||
297 | +void tap_fd_set_vnet_hdr_len(int fd, int len) | ||
298 | +{ | ||
299 | +} | ||
300 | + | ||
301 | +int tap_fd_set_vnet_le(int fd, int is_le) | ||
302 | +{ | ||
303 | + return -EINVAL; | ||
304 | +} | ||
305 | + | ||
306 | +int tap_fd_set_vnet_be(int fd, int is_be) | ||
307 | +{ | ||
308 | + return -EINVAL; | ||
309 | +} | ||
310 | + | ||
311 | +void tap_fd_set_offload(int fd, int csum, int tso4, | ||
312 | + int tso6, int ecn, int ufo) | ||
313 | +{ | ||
314 | +} | ||
315 | + | ||
316 | +int tap_fd_enable(int fd) | ||
317 | +{ | ||
318 | + return -1; | ||
319 | +} | ||
320 | + | ||
321 | +int tap_fd_disable(int fd) | ||
322 | +{ | ||
323 | + return -1; | ||
324 | +} | ||
325 | + | ||
326 | +int tap_fd_get_ifname(int fd, char *ifname) | ||
327 | +{ | ||
328 | + return -1; | ||
329 | +} | ||
330 | -- | ||
331 | 2.7.4 | ||
332 | |||
333 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | Network dumping should be done with "-object filter-dump" nowadays. | ||
4 | Using "-net dump" via the VLAN mechanism is considered as deprecated | ||
5 | and might be removed in a future release. So warn the users now | ||
6 | to inform them to user the filter-dump method instead. | ||
7 | |||
8 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
9 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
10 | --- | ||
11 | net/dump.c | 3 +++ | ||
12 | 1 file changed, 3 insertions(+) | ||
13 | |||
14 | diff --git a/net/dump.c b/net/dump.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/net/dump.c | ||
17 | +++ b/net/dump.c | ||
18 | @@ -XXX,XX +XXX,XX @@ int net_init_dump(const Netdev *netdev, const char *name, | ||
19 | |||
20 | assert(peer); | ||
21 | |||
22 | + error_report("'-net dump' is deprecated. " | ||
23 | + "Please use '-object filter-dump' instead."); | ||
24 | + | ||
25 | if (dump->has_file) { | ||
26 | file = dump->file; | ||
27 | } else { | ||
28 | -- | ||
29 | 2.7.4 | ||
30 | |||
31 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Yunjian Wang <wangyunjian@huawei.com> | ||
2 | 1 | ||
3 | The tx_bh or tx_timer will free in virtio_net_del_queue() function, when | ||
4 | removing virtio-net queues if the guest doesn't support multiqueue. But | ||
5 | it might be still referenced by virtio_net_set_status(), which needs to | ||
6 | be set NULL. And also the tx_waiting needs to be set zero to prevent | ||
7 | virtio_net_set_status() accessing tx_bh or tx_timer. | ||
8 | |||
9 | Cc: qemu-stable@nongnu.org | ||
10 | Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> | ||
11 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
12 | --- | ||
13 | hw/net/virtio-net.c | 3 +++ | ||
14 | 1 file changed, 3 insertions(+) | ||
15 | |||
16 | diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/net/virtio-net.c | ||
19 | +++ b/hw/net/virtio-net.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static void virtio_net_del_queue(VirtIONet *n, int index) | ||
21 | if (q->tx_timer) { | ||
22 | timer_del(q->tx_timer); | ||
23 | timer_free(q->tx_timer); | ||
24 | + q->tx_timer = NULL; | ||
25 | } else { | ||
26 | qemu_bh_delete(q->tx_bh); | ||
27 | + q->tx_bh = NULL; | ||
28 | } | ||
29 | + q->tx_waiting = 0; | ||
30 | virtio_del_queue(vdev, index * 2 + 1); | ||
31 | } | ||
32 | |||
33 | -- | ||
34 | 2.7.4 | ||
35 | |||
36 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | Because of previous patch's trace arguments over the limit | ||
4 | of UST backend, so I rewrite the patch. | ||
5 | |||
6 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
7 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
8 | --- | ||
9 | net/colo-compare.c | 33 ++++++++++++++++++++++----------- | ||
10 | net/trace-events | 3 +-- | ||
11 | 2 files changed, 23 insertions(+), 13 deletions(-) | ||
12 | |||
13 | diff --git a/net/colo-compare.c b/net/colo-compare.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/net/colo-compare.c | ||
16 | +++ b/net/colo-compare.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt) | ||
18 | } | ||
19 | |||
20 | if (res != 0 && trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) { | ||
21 | - trace_colo_compare_pkt_info_src(inet_ntoa(ppkt->ip->ip_src), | ||
22 | - ntohl(stcp->th_seq), | ||
23 | - ntohl(stcp->th_ack), | ||
24 | - res, stcp->th_flags, | ||
25 | - spkt->size); | ||
26 | - | ||
27 | - trace_colo_compare_pkt_info_dst(inet_ntoa(ppkt->ip->ip_dst), | ||
28 | - ntohl(ptcp->th_seq), | ||
29 | - ntohl(ptcp->th_ack), | ||
30 | - res, ptcp->th_flags, | ||
31 | - ppkt->size); | ||
32 | + char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20]; | ||
33 | + | ||
34 | + strcpy(pri_ip_src, inet_ntoa(ppkt->ip->ip_src)); | ||
35 | + strcpy(pri_ip_dst, inet_ntoa(ppkt->ip->ip_dst)); | ||
36 | + strcpy(sec_ip_src, inet_ntoa(spkt->ip->ip_src)); | ||
37 | + strcpy(sec_ip_dst, inet_ntoa(spkt->ip->ip_dst)); | ||
38 | + | ||
39 | + trace_colo_compare_ip_info(ppkt->size, pri_ip_src, | ||
40 | + pri_ip_dst, spkt->size, | ||
41 | + sec_ip_src, sec_ip_dst); | ||
42 | + | ||
43 | + trace_colo_compare_tcp_info("pri tcp packet", | ||
44 | + ntohl(ptcp->th_seq), | ||
45 | + ntohl(ptcp->th_ack), | ||
46 | + res, ptcp->th_flags, | ||
47 | + ppkt->size); | ||
48 | + | ||
49 | + trace_colo_compare_tcp_info("sec tcp packet", | ||
50 | + ntohl(stcp->th_seq), | ||
51 | + ntohl(stcp->th_ack), | ||
52 | + res, stcp->th_flags, | ||
53 | + spkt->size); | ||
54 | |||
55 | qemu_hexdump((char *)ppkt->data, stderr, | ||
56 | "colo-compare ppkt", ppkt->size); | ||
57 | diff --git a/net/trace-events b/net/trace-events | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/net/trace-events | ||
60 | +++ b/net/trace-events | ||
61 | @@ -XXX,XX +XXX,XX @@ colo_compare_icmp_miscompare(const char *sta, int size) ": %s = %d" | ||
62 | colo_compare_ip_info(int psize, const char *sta, const char *stb, int ssize, const char *stc, const char *std) "ppkt size = %d, ip_src = %s, ip_dst = %s, spkt size = %d, ip_src = %s, ip_dst = %s" | ||
63 | colo_old_packet_check_found(int64_t old_time) "%" PRId64 | ||
64 | colo_compare_miscompare(void) "" | ||
65 | -colo_compare_pkt_info_src(const char *src, uint32_t sseq, uint32_t sack, int res, uint32_t sflag, int ssize) "src/dst: %s s: seq/ack=%u/%u res=%d flags=%x spkt_size: %d\n" | ||
66 | -colo_compare_pkt_info_dst(const char *dst, uint32_t dseq, uint32_t dack, int res, uint32_t dflag, int dsize) "src/dst: %s d: seq/ack=%u/%u res=%d flags=%x dpkt_size: %d\n" | ||
67 | +colo_compare_tcp_info(const char *pkt, uint32_t seq, uint32_t ack, int res, uint32_t flag, int size) "side: %s seq/ack= %u/%u res= %d flags= %x pkt_size: %d\n" | ||
68 | |||
69 | # net/filter-rewriter.c | ||
70 | colo_filter_rewriter_debug(void) "" | ||
71 | -- | ||
72 | 2.7.4 | ||
73 | |||
74 | diff view generated by jsdifflib |
1 | From: Sameeh Jubran <sameeh@daynix.com> | 1 | From: Prasad J Pandit <pjp@fedoraproject.org> |
---|---|---|---|
2 | 2 | ||
3 | This commit fixes a bug which causes the guest to hang. The bug was | 3 | While receiving packets via e1000e_write_packet_to_guest() routine, |
4 | observed upon a "receive overrun" (bit #6 of the ICR register) | 4 | 'desc_offset' is advanced only when RX descriptor is processed. And |
5 | interrupt which could be triggered post migration in a heavy traffic | 5 | RX descriptor is not processed if it has NULL buffer address. |
6 | environment. Even though the "receive overrun" bit (#6) is masked out | 6 | This may lead to an infinite loop condition. Increament 'desc_offset' |
7 | by the IMS register (refer to the log below) the driver still receives | 7 | to process next descriptor in the ring to avoid infinite loop. |
8 | an interrupt as the "receive overrun" bit (#6) causes the "Other" - | ||
9 | bit #24 of the ICR register - bit to be set as documented below. The | ||
10 | driver handles the interrupt and clears the "Other" bit (#24) but | ||
11 | doesn't clear the "receive overrun" bit (#6) which leads to an | ||
12 | infinite loop. Apparently the Windows driver expects that the "receive | ||
13 | overrun" bit and other ones - documented below - to be cleared when | ||
14 | the "Other" bit (#24) is cleared. | ||
15 | 8 | ||
16 | So to sum that up: | 9 | Reported-by: Cheol-woo Myung <330cjfdn@gmail.com> |
17 | 1. Bit #6 of the ICR register is set by heavy traffic | 10 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> |
18 | 2. As a results of setting bit #6, bit #24 is set | ||
19 | 3. The driver receives an interrupt for bit 24 (it doesn't receieve an | ||
20 | interrupt for bit #6 as it is masked out by IMS) | ||
21 | 4. The driver handles and clears the interrupt of bit #24 | ||
22 | 5. Bit #6 is still set. | ||
23 | 6. 2 happens all over again | ||
24 | |||
25 | The Interrupt Cause Read - ICR register: | ||
26 | |||
27 | The ICR has the "Other" bit - bit #24 - that is set when one or more | ||
28 | of the following ICR register's bits are set: | ||
29 | |||
30 | LSC - bit #2, RXO - bit #6, MDAC - bit #9, SRPD - bit #16, ACK - bit | ||
31 | #17, MNG - bit #18 | ||
32 | |||
33 | This bug can occur with any of these bits depending on the driver's | ||
34 | behaviour and the way it configures the device. However, trying to | ||
35 | reproduce it with any bit other than RX0 is challenging and came to | ||
36 | failure as the drivers don't implement most of these bits, trying to | ||
37 | reproduce it with LSC (Link Status Change - bit #2) bit didn't succeed | ||
38 | too as it seems that Windows handles this bit differently. | ||
39 | |||
40 | Log sample of the storm: | ||
41 | |||
42 | 27563@1494850819.411877:e1000e_irq_pending_interrupts ICR PENDING: 0x1000000 (ICR: 0x815000c2, IMS: 0x1a00004) | ||
43 | 27563@1494850819.411900:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004) | ||
44 | 27563@1494850819.411915:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004) | ||
45 | 27563@1494850819.412380:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004) | ||
46 | 27563@1494850819.412395:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004) | ||
47 | 27563@1494850819.412436:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004) | ||
48 | 27563@1494850819.412441:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004) | ||
49 | 27563@1494850819.412998:e1000e_irq_pending_interrupts ICR PENDING: 0x1000000 (ICR: 0x815000c2, IMS: 0x1a00004) | ||
50 | |||
51 | * This bug behaviour wasn't observed with the Linux driver. | ||
52 | |||
53 | This commit solves: | ||
54 | https://bugzilla.redhat.com/show_bug.cgi?id=1447935 | ||
55 | https://bugzilla.redhat.com/show_bug.cgi?id=1449490 | ||
56 | |||
57 | Cc: qemu-stable@nongnu.org | ||
58 | Signed-off-by: Sameeh Jubran <sjubran@redhat.com> | ||
59 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 11 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
60 | --- | 12 | --- |
61 | hw/net/e1000e_core.c | 10 ++++++++-- | 13 | hw/net/e1000e_core.c | 8 ++++---- |
62 | 1 file changed, 8 insertions(+), 2 deletions(-) | 14 | 1 file changed, 4 insertions(+), 4 deletions(-) |
63 | 15 | ||
64 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c | 16 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c |
65 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
66 | --- a/hw/net/e1000e_core.c | 18 | --- a/hw/net/e1000e_core.c |
67 | +++ b/hw/net/e1000e_core.c | 19 | +++ b/hw/net/e1000e_core.c |
68 | @@ -XXX,XX +XXX,XX @@ e1000e_set_ics(E1000ECore *core, int index, uint32_t val) | 20 | @@ -XXX,XX +XXX,XX @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt, |
69 | static void | 21 | (const char *) &fcs_pad, e1000x_fcs_len(core->mac)); |
70 | e1000e_set_icr(E1000ECore *core, int index, uint32_t val) | 22 | } |
71 | { | 23 | } |
72 | + uint32_t icr = 0; | 24 | - desc_offset += desc_size; |
73 | if ((core->mac[ICR] & E1000_ICR_ASSERTED) && | 25 | - if (desc_offset >= total_size) { |
74 | (core->mac[CTRL_EXT] & E1000_CTRL_EXT_IAME)) { | 26 | - is_last = true; |
75 | trace_e1000e_irq_icr_process_iame(); | 27 | - } |
76 | e1000e_clear_ims_bits(core, core->mac[IAM]); | 28 | } else { /* as per intel docs; skip descriptors with null buf addr */ |
77 | } | 29 | trace_e1000e_rx_null_descriptor(); |
78 | 30 | } | |
79 | - trace_e1000e_irq_icr_write(val, core->mac[ICR], core->mac[ICR] & ~val); | 31 | + desc_offset += desc_size; |
80 | - core->mac[ICR] &= ~val; | 32 | + if (desc_offset >= total_size) { |
81 | + icr = core->mac[ICR] & ~val; | 33 | + is_last = true; |
82 | + /* Windows driver expects that the "receive overrun" bit and other | 34 | + } |
83 | + * ones to be cleared when the "Other" bit (#24) is cleared. | 35 | |
84 | + */ | 36 | e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL, |
85 | + icr = (val & E1000_ICR_OTHER) ? (icr & ~E1000_ICR_OTHER_CAUSES) : icr; | 37 | rss_info, do_ps ? ps_hdr_len : 0, &bastate.written); |
86 | + trace_e1000e_irq_icr_write(val, core->mac[ICR], icr); | ||
87 | + core->mac[ICR] = icr; | ||
88 | e1000e_update_interrupt_state(core); | ||
89 | } | ||
90 | |||
91 | -- | 38 | -- |
92 | 2.7.4 | 39 | 2.7.4 |
93 | 40 | ||
94 | 41 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Paolo Bonzini <pbonzini@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | The netdev_add and netdev_del commands should be used nowadays instead. | 3 | "netdev_add help" is causing QEMU to exit because the code that |
4 | invokes show_netdevs is shared between CLI and HMP processing. | ||
5 | Move the check to the callers so that exit(0) remains only | ||
6 | in the CLI flow. | ||
4 | 7 | ||
5 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 8 | "netdev_add help" is not fixed by this patch; that is left for |
9 | later work. | ||
10 | |||
11 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | ||
6 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 12 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
7 | --- | 13 | --- |
8 | hmp-commands.hx | 8 ++++---- | 14 | include/net/net.h | 1 + |
9 | net/net.c | 13 +++++++++++++ | 15 | monitor/hmp-cmds.c | 6 +++++ |
10 | 2 files changed, 17 insertions(+), 4 deletions(-) | 16 | net/net.c | 68 +++++++++++++++++++++++++++--------------------------- |
17 | 3 files changed, 41 insertions(+), 34 deletions(-) | ||
11 | 18 | ||
12 | diff --git a/hmp-commands.hx b/hmp-commands.hx | 19 | diff --git a/include/net/net.h b/include/net/net.h |
13 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hmp-commands.hx | 21 | --- a/include/net/net.h |
15 | +++ b/hmp-commands.hx | 22 | +++ b/include/net/net.h |
16 | @@ -XXX,XX +XXX,XX @@ ETEXI | 23 | @@ -XXX,XX +XXX,XX @@ extern const char *host_net_devices[]; |
17 | .name = "host_net_add", | 24 | |
18 | .args_type = "device:s,opts:s?", | 25 | /* from net.c */ |
19 | .params = "tap|user|socket|vde|netmap|bridge|vhost-user|dump [options]", | 26 | int net_client_parse(QemuOptsList *opts_list, const char *str); |
20 | - .help = "add host VLAN client", | 27 | +void show_netdevs(void); |
21 | + .help = "add host VLAN client (deprecated, use netdev_add instead)", | 28 | int net_init_clients(Error **errp); |
22 | .cmd = hmp_host_net_add, | 29 | void net_check_clients(void); |
23 | .command_completion = host_net_add_completion, | 30 | void net_cleanup(void); |
24 | }, | 31 | diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c |
25 | @@ -XXX,XX +XXX,XX @@ ETEXI | 32 | index XXXXXXX..XXXXXXX 100644 |
26 | STEXI | 33 | --- a/monitor/hmp-cmds.c |
27 | @item host_net_add | 34 | +++ b/monitor/hmp-cmds.c |
28 | @findex host_net_add | 35 | @@ -XXX,XX +XXX,XX @@ |
29 | -Add host VLAN client. | 36 | #include "qemu/option.h" |
30 | +Add host VLAN client. Deprecated, please use @code{netdev_add} instead. | 37 | #include "qemu/timer.h" |
31 | ETEXI | 38 | #include "qemu/sockets.h" |
32 | 39 | +#include "qemu/help_option.h" | |
33 | { | 40 | #include "monitor/monitor-internal.h" |
34 | .name = "host_net_remove", | 41 | #include "qapi/error.h" |
35 | .args_type = "vlan_id:i,device:s", | 42 | #include "qapi/clone-visitor.h" |
36 | .params = "vlan_id name", | 43 | @@ -XXX,XX +XXX,XX @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict) |
37 | - .help = "remove host VLAN client", | 44 | { |
38 | + .help = "remove host VLAN client (deprecated, use netdev_del instead)", | 45 | Error *err = NULL; |
39 | .cmd = hmp_host_net_remove, | 46 | QemuOpts *opts; |
40 | .command_completion = host_net_remove_completion, | 47 | + const char *type = qdict_get_try_str(qdict, "type"); |
41 | }, | 48 | |
42 | @@ -XXX,XX +XXX,XX @@ ETEXI | 49 | + if (type && is_help_option(type)) { |
43 | STEXI | 50 | + show_netdevs(); |
44 | @item host_net_remove | 51 | + return; |
45 | @findex host_net_remove | 52 | + } |
46 | -Remove host VLAN client. | 53 | opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err); |
47 | +Remove host VLAN client. Deprecated, please use @code{netdev_del} instead. | 54 | if (err) { |
48 | ETEXI | 55 | goto out; |
49 | |||
50 | { | ||
51 | diff --git a/net/net.c b/net/net.c | 56 | diff --git a/net/net.c b/net/net.c |
52 | index XXXXXXX..XXXXXXX 100644 | 57 | index XXXXXXX..XXXXXXX 100644 |
53 | --- a/net/net.c | 58 | --- a/net/net.c |
54 | +++ b/net/net.c | 59 | +++ b/net/net.c |
55 | @@ -XXX,XX +XXX,XX @@ | 60 | @@ -XXX,XX +XXX,XX @@ |
56 | #include "qapi-visit.h" | 61 | #include "qemu/config-file.h" |
57 | #include "qapi/opts-visitor.h" | 62 | #include "qemu/ctype.h" |
58 | #include "sysemu/sysemu.h" | 63 | #include "qemu/iov.h" |
59 | +#include "sysemu/qtest.h" | 64 | +#include "qemu/qemu-print.h" |
60 | #include "net/filter.h" | 65 | #include "qemu/main-loop.h" |
61 | #include "qapi/string-output-visitor.h" | 66 | #include "qemu/option.h" |
62 | 67 | #include "qapi/error.h" | |
63 | @@ -XXX,XX +XXX,XX @@ void hmp_host_net_add(Monitor *mon, const QDict *qdict) | 68 | @@ -XXX,XX +XXX,XX @@ static int net_client_init1(const Netdev *netdev, bool is_netdev, Error **errp) |
64 | const char *opts_str = qdict_get_try_str(qdict, "opts"); | 69 | return 0; |
65 | Error *local_err = NULL; | 70 | } |
66 | QemuOpts *opts; | 71 | |
67 | + static bool warned; | 72 | -static void show_netdevs(void) |
73 | +void show_netdevs(void) | ||
74 | { | ||
75 | int idx; | ||
76 | const char *available_netdevs[] = { | ||
77 | @@ -XXX,XX +XXX,XX @@ static void show_netdevs(void) | ||
78 | #endif | ||
79 | }; | ||
80 | |||
81 | - printf("Available netdev backend types:\n"); | ||
82 | + qemu_printf("Available netdev backend types:\n"); | ||
83 | for (idx = 0; idx < ARRAY_SIZE(available_netdevs); idx++) { | ||
84 | - puts(available_netdevs[idx]); | ||
85 | + qemu_printf("%s\n", available_netdevs[idx]); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | @@ -XXX,XX +XXX,XX @@ static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp) | ||
90 | int ret = -1; | ||
91 | Visitor *v = opts_visitor_new(opts); | ||
92 | |||
93 | - const char *type = qemu_opt_get(opts, "type"); | ||
94 | - | ||
95 | - if (is_netdev && type && is_help_option(type)) { | ||
96 | - show_netdevs(); | ||
97 | - exit(0); | ||
98 | - } else { | ||
99 | - /* Parse convenience option format ip6-net=fec0::0[/64] */ | ||
100 | - const char *ip6_net = qemu_opt_get(opts, "ipv6-net"); | ||
101 | + /* Parse convenience option format ip6-net=fec0::0[/64] */ | ||
102 | + const char *ip6_net = qemu_opt_get(opts, "ipv6-net"); | ||
103 | |||
104 | - if (ip6_net) { | ||
105 | - char *prefix_addr; | ||
106 | - unsigned long prefix_len = 64; /* Default 64bit prefix length. */ | ||
107 | + if (ip6_net) { | ||
108 | + char *prefix_addr; | ||
109 | + unsigned long prefix_len = 64; /* Default 64bit prefix length. */ | ||
110 | |||
111 | - substrings = g_strsplit(ip6_net, "/", 2); | ||
112 | - if (!substrings || !substrings[0]) { | ||
113 | - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "ipv6-net", | ||
114 | - "a valid IPv6 prefix"); | ||
115 | - goto out; | ||
116 | - } | ||
117 | + substrings = g_strsplit(ip6_net, "/", 2); | ||
118 | + if (!substrings || !substrings[0]) { | ||
119 | + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "ipv6-net", | ||
120 | + "a valid IPv6 prefix"); | ||
121 | + goto out; | ||
122 | + } | ||
123 | |||
124 | - prefix_addr = substrings[0]; | ||
125 | + prefix_addr = substrings[0]; | ||
126 | |||
127 | - /* Handle user-specified prefix length. */ | ||
128 | - if (substrings[1] && | ||
129 | - qemu_strtoul(substrings[1], NULL, 10, &prefix_len)) | ||
130 | - { | ||
131 | - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, | ||
132 | - "ipv6-prefixlen", "a number"); | ||
133 | - goto out; | ||
134 | - } | ||
135 | - | ||
136 | - qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort); | ||
137 | - qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len, | ||
138 | - &error_abort); | ||
139 | - qemu_opt_unset(opts, "ipv6-net"); | ||
140 | + /* Handle user-specified prefix length. */ | ||
141 | + if (substrings[1] && | ||
142 | + qemu_strtoul(substrings[1], NULL, 10, &prefix_len)) | ||
143 | + { | ||
144 | + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, | ||
145 | + "ipv6-prefixlen", "a number"); | ||
146 | + goto out; | ||
147 | } | ||
68 | + | 148 | + |
69 | + if (!warned && !qtest_enabled()) { | 149 | + qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort); |
70 | + error_report("host_net_add is deprecated, use netdev_add instead"); | 150 | + qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len, |
71 | + warned = true; | 151 | + &error_abort); |
152 | + qemu_opt_unset(opts, "ipv6-net"); | ||
153 | } | ||
154 | |||
155 | /* Create an ID for -net if the user did not specify one */ | ||
156 | @@ -XXX,XX +XXX,XX @@ static int net_init_client(void *dummy, QemuOpts *opts, Error **errp) | ||
157 | |||
158 | static int net_init_netdev(void *dummy, QemuOpts *opts, Error **errp) | ||
159 | { | ||
160 | + const char *type = qemu_opt_get(opts, "type"); | ||
161 | + | ||
162 | + if (type && is_help_option(type)) { | ||
163 | + show_netdevs(); | ||
164 | + exit(0); | ||
72 | + } | 165 | + } |
73 | 166 | return net_client_init(opts, true, errp); | |
74 | if (!net_host_check_device(device)) { | 167 | } |
75 | monitor_printf(mon, "invalid host network device %s\n", device); | 168 | |
76 | @@ -XXX,XX +XXX,XX @@ void hmp_host_net_remove(Monitor *mon, const QDict *qdict) | ||
77 | NetClientState *nc; | ||
78 | int vlan_id = qdict_get_int(qdict, "vlan_id"); | ||
79 | const char *device = qdict_get_str(qdict, "device"); | ||
80 | + static bool warned; | ||
81 | + | ||
82 | + if (!warned && !qtest_enabled()) { | ||
83 | + error_report("host_net_remove is deprecated, use netdev_del instead"); | ||
84 | + warned = true; | ||
85 | + } | ||
86 | |||
87 | nc = net_hub_find_client_by_name(vlan_id, device); | ||
88 | if (!nc) { | ||
89 | -- | 169 | -- |
90 | 2.7.4 | 170 | 2.7.4 |
91 | 171 | ||
92 | 172 | diff view generated by jsdifflib |
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 1 | From: Yuri Benditovich <yuri.benditovich@daynix.com> |
---|---|---|---|
2 | 2 | ||
3 | Because filter_mirror_receive_iov() and filter_redirector_receive_iov() | 3 | https://bugzilla.redhat.com/show_bug.cgi?id=1829272 |
4 | both use the filter_mirror_send() to send packet, so I change | 4 | When deleting queue pair, purge pending RX packets if any. |
5 | filter_mirror_send() to filter_send() that looks more common. | 5 | Example of problematic flow: |
6 | And fix some codestyle. | 6 | 1. Bring up q35 VM with tap (vhost off) and virtio-net or e1000e |
7 | 2. Run ping flood to the VM NIC ( 1 ms interval) | ||
8 | 3. Hot unplug the NIC device (device_del) | ||
9 | During unplug process one or more packets come, the NIC | ||
10 | can't receive, tap disables read_poll | ||
11 | 4. Hot plug the device (device_add) with the same netdev | ||
12 | The tap stays with read_poll disabled and does not receive | ||
13 | any packets anymore (tap_send never triggered) | ||
7 | 14 | ||
8 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 15 | Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> |
9 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 16 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
10 | --- | 17 | --- |
11 | net/filter-mirror.c | 29 ++++++++++++++++------------- | 18 | net/net.c | 12 ++++++++---- |
12 | 1 file changed, 16 insertions(+), 13 deletions(-) | 19 | 1 file changed, 8 insertions(+), 4 deletions(-) |
13 | 20 | ||
14 | diff --git a/net/filter-mirror.c b/net/filter-mirror.c | 21 | diff --git a/net/net.c b/net/net.c |
15 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/net/filter-mirror.c | 23 | --- a/net/net.c |
17 | +++ b/net/filter-mirror.c | 24 | +++ b/net/net.c |
18 | @@ -XXX,XX +XXX,XX @@ typedef struct MirrorState { | 25 | @@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic) |
19 | SocketReadState rs; | 26 | |
20 | } MirrorState; | 27 | qemu_macaddr_set_free(&nic->conf->macaddr); |
21 | 28 | ||
22 | -static int filter_mirror_send(CharBackend *chr_out, | 29 | - /* If this is a peer NIC and peer has already been deleted, free it now. */ |
23 | - const struct iovec *iov, | 30 | - if (nic->peer_deleted) { |
24 | - int iovcnt) | 31 | - for (i = 0; i < queues; i++) { |
25 | +static int filter_send(CharBackend *chr_out, | 32 | - qemu_free_net_client(qemu_get_subqueue(nic, i)->peer); |
26 | + const struct iovec *iov, | 33 | + for (i = 0; i < queues; i++) { |
27 | + int iovcnt) | 34 | + NetClientState *nc = qemu_get_subqueue(nic, i); |
28 | { | 35 | + /* If this is a peer NIC and peer has already been deleted, free it now. */ |
29 | int ret = 0; | 36 | + if (nic->peer_deleted) { |
30 | ssize_t size = 0; | 37 | + qemu_free_net_client(nc->peer); |
31 | @@ -XXX,XX +XXX,XX @@ static ssize_t filter_mirror_receive_iov(NetFilterState *nf, | 38 | + } else if (nc->peer) { |
32 | MirrorState *s = FILTER_MIRROR(nf); | 39 | + /* if there are RX packets pending, complete them */ |
33 | int ret; | 40 | + qemu_purge_queued_packets(nc->peer); |
34 | 41 | } | |
35 | - ret = filter_mirror_send(&s->chr_out, iov, iovcnt); | ||
36 | + ret = filter_send(&s->chr_out, iov, iovcnt); | ||
37 | if (ret) { | ||
38 | - error_report("filter_mirror_send failed(%s)", strerror(-ret)); | ||
39 | + error_report("filter mirror send failed(%s)", strerror(-ret)); | ||
40 | } | 42 | } |
41 | |||
42 | /* | ||
43 | @@ -XXX,XX +XXX,XX @@ static ssize_t filter_redirector_receive_iov(NetFilterState *nf, | ||
44 | int ret; | ||
45 | |||
46 | if (qemu_chr_fe_get_driver(&s->chr_out)) { | ||
47 | - ret = filter_mirror_send(&s->chr_out, iov, iovcnt); | ||
48 | + ret = filter_send(&s->chr_out, iov, iovcnt); | ||
49 | if (ret) { | ||
50 | - error_report("filter_mirror_send failed(%s)", strerror(-ret)); | ||
51 | + error_report("filter redirector send failed(%s)", strerror(-ret)); | ||
52 | } | ||
53 | return iov_size(iov, iovcnt); | ||
54 | } else { | ||
55 | @@ -XXX,XX +XXX,XX @@ static char *filter_redirector_get_indev(Object *obj, Error **errp) | ||
56 | return g_strdup(s->indev); | ||
57 | } | ||
58 | |||
59 | -static void | ||
60 | -filter_redirector_set_indev(Object *obj, const char *value, Error **errp) | ||
61 | +static void filter_redirector_set_indev(Object *obj, | ||
62 | + const char *value, | ||
63 | + Error **errp) | ||
64 | { | ||
65 | MirrorState *s = FILTER_REDIRECTOR(obj); | ||
66 | |||
67 | @@ -XXX,XX +XXX,XX @@ static char *filter_mirror_get_outdev(Object *obj, Error **errp) | ||
68 | return g_strdup(s->outdev); | ||
69 | } | ||
70 | |||
71 | -static void | ||
72 | -filter_mirror_set_outdev(Object *obj, const char *value, Error **errp) | ||
73 | +static void filter_mirror_set_outdev(Object *obj, | ||
74 | + const char *value, | ||
75 | + Error **errp) | ||
76 | { | ||
77 | MirrorState *s = FILTER_MIRROR(obj); | ||
78 | |||
79 | @@ -XXX,XX +XXX,XX @@ static char *filter_redirector_get_outdev(Object *obj, Error **errp) | ||
80 | return g_strdup(s->outdev); | ||
81 | } | ||
82 | |||
83 | -static void | ||
84 | -filter_redirector_set_outdev(Object *obj, const char *value, Error **errp) | ||
85 | +static void filter_redirector_set_outdev(Object *obj, | ||
86 | + const char *value, | ||
87 | + Error **errp) | ||
88 | { | ||
89 | MirrorState *s = FILTER_REDIRECTOR(obj); | ||
90 | 43 | ||
91 | -- | 44 | -- |
92 | 2.7.4 | 45 | 2.7.4 |
93 | 46 | ||
94 | 47 | diff view generated by jsdifflib |
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 1 | From: yuanjungong <ruc_gongyuanjun@163.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 3 | Close fd before returning. |
4 | |||
5 | Buglink: https://bugs.launchpad.net/qemu/+bug/1904486 | ||
6 | |||
7 | Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 9 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
5 | --- | 10 | --- |
6 | qemu-options.hx | 2 +- | 11 | net/tap.c | 2 ++ |
7 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 2 insertions(+) |
8 | 13 | ||
9 | diff --git a/qemu-options.hx b/qemu-options.hx | 14 | diff --git a/net/tap.c b/net/tap.c |
10 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/qemu-options.hx | 16 | --- a/net/tap.c |
12 | +++ b/qemu-options.hx | 17 | +++ b/net/tap.c |
13 | @@ -XXX,XX +XXX,XX @@ Create a filter-redirector we need to differ outdev id from indev id, id can not | 18 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, |
14 | be the same. we can just use indev or outdev, but at least one of indev or outdev | 19 | if (ret < 0) { |
15 | need to be specified. | 20 | error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d", |
16 | 21 | name, fd); | |
17 | -@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},rewriter-mode=@var{mode}[,queue=@var{all|rx|tx}] | 22 | + close(fd); |
18 | +@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid}[,queue=@var{all|rx|tx}] | 23 | return -1; |
19 | 24 | } | |
20 | Filter-rewriter is a part of COLO project.It will rewrite tcp packet to | 25 | |
21 | secondary from primary to keep secondary tcp connection,and rewrite | 26 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, |
27 | vhostfdname, vnet_hdr, fd, &err); | ||
28 | if (err) { | ||
29 | error_propagate(errp, err); | ||
30 | + close(fd); | ||
31 | return -1; | ||
32 | } | ||
33 | } else if (tap->has_fds) { | ||
22 | -- | 34 | -- |
23 | 2.7.4 | 35 | 2.7.4 |
24 | 36 | ||
25 | 37 | diff view generated by jsdifflib |
1 | From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 1 | From: Keqian Zhu <zhukeqian1@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | The s->outdev have checked in filter_mirror_set_outdev(). | 3 | Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts) |
4 | 4 | Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> | |
5 | Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | ||
6 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 5 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
7 | --- | 6 | --- |
8 | net/filter-mirror.c | 6 ------ | 7 | net/tap.c | 3 ++- |
9 | 1 file changed, 6 deletions(-) | 8 | 1 file changed, 2 insertions(+), 1 deletion(-) |
10 | 9 | ||
11 | diff --git a/net/filter-mirror.c b/net/filter-mirror.c | 10 | diff --git a/net/tap.c b/net/tap.c |
12 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/net/filter-mirror.c | 12 | --- a/net/tap.c |
14 | +++ b/net/filter-mirror.c | 13 | +++ b/net/tap.c |
15 | @@ -XXX,XX +XXX,XX @@ static void filter_mirror_setup(NetFilterState *nf, Error **errp) | 14 | @@ -XXX,XX +XXX,XX @@ free_fail: |
16 | MirrorState *s = FILTER_MIRROR(nf); | 15 | script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT); |
17 | Chardev *chr; | 16 | } |
18 | 17 | if (!downscript) { | |
19 | - if (!s->outdev) { | 18 | - downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT); |
20 | - error_setg(errp, "filter mirror needs 'outdev' " | 19 | + downscript = default_downscript = |
21 | - "property set"); | 20 | + get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT); |
22 | - return; | 21 | } |
23 | - } | 22 | |
24 | - | 23 | if (tap->has_ifname) { |
25 | chr = qemu_chr_find(s->outdev); | ||
26 | if (chr == NULL) { | ||
27 | error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, | ||
28 | -- | 24 | -- |
29 | 2.7.4 | 25 | 2.7.4 |
30 | 26 | ||
31 | 27 | diff view generated by jsdifflib |