1
The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06:
1
The following changes since commit 48033ad678ae2def43bf0d543a2c4c3d2a93feaf:
2
2
3
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20201123.0' into staging (2020-11-23 18:51:13 +0000)
3
Merge remote-tracking branch 'remotes/vsementsov/tags/pull-nbd-2022-02-09-v2' into staging (2022-02-12 22:04:07 +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 9925990d01a92564af55f6f69d0f5f59b47609b1:
9
for you to fetch changes up to 9d6267b240c114d1a3cd314a08fd6e1339d34b83:
10
10
11
net: Use correct default-path macro for downscript (2020-11-24 10:40:17 +0800)
11
net/eth: Don't consider ESP to be an IPv6 option header (2022-02-14 11:50:44 +0800)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
14
15
----------------------------------------------------------------
15
----------------------------------------------------------------
16
Keqian Zhu (1):
16
Nick Hudson (1):
17
net: Use correct default-path macro for downscript
17
hw/net: e1000e: Clear ICR on read when using non MSI-X interrupts
18
18
19
Paolo Bonzini (1):
19
Peter Foley (2):
20
net: do not exit on "netdev_add help" monitor command
20
net/tap: Set return code on failure
21
net: Fix uninitialized data usage
21
22
22
Prasad J Pandit (1):
23
Philippe Mathieu-Daudé (1):
23
hw/net/e1000e: advance desc_offset in case of null descriptor
24
hw/net/vmxnet3: Log guest-triggerable errors using LOG_GUEST_ERROR
24
25
25
Yuri Benditovich (1):
26
Rao Lei (1):
26
net: purge queued rx packets on queue deletion
27
net/filter: Optimize filter_send to coroutine
27
28
28
yuanjungong (1):
29
Thomas Jansen (1):
29
tap: fix a memory leak
30
net/eth: Don't consider ESP to be an IPv6 option header
30
31
31
hw/net/e1000e_core.c | 8 +++---
32
Zhang Chen (2):
32
include/net/net.h | 1 +
33
net/colo-compare.c: Optimize compare order for performance
33
monitor/hmp-cmds.c | 6 ++++
34
net/colo-compare.c: Update the default value comments
34
net/net.c | 80 +++++++++++++++++++++++++++-------------------------
35
35
net/tap.c | 5 +++-
36
hw/net/e1000e_core.c | 5 ++++
36
5 files changed, 57 insertions(+), 43 deletions(-)
37
hw/net/trace-events | 1 +
38
hw/net/vmxnet3.c | 4 +++-
39
net/colo-compare.c | 28 +++++++++++-----------
40
net/eth.c | 1 -
41
net/filter-mirror.c | 66 +++++++++++++++++++++++++++++++++++++++++-----------
42
net/tap-linux.c | 1 +
43
net/tap.c | 1 +
44
8 files changed, 78 insertions(+), 29 deletions(-)
37
45
38
46
diff view generated by jsdifflib
1
From: Keqian Zhu <zhukeqian1@huawei.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts)
3
The "Interrupt Cause" register (VMXNET3_REG_ICR) is read-only.
4
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
4
Write accesses are ignored. Log them with as LOG_GUEST_ERROR
5
instead of aborting:
6
7
[R +0.239743] writeq 0xe0002031 0x46291a5a55460800
8
ERROR:hw/net/vmxnet3.c:1819:vmxnet3_io_bar1_write: code should not be reached
9
Thread 1 "qemu-system-i38" received signal SIGABRT, Aborted.
10
(gdb) bt
11
#3 0x74c397d3 in __GI_abort () at abort.c:79
12
#4 0x76d3cd4c in g_assertion_message (domain=<optimized out>, file=<optimized out>, line=<optimized out>, func=<optimized out>, message=<optimized out>) at ../glib/gtestutils.c:3223
13
#5 0x76d9d45f in g_assertion_message_expr
14
(domain=0x0, file=0x59fc2e53 "hw/net/vmxnet3.c", line=1819, func=0x59fc11e0 <__func__.vmxnet3_io_bar1_write> "vmxnet3_io_bar1_write", expr=<optimized out>)
15
at ../glib/gtestutils.c:3249
16
#6 0x57e80a3a in vmxnet3_io_bar1_write (opaque=0x62814100, addr=56, val=70, size=4) at hw/net/vmxnet3.c:1819
17
#7 0x58c2d894 in memory_region_write_accessor (mr=0x62816b90, addr=56, value=0x7fff9450, size=4, shift=0, mask=4294967295, attrs=...) at softmmu/memory.c:492
18
#8 0x58c2d1d2 in access_with_adjusted_size (addr=56, value=0x7fff9450, size=1, access_size_min=4, access_size_max=4, access_fn=
19
0x58c2d290 <memory_region_write_accessor>, mr=0x62816b90, attrs=...) at softmmu/memory.c:554
20
#9 0x58c2bae7 in memory_region_dispatch_write (mr=0x62816b90, addr=56, data=70, op=MO_8, attrs=...) at softmmu/memory.c:1504
21
#10 0x58bfd034 in flatview_write_continue (fv=0x606000181700, addr=0xe0002038, attrs=..., ptr=0x7fffb9e0, len=1, addr1=56, l=1, mr=0x62816b90)
22
at softmmu/physmem.c:2782
23
#11 0x58beba00 in flatview_write (fv=0x606000181700, addr=0xe0002031, attrs=..., buf=0x7fffb9e0, len=8) at softmmu/physmem.c:2822
24
#12 0x58beb589 in address_space_write (as=0x608000015f20, addr=0xe0002031, attrs=..., buf=0x7fffb9e0, len=8) at softmmu/physmem.c:2914
25
26
Reported-by: Dike <dike199774@qq.com>
27
Reported-by: Duhao <504224090@qq.com>
28
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2032932
29
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Signed-off-by: Jason Wang <jasowang@redhat.com>
30
Signed-off-by: Jason Wang <jasowang@redhat.com>
6
---
31
---
7
net/tap.c | 3 ++-
32
hw/net/vmxnet3.c | 4 +++-
8
1 file changed, 2 insertions(+), 1 deletion(-)
33
1 file changed, 3 insertions(+), 1 deletion(-)
9
34
10
diff --git a/net/tap.c b/net/tap.c
35
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
11
index XXXXXXX..XXXXXXX 100644
36
index XXXXXXX..XXXXXXX 100644
12
--- a/net/tap.c
37
--- a/hw/net/vmxnet3.c
13
+++ b/net/tap.c
38
+++ b/hw/net/vmxnet3.c
14
@@ -XXX,XX +XXX,XX @@ free_fail:
39
@@ -XXX,XX +XXX,XX @@ vmxnet3_io_bar1_write(void *opaque,
15
script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
40
case VMXNET3_REG_ICR:
16
}
41
VMW_CBPRN("Write BAR1 [VMXNET3_REG_ICR] = %" PRIx64 ", size %d",
17
if (!downscript) {
42
val, size);
18
- downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
43
- g_assert_not_reached();
19
+ downscript = default_downscript =
44
+ qemu_log_mask(LOG_GUEST_ERROR,
20
+ get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT);
45
+ "%s: write to read-only register VMXNET3_REG_ICR\n",
21
}
46
+ TYPE_VMXNET3);
22
47
break;
23
if (tap->has_ifname) {
48
49
/* Event Cause Register */
24
--
50
--
25
2.7.4
51
2.7.4
26
52
27
53
diff view generated by jsdifflib
1
From: yuanjungong <ruc_gongyuanjun@163.com>
1
From: Peter Foley <pefoley@google.com>
2
2
3
Close fd before returning.
3
Match the other error handling in this function.
4
4
5
Buglink: https://bugs.launchpad.net/qemu/+bug/1904486
5
Fixes: e7b347d0bf6 ("net: detect errors from probing vnet hdr flag for TAP devices")
6
6
7
Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com>
7
Reviewed-by: Patrick Venture <venture@google.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Signed-off-by: Peter Foley <pefoley@google.com>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
11
---
11
net/tap.c | 2 ++
12
net/tap.c | 1 +
12
1 file changed, 2 insertions(+)
13
1 file changed, 1 insertion(+)
13
14
14
diff --git a/net/tap.c b/net/tap.c
15
diff --git a/net/tap.c b/net/tap.c
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/net/tap.c
17
--- a/net/tap.c
17
+++ b/net/tap.c
18
+++ b/net/tap.c
18
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
19
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
19
if (ret < 0) {
20
if (i == 0) {
20
error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
21
vnet_hdr = tap_probe_vnet_hdr(fd, errp);
21
name, fd);
22
if (vnet_hdr < 0) {
22
+ close(fd);
23
+ ret = -1;
23
return -1;
24
goto free_fail;
24
}
25
}
25
26
} else if (vnet_hdr != tap_probe_vnet_hdr(fd, NULL)) {
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) {
34
--
27
--
35
2.7.4
28
2.7.4
36
29
37
30
diff view generated by jsdifflib
New patch
1
From: Peter Foley <pefoley@google.com>
1
2
3
e.g.
4
1109 15:16:20.151506 Uninitialized bytes in ioctl_common_pre at offset 0 inside [0x7ffc516af9b8, 4)
5
1109 15:16:20.151659 ==588974==WARNING: MemorySanitizer: use-of-uninitialized-value
6
1109 15:16:20.312923 #0 0x5639b88acb21 in tap_probe_vnet_hdr_len third_party/qemu/net/tap-linux.c:183:9
7
1109 15:16:20.312952 #1 0x5639b88afd66 in net_tap_fd_init third_party/qemu/net/tap.c:409:9
8
1109 15:16:20.312954 #2 0x5639b88b2d1b in net_init_tap_one third_party/qemu/net/tap.c:681:19
9
1109 15:16:20.312956 #3 0x5639b88b16a8 in net_init_tap third_party/qemu/net/tap.c:912:13
10
1109 15:16:20.312957 #4 0x5639b8890175 in net_client_init1 third_party/qemu/net/net.c:1110:9
11
1109 15:16:20.312958 #5 0x5639b888f912 in net_client_init third_party/qemu/net/net.c:1208:15
12
1109 15:16:20.312960 #6 0x5639b8894aa5 in net_param_nic third_party/qemu/net/net.c:1588:11
13
1109 15:16:20.312961 #7 0x5639b900cd18 in qemu_opts_foreach third_party/qemu/util/qemu-option.c:1135:14
14
1109 15:16:20.312962 #8 0x5639b889393c in net_init_clients third_party/qemu/net/net.c:1612:9
15
1109 15:16:20.312964 #9 0x5639b717aaf3 in qemu_create_late_backends third_party/qemu/softmmu/vl.c:1962:5
16
1109 15:16:20.312965 #10 0x5639b717aaf3 in qemu_init third_party/qemu/softmmu/vl.c:3694:5
17
1109 15:16:20.312967 #11 0x5639b71083b8 in main third_party/qemu/softmmu/main.c:49:5
18
1109 15:16:20.312968 #12 0x7f464de1d8d2 in __libc_start_main (/usr/grte/v5/lib64/libc.so.6+0x628d2)
19
1109 15:16:20.312969 #13 0x5639b6bbd389 in _start /usr/grte/v5/debug-src/src/csu/../sysdeps/x86_64/start.S:120
20
1109 15:16:20.312970
21
1109 15:16:20.312975 Uninitialized value was stored to memory at
22
1109 15:16:20.313393 #0 0x5639b88acbee in tap_probe_vnet_hdr_len third_party/qemu/net/tap-linux.c
23
1109 15:16:20.313396 #1 0x5639b88afd66 in net_tap_fd_init third_party/qemu/net/tap.c:409:9
24
1109 15:16:20.313398 #2 0x5639b88b2d1b in net_init_tap_one third_party/qemu/net/tap.c:681:19
25
1109 15:16:20.313399 #3 0x5639b88b16a8 in net_init_tap third_party/qemu/net/tap.c:912:13
26
1109 15:16:20.313400 #4 0x5639b8890175 in net_client_init1 third_party/qemu/net/net.c:1110:9
27
1109 15:16:20.313401 #5 0x5639b888f912 in net_client_init third_party/qemu/net/net.c:1208:15
28
1109 15:16:20.313403 #6 0x5639b8894aa5 in net_param_nic third_party/qemu/net/net.c:1588:11
29
1109 15:16:20.313404 #7 0x5639b900cd18 in qemu_opts_foreach third_party/qemu/util/qemu-option.c:1135:14
30
1109 15:16:20.313405 #8 0x5639b889393c in net_init_clients third_party/qemu/net/net.c:1612:9
31
1109 15:16:20.313407 #9 0x5639b717aaf3 in qemu_create_late_backends third_party/qemu/softmmu/vl.c:1962:5
32
1109 15:16:20.313408 #10 0x5639b717aaf3 in qemu_init third_party/qemu/softmmu/vl.c:3694:5
33
1109 15:16:20.313409 #11 0x5639b71083b8 in main third_party/qemu/softmmu/main.c:49:5
34
1109 15:16:20.313410 #12 0x7f464de1d8d2 in __libc_start_main (/usr/grte/v5/lib64/libc.so.6+0x628d2)
35
1109 15:16:20.313412 #13 0x5639b6bbd389 in _start /usr/grte/v5/debug-src/src/csu/../sysdeps/x86_64/start.S:120
36
1109 15:16:20.313413
37
1109 15:16:20.313417 Uninitialized value was stored to memory at
38
1109 15:16:20.313791 #0 0x5639b88affbd in net_tap_fd_init third_party/qemu/net/tap.c:400:26
39
1109 15:16:20.313826 #1 0x5639b88b2d1b in net_init_tap_one third_party/qemu/net/tap.c:681:19
40
1109 15:16:20.313829 #2 0x5639b88b16a8 in net_init_tap third_party/qemu/net/tap.c:912:13
41
1109 15:16:20.313831 #3 0x5639b8890175 in net_client_init1 third_party/qemu/net/net.c:1110:9
42
1109 15:16:20.313836 #4 0x5639b888f912 in net_client_init third_party/qemu/net/net.c:1208:15
43
1109 15:16:20.313838 #5 0x5639b8894aa5 in net_param_nic third_party/qemu/net/net.c:1588:11
44
1109 15:16:20.313839 #6 0x5639b900cd18 in qemu_opts_foreach third_party/qemu/util/qemu-option.c:1135:14
45
1109 15:16:20.313841 #7 0x5639b889393c in net_init_clients third_party/qemu/net/net.c:1612:9
46
1109 15:16:20.313843 #8 0x5639b717aaf3 in qemu_create_late_backends third_party/qemu/softmmu/vl.c:1962:5
47
1109 15:16:20.313844 #9 0x5639b717aaf3 in qemu_init third_party/qemu/softmmu/vl.c:3694:5
48
1109 15:16:20.313845 #10 0x5639b71083b8 in main third_party/qemu/softmmu/main.c:49:5
49
1109 15:16:20.313846 #11 0x7f464de1d8d2 in __libc_start_main (/usr/grte/v5/lib64/libc.so.6+0x628d2)
50
1109 15:16:20.313847 #12 0x5639b6bbd389 in _start /usr/grte/v5/debug-src/src/csu/../sysdeps/x86_64/start.S:120
51
1109 15:16:20.313849
52
1109 15:16:20.313851 Uninitialized value was created by an allocation of 'ifr' in the stack frame of function 'tap_probe_vnet_hdr'
53
1109 15:16:20.313855 #0 0x5639b88ac680 in tap_probe_vnet_hdr third_party/qemu/net/tap-linux.c:151
54
1109 15:16:20.313856
55
1109 15:16:20.313878 SUMMARY: MemorySanitizer: use-of-uninitialized-value third_party/qemu/net/tap-linux.c:183:9 in tap_probe_vnet_hdr_len
56
57
Fixes: dc69004c7d8 ("net: move tap_probe_vnet_hdr() to tap-linux.c")
58
Reviewed-by: Hao Wu <wuhaotsh@google.com>
59
Reviewed-by: Patrick Venture <venture@google.com>
60
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
61
Signed-off-by: Peter Foley <pefoley@google.com>
62
Signed-off-by: Jason Wang <jasowang@redhat.com>
63
---
64
net/tap-linux.c | 1 +
65
1 file changed, 1 insertion(+)
66
67
diff --git a/net/tap-linux.c b/net/tap-linux.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/net/tap-linux.c
70
+++ b/net/tap-linux.c
71
@@ -XXX,XX +XXX,XX @@ void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp)
72
int tap_probe_vnet_hdr(int fd, Error **errp)
73
{
74
struct ifreq ifr;
75
+ memset(&ifr, 0, sizeof(ifr));
76
77
if (ioctl(fd, TUNGETIFF, &ifr) != 0) {
78
/* TUNGETIFF is available since kernel v2.6.27 */
79
--
80
2.7.4
81
82
diff view generated by jsdifflib
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
From: Zhang Chen <chen.zhang@intel.com>
2
2
3
"netdev_add help" is causing QEMU to exit because the code that
3
COLO-compare use the glib function g_queue_find_custom to dump
4
invokes show_netdevs is shared between CLI and HMP processing.
4
another VM's networking packet to compare. But this function always
5
Move the check to the callers so that exit(0) remains only
5
start find from the queue->head(here is the newest packet), It will
6
in the CLI flow.
6
reduce the success rate of comparison. So this patch reversed
7
the order of the queues for performance.
7
8
8
"netdev_add help" is not fixed by this patch; that is left for
9
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
9
later work.
10
Reported-by: leirao <lei.rao@intel.com>
10
11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12
Signed-off-by: Jason Wang <jasowang@redhat.com>
11
Signed-off-by: Jason Wang <jasowang@redhat.com>
13
---
12
---
14
include/net/net.h | 1 +
13
net/colo-compare.c | 26 +++++++++++++-------------
15
monitor/hmp-cmds.c | 6 +++++
14
1 file changed, 13 insertions(+), 13 deletions(-)
16
net/net.c | 68 +++++++++++++++++++++++++++---------------------------
17
3 files changed, 41 insertions(+), 34 deletions(-)
18
15
19
diff --git a/include/net/net.h b/include/net/net.h
16
diff --git a/net/colo-compare.c b/net/colo-compare.c
20
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
21
--- a/include/net/net.h
18
--- a/net/colo-compare.c
22
+++ b/include/net/net.h
19
+++ b/net/colo-compare.c
23
@@ -XXX,XX +XXX,XX @@ extern const char *host_net_devices[];
20
@@ -XXX,XX +XXX,XX @@ static void colo_compare_inconsistency_notify(CompareState *s)
24
21
/* Use restricted to colo_insert_packet() */
25
/* from net.c */
22
static gint seq_sorter(Packet *a, Packet *b, gpointer data)
26
int net_client_parse(QemuOptsList *opts_list, const char *str);
27
+void show_netdevs(void);
28
int net_init_clients(Error **errp);
29
void net_check_clients(void);
30
void net_cleanup(void);
31
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/monitor/hmp-cmds.c
34
+++ b/monitor/hmp-cmds.c
35
@@ -XXX,XX +XXX,XX @@
36
#include "qemu/option.h"
37
#include "qemu/timer.h"
38
#include "qemu/sockets.h"
39
+#include "qemu/help_option.h"
40
#include "monitor/monitor-internal.h"
41
#include "qapi/error.h"
42
#include "qapi/clone-visitor.h"
43
@@ -XXX,XX +XXX,XX @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict)
44
{
23
{
45
Error *err = NULL;
24
- return a->tcp_seq - b->tcp_seq;
46
QemuOpts *opts;
25
+ return b->tcp_seq - a->tcp_seq;
47
+ const char *type = qdict_get_try_str(qdict, "type");
48
49
+ if (type && is_help_option(type)) {
50
+ show_netdevs();
51
+ return;
52
+ }
53
opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err);
54
if (err) {
55
goto out;
56
diff --git a/net/net.c b/net/net.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/net/net.c
59
+++ b/net/net.c
60
@@ -XXX,XX +XXX,XX @@
61
#include "qemu/config-file.h"
62
#include "qemu/ctype.h"
63
#include "qemu/iov.h"
64
+#include "qemu/qemu-print.h"
65
#include "qemu/main-loop.h"
66
#include "qemu/option.h"
67
#include "qapi/error.h"
68
@@ -XXX,XX +XXX,XX @@ static int net_client_init1(const Netdev *netdev, bool is_netdev, Error **errp)
69
return 0;
70
}
26
}
71
27
72
-static void show_netdevs(void)
28
static void fill_pkt_tcp_info(void *data, uint32_t *max_ack)
73
+void show_netdevs(void)
29
@@ -XXX,XX +XXX,XX @@ pri:
74
{
30
if (g_queue_is_empty(&conn->primary_list)) {
75
int idx;
31
return;
76
const char *available_netdevs[] = {
32
}
77
@@ -XXX,XX +XXX,XX @@ static void show_netdevs(void)
33
- ppkt = g_queue_pop_head(&conn->primary_list);
78
#endif
34
+ ppkt = g_queue_pop_tail(&conn->primary_list);
79
};
35
sec:
80
36
if (g_queue_is_empty(&conn->secondary_list)) {
81
- printf("Available netdev backend types:\n");
37
- g_queue_push_head(&conn->primary_list, ppkt);
82
+ qemu_printf("Available netdev backend types:\n");
38
+ g_queue_push_tail(&conn->primary_list, ppkt);
83
for (idx = 0; idx < ARRAY_SIZE(available_netdevs); idx++) {
39
return;
84
- puts(available_netdevs[idx]);
40
}
85
+ qemu_printf("%s\n", available_netdevs[idx]);
41
- spkt = g_queue_pop_head(&conn->secondary_list);
42
+ spkt = g_queue_pop_tail(&conn->secondary_list);
43
44
if (ppkt->tcp_seq == ppkt->seq_end) {
45
colo_release_primary_pkt(s, ppkt);
46
@@ -XXX,XX +XXX,XX @@ sec:
47
}
48
}
49
if (!ppkt) {
50
- g_queue_push_head(&conn->secondary_list, spkt);
51
+ g_queue_push_tail(&conn->secondary_list, spkt);
52
goto pri;
53
}
54
}
55
@@ -XXX,XX +XXX,XX @@ sec:
56
if (mark == COLO_COMPARE_FREE_PRIMARY) {
57
conn->compare_seq = ppkt->seq_end;
58
colo_release_primary_pkt(s, ppkt);
59
- g_queue_push_head(&conn->secondary_list, spkt);
60
+ g_queue_push_tail(&conn->secondary_list, spkt);
61
goto pri;
62
} else if (mark == COLO_COMPARE_FREE_SECONDARY) {
63
conn->compare_seq = spkt->seq_end;
64
@@ -XXX,XX +XXX,XX @@ sec:
65
goto pri;
66
}
67
} else {
68
- g_queue_push_head(&conn->primary_list, ppkt);
69
- g_queue_push_head(&conn->secondary_list, spkt);
70
+ g_queue_push_tail(&conn->primary_list, ppkt);
71
+ g_queue_push_tail(&conn->secondary_list, spkt);
72
73
#ifdef DEBUG_COLO_PACKETS
74
qemu_hexdump(stderr, "colo-compare ppkt", ppkt->data, ppkt->size);
75
@@ -XXX,XX +XXX,XX @@ static void colo_compare_packet(CompareState *s, Connection *conn,
76
77
while (!g_queue_is_empty(&conn->primary_list) &&
78
!g_queue_is_empty(&conn->secondary_list)) {
79
- pkt = g_queue_pop_head(&conn->primary_list);
80
+ pkt = g_queue_pop_tail(&conn->primary_list);
81
result = g_queue_find_custom(&conn->secondary_list,
82
pkt, (GCompareFunc)HandlePacket);
83
84
@@ -XXX,XX +XXX,XX @@ static void colo_compare_packet(CompareState *s, Connection *conn,
85
* timeout, it will trigger a checkpoint request.
86
*/
87
trace_colo_compare_main("packet different");
88
- g_queue_push_head(&conn->primary_list, pkt);
89
+ g_queue_push_tail(&conn->primary_list, pkt);
90
91
colo_compare_inconsistency_notify(s);
92
break;
93
@@ -XXX,XX +XXX,XX @@ static int compare_chr_send(CompareState *s,
94
entry->buf = g_malloc(size);
95
memcpy(entry->buf, buf, size);
96
}
97
- g_queue_push_head(&sendco->send_list, entry);
98
+ g_queue_push_tail(&sendco->send_list, entry);
99
100
if (sendco->done) {
101
sendco->co = qemu_coroutine_create(_compare_chr_send, sendco);
102
@@ -XXX,XX +XXX,XX @@ static void colo_flush_packets(void *opaque, void *user_data)
103
Packet *pkt = NULL;
104
105
while (!g_queue_is_empty(&conn->primary_list)) {
106
- pkt = g_queue_pop_head(&conn->primary_list);
107
+ pkt = g_queue_pop_tail(&conn->primary_list);
108
compare_chr_send(s,
109
pkt->data,
110
pkt->size,
111
@@ -XXX,XX +XXX,XX @@ static void colo_flush_packets(void *opaque, void *user_data)
112
packet_destroy_partial(pkt, NULL);
113
}
114
while (!g_queue_is_empty(&conn->secondary_list)) {
115
- pkt = g_queue_pop_head(&conn->secondary_list);
116
+ pkt = g_queue_pop_tail(&conn->secondary_list);
117
packet_destroy(pkt, NULL);
86
}
118
}
87
}
119
}
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
}
148
+
149
+ qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort);
150
+ qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len,
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);
165
+ }
166
return net_client_init(opts, true, errp);
167
}
168
169
--
120
--
170
2.7.4
121
2.7.4
171
122
172
123
diff view generated by jsdifflib
New patch
1
From: Zhang Chen <chen.zhang@intel.com>
1
2
3
Make the comments consistent with the REGULAR_PACKET_CHECK_MS.
4
5
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
6
Signed-off-by: Jason Wang <jasowang@redhat.com>
7
---
8
net/colo-compare.c | 2 +-
9
1 file changed, 1 insertion(+), 1 deletion(-)
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 void colo_compare_complete(UserCreatable *uc, Error **errp)
16
}
17
18
if (!s->expired_scan_cycle) {
19
- /* Set default value to 3000 MS */
20
+ /* Set default value to 1000 MS */
21
s->expired_scan_cycle = REGULAR_PACKET_CHECK_MS;
22
}
23
24
--
25
2.7.4
26
27
diff view generated by jsdifflib
1
From: Yuri Benditovich <yuri.benditovich@daynix.com>
1
From: Rao Lei <lei.rao@intel.com>
2
2
3
https://bugzilla.redhat.com/show_bug.cgi?id=1829272
3
This patch is to improve the logic of QEMU main thread sleep code in
4
When deleting queue pair, purge pending RX packets if any.
4
qemu_chr_write_buffer() where it can be blocked and can't run other
5
Example of problematic flow:
5
coroutines during COLO IO stress test.
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)
14
6
15
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
7
Our approach is to put filter_send() in a coroutine. In this way,
8
filter_send() will call qemu_coroutine_yield() in qemu_co_sleep_ns(),
9
so that it can be scheduled out and QEMU main thread has opportunity to
10
run other tasks.
11
12
Signed-off-by: Lei Rao <lei.rao@intel.com>
13
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
14
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
15
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
16
Signed-off-by: Jason Wang <jasowang@redhat.com>
16
Signed-off-by: Jason Wang <jasowang@redhat.com>
17
---
17
---
18
net/net.c | 12 ++++++++----
18
net/filter-mirror.c | 66 ++++++++++++++++++++++++++++++++++++++++++-----------
19
1 file changed, 8 insertions(+), 4 deletions(-)
19
1 file changed, 53 insertions(+), 13 deletions(-)
20
20
21
diff --git a/net/net.c b/net/net.c
21
diff --git a/net/filter-mirror.c b/net/filter-mirror.c
22
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
23
--- a/net/net.c
23
--- a/net/filter-mirror.c
24
+++ b/net/net.c
24
+++ b/net/filter-mirror.c
25
@@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic)
25
@@ -XXX,XX +XXX,XX @@
26
26
#include "chardev/char-fe.h"
27
qemu_macaddr_set_free(&nic->conf->macaddr);
27
#include "qemu/iov.h"
28
28
#include "qemu/sockets.h"
29
- /* If this is a peer NIC and peer has already been deleted, free it now. */
29
+#include "block/aio-wait.h"
30
- if (nic->peer_deleted) {
30
31
- for (i = 0; i < queues; i++) {
31
#define TYPE_FILTER_MIRROR "filter-mirror"
32
- qemu_free_net_client(qemu_get_subqueue(nic, i)->peer);
32
typedef struct MirrorState MirrorState;
33
+ for (i = 0; i < queues; i++) {
33
@@ -XXX,XX +XXX,XX @@ struct MirrorState {
34
+ NetClientState *nc = qemu_get_subqueue(nic, i);
34
bool vnet_hdr;
35
+ /* If this is a peer NIC and peer has already been deleted, free it now. */
35
};
36
+ if (nic->peer_deleted) {
36
37
+ qemu_free_net_client(nc->peer);
37
-static int filter_send(MirrorState *s,
38
+ } else if (nc->peer) {
38
- const struct iovec *iov,
39
+ /* if there are RX packets pending, complete them */
39
- int iovcnt)
40
+ qemu_purge_queued_packets(nc->peer);
40
+typedef struct FilterSendCo {
41
+ MirrorState *s;
42
+ char *buf;
43
+ ssize_t size;
44
+ bool done;
45
+ int ret;
46
+} FilterSendCo;
47
+
48
+static int _filter_send(MirrorState *s,
49
+ char *buf,
50
+ ssize_t size)
51
{
52
NetFilterState *nf = NETFILTER(s);
53
int ret = 0;
54
- ssize_t size = 0;
55
uint32_t len = 0;
56
- char *buf;
57
-
58
- size = iov_size(iov, iovcnt);
59
- if (!size) {
60
- return 0;
61
- }
62
63
len = htonl(size);
64
ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof(len));
65
@@ -XXX,XX +XXX,XX @@ static int filter_send(MirrorState *s,
41
}
66
}
42
}
67
}
43
68
69
- buf = g_malloc(size);
70
- iov_to_buf(iov, iovcnt, 0, buf, size);
71
ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)buf, size);
72
- g_free(buf);
73
if (ret != size) {
74
goto err;
75
}
76
@@ -XXX,XX +XXX,XX @@ err:
77
return ret < 0 ? ret : -EIO;
78
}
79
80
+static void coroutine_fn filter_send_co(void *opaque)
81
+{
82
+ FilterSendCo *data = opaque;
83
+
84
+ data->ret = _filter_send(data->s, data->buf, data->size);
85
+ data->done = true;
86
+ g_free(data->buf);
87
+ aio_wait_kick();
88
+}
89
+
90
+static int filter_send(MirrorState *s,
91
+ const struct iovec *iov,
92
+ int iovcnt)
93
+{
94
+ ssize_t size = iov_size(iov, iovcnt);
95
+ char *buf = NULL;
96
+
97
+ if (!size) {
98
+ return 0;
99
+ }
100
+
101
+ buf = g_malloc(size);
102
+ iov_to_buf(iov, iovcnt, 0, buf, size);
103
+
104
+ FilterSendCo data = {
105
+ .s = s,
106
+ .size = size,
107
+ .buf = buf,
108
+ .ret = 0,
109
+ };
110
+
111
+ Coroutine *co = qemu_coroutine_create(filter_send_co, &data);
112
+ qemu_coroutine_enter(co);
113
+
114
+ while (!data.done) {
115
+ aio_poll(qemu_get_aio_context(), true);
116
+ }
117
+
118
+ return data.ret;
119
+}
120
+
121
static void redirector_to_filter(NetFilterState *nf,
122
const uint8_t *buf,
123
int len)
44
--
124
--
45
2.7.4
125
2.7.4
46
126
47
127
diff view generated by jsdifflib
1
From: Prasad J Pandit <pjp@fedoraproject.org>
1
From: Nick Hudson <skrll@netbsd.org>
2
2
3
While receiving packets via e1000e_write_packet_to_guest() routine,
3
In section 7.4.3 of the 82574 datasheet it states that
4
'desc_offset' is advanced only when RX descriptor is processed. And
5
RX descriptor is not processed if it has NULL buffer address.
6
This may lead to an infinite loop condition. Increament 'desc_offset'
7
to process next descriptor in the ring to avoid infinite loop.
8
4
9
Reported-by: Cheol-woo Myung <330cjfdn@gmail.com>
5
"In systems that do not support MSI-X, reading the ICR
10
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
6
register clears it's bits..."
7
8
Some OSes rely on this.
9
10
Signed-off-by: Nick Hudson <skrll@netbsd.org>
11
Signed-off-by: Jason Wang <jasowang@redhat.com>
11
Signed-off-by: Jason Wang <jasowang@redhat.com>
12
---
12
---
13
hw/net/e1000e_core.c | 8 ++++----
13
hw/net/e1000e_core.c | 5 +++++
14
1 file changed, 4 insertions(+), 4 deletions(-)
14
hw/net/trace-events | 1 +
15
2 files changed, 6 insertions(+)
15
16
16
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
17
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
17
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/net/e1000e_core.c
19
--- a/hw/net/e1000e_core.c
19
+++ b/hw/net/e1000e_core.c
20
+++ b/hw/net/e1000e_core.c
20
@@ -XXX,XX +XXX,XX @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
21
@@ -XXX,XX +XXX,XX @@ e1000e_mac_icr_read(E1000ECore *core, int index)
21
(const char *) &fcs_pad, e1000x_fcs_len(core->mac));
22
core->mac[ICR] = 0;
22
}
23
}
23
}
24
24
- desc_offset += desc_size;
25
+ if (!msix_enabled(core->owner)) {
25
- if (desc_offset >= total_size) {
26
+ trace_e1000e_irq_icr_clear_nonmsix_icr_read();
26
- is_last = true;
27
+ core->mac[ICR] = 0;
27
- }
28
+ }
28
} else { /* as per intel docs; skip descriptors with null buf addr */
29
+
29
trace_e1000e_rx_null_descriptor();
30
if ((core->mac[ICR] & E1000_ICR_ASSERTED) &&
30
}
31
(core->mac[CTRL_EXT] & E1000_CTRL_EXT_IAME)) {
31
+ desc_offset += desc_size;
32
trace_e1000e_irq_icr_clear_iame();
32
+ if (desc_offset >= total_size) {
33
diff --git a/hw/net/trace-events b/hw/net/trace-events
33
+ is_last = true;
34
index XXXXXXX..XXXXXXX 100644
34
+ }
35
--- a/hw/net/trace-events
35
36
+++ b/hw/net/trace-events
36
e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL,
37
@@ -XXX,XX +XXX,XX @@ e1000e_irq_write_ics(uint32_t val) "Adding ICR bits 0x%x"
37
rss_info, do_ps ? ps_hdr_len : 0, &bastate.written);
38
e1000e_irq_icr_process_iame(void) "Clearing IMS bits due to IAME"
39
e1000e_irq_read_ics(uint32_t ics) "Current ICS: 0x%x"
40
e1000e_irq_read_ims(uint32_t ims) "Current IMS: 0x%x"
41
+e1000e_irq_icr_clear_nonmsix_icr_read(void) "Clearing ICR on read due to non MSI-X int"
42
e1000e_irq_icr_read_entry(uint32_t icr) "Starting ICR read. Current ICR: 0x%x"
43
e1000e_irq_icr_read_exit(uint32_t icr) "Ending ICR read. Current ICR: 0x%x"
44
e1000e_irq_icr_clear_zero_ims(void) "Clearing ICR on read due to zero IMS"
38
--
45
--
39
2.7.4
46
2.7.4
40
47
41
48
diff view generated by jsdifflib
New patch
1
From: Thomas Jansen <mithi@mithi.net>
1
2
3
The IPv6 option headers all have in common that they start with some
4
common fields, in particular the type of the next header followed by the
5
extention header length. This is used to traverse the list of the
6
options. The ESP header does not follow that format, which can break the
7
IPv6 option header traversal code in eth_parse_ipv6_hdr().
8
9
The effect of that is that network interfaces such as vmxnet3 that use
10
the following call chain
11
eth_is_ip6_extension_header_type
12
eth_parse_ipv6_hdr
13
net_tx_pkt_parse_headers
14
net_tx_pkt_parse
15
vmxnet3_process_tx_queue
16
to send packets from the VM out to the host will drop packets of the
17
following structure:
18
Ethernet-Header(IPv6-Header(ESP(encrypted data)))
19
20
Note that not all types of network interfaces use the net_tx_pkt_parse
21
function though, leading to inconsistent behavior regarding sending
22
those packets. The e1000 network interface for example does not suffer
23
from this limitation.
24
25
By not considering ESP to be an IPv6 header we can allow sending those
26
packets out to the host on all types of network interfaces.
27
28
Fixes: 75020a702151 ("Common definitions for VMWARE devices")
29
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/149
30
Buglink: https://bugs.launchpad.net/qemu/+bug/1758091
31
Signed-off-by: Thomas Jansen <mithi@mithi.net>
32
Signed-off-by: Jason Wang <jasowang@redhat.com>
33
---
34
net/eth.c | 1 -
35
1 file changed, 1 deletion(-)
36
37
diff --git a/net/eth.c b/net/eth.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/net/eth.c
40
+++ b/net/eth.c
41
@@ -XXX,XX +XXX,XX @@ eth_is_ip6_extension_header_type(uint8_t hdr_type)
42
case IP6_HOP_BY_HOP:
43
case IP6_ROUTING:
44
case IP6_FRAGMENT:
45
- case IP6_ESP:
46
case IP6_AUTHENTICATION:
47
case IP6_DESTINATON:
48
case IP6_MOBILITY:
49
--
50
2.7.4
51
52
diff view generated by jsdifflib