1
The following changes since commit 4ffa88c99c54d2a30f79e3dbecec50b023eff1c8:
1
The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06:
2
2
3
Merge remote-tracking branch 'remotes/berrange/tags/pull-qcrypto-2017-11-08-1' into staging (2017-11-10 16:01:35 +0000)
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 bb160b571fe469b03228d4502c75a18045978a74:
9
for you to fetch changes up to 9925990d01a92564af55f6f69d0f5f59b47609b1:
10
10
11
net/socket: fix coverity issue (2017-11-13 18:05:12 +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
Jens Freimann (2):
16
Keqian Zhu (1):
17
net: fix check for number of parameters to -netdev socket
17
net: Use correct default-path macro for downscript
18
net/socket: fix coverity issue
19
18
20
Mao Zhongyi (4):
19
Paolo Bonzini (1):
21
colo-compare: Insert packet into the suitable position of packet queue directly
20
net: do not exit on "netdev_add help" monitor command
22
colo-compare: compare the packet in a specified Connection
23
colo-compare: Fix comments
24
colo: Consolidate the duplicate code chunk into a routine
25
21
26
Mike Nawrocki (2):
22
Prasad J Pandit (1):
27
Fix eepro100 simple transmission mode
23
hw/net/e1000e: advance desc_offset in case of null descriptor
28
Add new PCI ID for i82559a
29
24
30
hw/net/eepro100.c | 31 +++++++++++++-------------
25
Yuri Benditovich (1):
31
include/hw/compat.h | 4 ++++
26
net: purge queued rx packets on queue deletion
32
include/hw/pci/pci.h | 1 +
27
33
net/colo-compare.c | 61 ++++++++++++++++++++++++++++++----------------------
28
yuanjungong (1):
34
net/colo.c | 18 +++++++++-------
29
tap: fix a memory leak
35
net/colo.h | 1 +
30
36
net/socket.c | 6 +++---
31
hw/net/e1000e_core.c | 8 +++---
37
qemu-options.hx | 2 +-
32
include/net/net.h | 1 +
38
8 files changed, 71 insertions(+), 53 deletions(-)
33
monitor/hmp-cmds.c | 6 ++++
34
net/net.c | 80 +++++++++++++++++++++++++++-------------------------
35
net/tap.c | 5 +++-
36
5 files changed, 57 insertions(+), 43 deletions(-)
39
37
40
38
diff view generated by jsdifflib
Deleted patch
1
From: Jens Freimann <jfreimann@redhat.com>
2
1
3
Since commit 0f8c289ad "net: fix -netdev socket,fd= for UDP sockets"
4
we allow more than one parameter for -netdev socket. But now
5
we run into an assert when no parameter at all is specified
6
7
> qemu-system-x86_64 -netdev socket
8
socket.c:729: net_init_socket: Assertion `sock->has_udp' failed.
9
10
Fix this by reverting the change of the if condition done in 0f8c289ad.
11
12
Cc: Jason Wang <jasowang@redhat.com>
13
Cc: qemu-stable@nongnu.org
14
Fixes: 0f8c289ad539feb5135c545bea947b310a893f4b
15
Reported-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
16
Signed-off-by: Jens Freimann <jfreimann@redhat.com>
17
Signed-off-by: Jason Wang <jasowang@redhat.com>
18
---
19
net/socket.c | 4 ++--
20
1 file changed, 2 insertions(+), 2 deletions(-)
21
22
diff --git a/net/socket.c b/net/socket.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/net/socket.c
25
+++ b/net/socket.c
26
@@ -XXX,XX +XXX,XX @@ int net_init_socket(const Netdev *netdev, const char *name,
27
assert(netdev->type == NET_CLIENT_DRIVER_SOCKET);
28
sock = &netdev->u.socket;
29
30
- if (sock->has_listen + sock->has_connect + sock->has_mcast +
31
- sock->has_udp > 1) {
32
+ if (sock->has_fd + sock->has_listen + sock->has_connect + sock->has_mcast +
33
+ sock->has_udp != 1) {
34
error_setg(errp, "exactly one of listen=, connect=, mcast= or udp="
35
" is required");
36
return -1;
37
--
38
2.7.4
39
40
diff view generated by jsdifflib
1
From: Jens Freimann <jfreimann@redhat.com>
1
From: Prasad J Pandit <pjp@fedoraproject.org>
2
2
3
This fixes coverity issue CID1005339.
3
While receiving packets via e1000e_write_packet_to_guest() routine,
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.
4
8
5
Make sure that saddr is not used uninitialized if the
9
Reported-by: Cheol-woo Myung <330cjfdn@gmail.com>
6
mcast parameter is NULL.
10
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
7
8
Cc: qemu-stable@nongnu.org
9
Reported-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Jens Freimann <jfreimann@redhat.com>
11
Signed-off-by: Jason Wang <jasowang@redhat.com>
11
Signed-off-by: Jason Wang <jasowang@redhat.com>
12
---
12
---
13
net/socket.c | 2 +-
13
hw/net/e1000e_core.c | 8 ++++----
14
1 file changed, 1 insertion(+), 1 deletion(-)
14
1 file changed, 4 insertions(+), 4 deletions(-)
15
15
16
diff --git a/net/socket.c b/net/socket.c
16
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/net/socket.c
18
--- a/hw/net/e1000e_core.c
19
+++ b/net/socket.c
19
+++ b/hw/net/e1000e_core.c
20
@@ -XXX,XX +XXX,XX @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
20
@@ -XXX,XX +XXX,XX @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
21
net_socket_read_poll(s, true);
21
(const char *) &fcs_pad, e1000x_fcs_len(core->mac));
22
22
}
23
/* mcast: save bound address as dst */
23
}
24
- if (is_connected) {
24
- desc_offset += desc_size;
25
+ if (is_connected && mcast != NULL) {
25
- if (desc_offset >= total_size) {
26
s->dgram_dst = saddr;
26
- is_last = true;
27
snprintf(nc->info_str, sizeof(nc->info_str),
27
- }
28
"socket: fd=%d (cloned mcast=%s:%d)",
28
} else { /* as per intel docs; skip descriptors with null buf addr */
29
trace_e1000e_rx_null_descriptor();
30
}
31
+ desc_offset += desc_size;
32
+ if (desc_offset >= total_size) {
33
+ is_last = true;
34
+ }
35
36
e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL,
37
rss_info, do_ps ? ps_hdr_len : 0, &bastate.written);
29
--
38
--
30
2.7.4
39
2.7.4
31
40
32
41
diff view generated by jsdifflib
1
From: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
1
From: Paolo Bonzini <pbonzini@redhat.com>
2
2
3
A package from pri_indev or sec_indev only belongs to a particular
3
"netdev_add help" is causing QEMU to exit because the code that
4
Connection, so we only need to compare the package in the specified
4
invokes show_netdevs is shared between CLI and HMP processing.
5
Connection's primary_list and secondary_list, rather than for each
5
Move the check to the callers so that exit(0) remains only
6
the whole Connection list to compare. This is time-consuming and
6
in the CLI flow.
7
unnecessary.
8
7
9
Less checkpoint more efficiency.
8
"netdev_add help" is not fixed by this patch; that is left for
9
later work.
10
10
11
Cc: Zhang Chen <zhangckid@gmail.com>
11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
13
Cc: Jason Wang <jasowang@redhat.com>
14
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
15
Signed-off-by: Jason Wang <jasowang@redhat.com>
12
Signed-off-by: Jason Wang <jasowang@redhat.com>
16
---
13
---
17
net/colo-compare.c | 13 ++++++++-----
14
include/net/net.h | 1 +
18
1 file changed, 8 insertions(+), 5 deletions(-)
15
monitor/hmp-cmds.c | 6 +++++
16
net/net.c | 68 +++++++++++++++++++++++++++---------------------------
17
3 files changed, 41 insertions(+), 34 deletions(-)
19
18
20
diff --git a/net/colo-compare.c b/net/colo-compare.c
19
diff --git a/include/net/net.h b/include/net/net.h
21
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
22
--- a/net/colo-compare.c
21
--- a/include/net/net.h
23
+++ b/net/colo-compare.c
22
+++ b/include/net/net.h
24
@@ -XXX,XX +XXX,XX @@ static int colo_insert_packet(GQueue *queue, Packet *pkt)
23
@@ -XXX,XX +XXX,XX @@ extern const char *host_net_devices[];
25
* Return 0 on success, if return -1 means the pkt
24
26
* is unsupported(arp and ipv6) and will be sent later
25
/* from net.c */
27
*/
26
int net_client_parse(QemuOptsList *opts_list, const char *str);
28
-static int packet_enqueue(CompareState *s, int mode)
27
+void show_netdevs(void);
29
+static int packet_enqueue(CompareState *s, int mode, Connection **con)
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)
30
{
44
{
31
ConnectionKey key;
45
Error *err = NULL;
32
Packet *pkt = NULL;
46
QemuOpts *opts;
33
@@ -XXX,XX +XXX,XX @@ static int packet_enqueue(CompareState *s, int mode)
47
+ const char *type = qdict_get_try_str(qdict, "type");
34
"drop packet");
48
35
}
49
+ if (type && is_help_option(type)) {
36
}
50
+ show_netdevs();
37
+ con = &conn;
51
+ return;
38
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)
39
return 0;
69
return 0;
40
}
70
}
41
@@ -XXX,XX +XXX,XX @@ static void compare_set_vnet_hdr(Object *obj,
71
42
static void compare_pri_rs_finalize(SocketReadState *pri_rs)
72
-static void show_netdevs(void)
73
+void show_netdevs(void)
43
{
74
{
44
CompareState *s = container_of(pri_rs, CompareState, pri_rs);
75
int idx;
45
+ Connection *conn = NULL;
76
const char *available_netdevs[] = {
46
77
@@ -XXX,XX +XXX,XX @@ static void show_netdevs(void)
47
- if (packet_enqueue(s, PRIMARY_IN)) {
78
#endif
48
+ if (packet_enqueue(s, PRIMARY_IN, &conn)) {
79
};
49
trace_colo_compare_main("primary: unsupported packet in");
80
50
compare_chr_send(s,
81
- printf("Available netdev backend types:\n");
51
pri_rs->buf,
82
+ qemu_printf("Available netdev backend types:\n");
52
@@ -XXX,XX +XXX,XX @@ static void compare_pri_rs_finalize(SocketReadState *pri_rs)
83
for (idx = 0; idx < ARRAY_SIZE(available_netdevs); idx++) {
53
pri_rs->vnet_hdr_len);
84
- puts(available_netdevs[idx]);
54
} else {
85
+ qemu_printf("%s\n", available_netdevs[idx]);
55
/* compare connection */
56
- g_queue_foreach(&s->conn_list, colo_compare_connection, s);
57
+ colo_compare_connection(conn, s);
58
}
86
}
59
}
87
}
60
88
61
static void compare_sec_rs_finalize(SocketReadState *sec_rs)
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)
62
{
159
{
63
CompareState *s = container_of(sec_rs, CompareState, sec_rs);
160
+ const char *type = qemu_opt_get(opts, "type");
64
+ Connection *conn = NULL;
161
+
65
162
+ if (type && is_help_option(type)) {
66
- if (packet_enqueue(s, SECONDARY_IN)) {
163
+ show_netdevs();
67
+ if (packet_enqueue(s, SECONDARY_IN, &conn)) {
164
+ exit(0);
68
trace_colo_compare_main("secondary: unsupported packet in");
165
+ }
69
} else {
166
return net_client_init(opts, true, errp);
70
/* compare connection */
71
- g_queue_foreach(&s->conn_list, colo_compare_connection, s);
72
+ colo_compare_connection(conn, s);
73
}
74
}
167
}
75
168
76
--
169
--
77
2.7.4
170
2.7.4
78
171
79
172
diff view generated by jsdifflib
1
From: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
1
From: Yuri Benditovich <yuri.benditovich@daynix.com>
2
2
3
Currently, a packet from pri_dev or sec_dev is fristly pushed at the
3
https://bugzilla.redhat.com/show_bug.cgi?id=1829272
4
tail of the primary or secondary packet queue then sorted by the tcp
4
When deleting queue pair, purge pending RX packets if any.
5
sequence number.
5
Example of problematic flow:
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)
6
14
7
Now, this patch use g_queue_insert_sorted to insert the packet directly
15
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
8
into the suitable position to avoid ordering all packets each time when
9
a new packet is comming, thereby increasing efficiency.
10
11
In addition, consolidate the code that add a packet to the list of
12
Connection (primary or secondary) into a separate routine colo_insert_packet()
13
since the same chunk of code is called from two place.
14
15
Cc: Zhang Chen <zhangckid@gmail.com>
16
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
17
Cc: Jason Wang <jasowang@redhat.com>
18
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
19
Signed-off-by: Zhang Chen <zhangckid@gmail.com>
20
Signed-off-by: Jason Wang <jasowang@redhat.com>
16
Signed-off-by: Jason Wang <jasowang@redhat.com>
21
---
17
---
22
net/colo-compare.c | 40 ++++++++++++++++++++++------------------
18
net/net.c | 12 ++++++++----
23
1 file changed, 22 insertions(+), 18 deletions(-)
19
1 file changed, 8 insertions(+), 4 deletions(-)
24
20
25
diff --git a/net/colo-compare.c b/net/colo-compare.c
21
diff --git a/net/net.c b/net/net.c
26
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
27
--- a/net/colo-compare.c
23
--- a/net/net.c
28
+++ b/net/colo-compare.c
24
+++ b/net/net.c
29
@@ -XXX,XX +XXX,XX @@ static gint seq_sorter(Packet *a, Packet *b, gpointer data)
25
@@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic)
30
}
26
31
27
qemu_macaddr_set_free(&nic->conf->macaddr);
32
/*
28
33
+ * Return 1 on success, if return 0 means the
29
- /* If this is a peer NIC and peer has already been deleted, free it now. */
34
+ * packet will be dropped
30
- if (nic->peer_deleted) {
35
+ */
31
- for (i = 0; i < queues; i++) {
36
+static int colo_insert_packet(GQueue *queue, Packet *pkt)
32
- qemu_free_net_client(qemu_get_subqueue(nic, i)->peer);
37
+{
33
+ for (i = 0; i < queues; i++) {
38
+ if (g_queue_get_length(queue) <= MAX_QUEUE_SIZE) {
34
+ NetClientState *nc = qemu_get_subqueue(nic, i);
39
+ if (pkt->ip->ip_p == IPPROTO_TCP) {
35
+ /* If this is a peer NIC and peer has already been deleted, free it now. */
40
+ g_queue_insert_sorted(queue,
36
+ if (nic->peer_deleted) {
41
+ pkt,
37
+ qemu_free_net_client(nc->peer);
42
+ (GCompareDataFunc)seq_sorter,
38
+ } else if (nc->peer) {
43
+ NULL);
39
+ /* if there are RX packets pending, complete them */
44
+ } else {
40
+ qemu_purge_queued_packets(nc->peer);
45
+ g_queue_push_tail(queue, pkt);
41
}
46
+ }
47
+ return 1;
48
+ }
49
+ return 0;
50
+}
51
+
52
+/*
53
* Return 0 on success, if return -1 means the pkt
54
* is unsupported(arp and ipv6) and will be sent later
55
*/
56
@@ -XXX,XX +XXX,XX @@ static int packet_enqueue(CompareState *s, int mode)
57
}
42
}
58
43
59
if (mode == PRIMARY_IN) {
60
- if (g_queue_get_length(&conn->primary_list) <=
61
- MAX_QUEUE_SIZE) {
62
- g_queue_push_tail(&conn->primary_list, pkt);
63
- if (conn->ip_proto == IPPROTO_TCP) {
64
- g_queue_sort(&conn->primary_list,
65
- (GCompareDataFunc)seq_sorter,
66
- NULL);
67
- }
68
- } else {
69
+ if (!colo_insert_packet(&conn->primary_list, pkt)) {
70
error_report("colo compare primary queue size too big,"
71
"drop packet");
72
}
73
} else {
74
- if (g_queue_get_length(&conn->secondary_list) <=
75
- MAX_QUEUE_SIZE) {
76
- g_queue_push_tail(&conn->secondary_list, pkt);
77
- if (conn->ip_proto == IPPROTO_TCP) {
78
- g_queue_sort(&conn->secondary_list,
79
- (GCompareDataFunc)seq_sorter,
80
- NULL);
81
- }
82
- } else {
83
+ if (!colo_insert_packet(&conn->secondary_list, pkt)) {
84
error_report("colo compare secondary queue size too big,"
85
"drop packet");
86
}
87
--
44
--
88
2.7.4
45
2.7.4
89
46
90
47
diff view generated by jsdifflib
Deleted patch
1
From: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
2
1
3
Cc: Zhang Chen <zhangckid@gmail.com>
4
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
5
Cc: Jason Wang <jasowang@redhat.com>
6
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
7
Signed-off-by: Zhang Chen <zhangckid@gmail.com>
8
Signed-off-by: Jason Wang <jasowang@redhat.com>
9
---
10
net/colo-compare.c | 8 +++++---
11
1 file changed, 5 insertions(+), 3 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 void colo_old_packet_check(void *opaque)
18
19
/*
20
* Called from the compare thread on the primary
21
- * for compare connection
22
+ * for compare packet with secondary list of the
23
+ * specified connection when a new packet was
24
+ * queued to it.
25
*/
26
static void colo_compare_connection(void *opaque, void *user_data)
27
{
28
@@ -XXX,XX +XXX,XX @@ static void compare_pri_rs_finalize(SocketReadState *pri_rs)
29
pri_rs->packet_len,
30
pri_rs->vnet_hdr_len);
31
} else {
32
- /* compare connection */
33
+ /* compare packet in the specified connection */
34
colo_compare_connection(conn, s);
35
}
36
}
37
@@ -XXX,XX +XXX,XX @@ static void compare_sec_rs_finalize(SocketReadState *sec_rs)
38
if (packet_enqueue(s, SECONDARY_IN, &conn)) {
39
trace_colo_compare_main("secondary: unsupported packet in");
40
} else {
41
- /* compare connection */
42
+ /* compare packet in the specified connection */
43
colo_compare_connection(conn, s);
44
}
45
}
46
--
47
2.7.4
48
49
diff view generated by jsdifflib
Deleted patch
1
From: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
2
1
3
Consolidate the code that extract the ip address(src,dst) and
4
port number(src,dst) of the packet into a separate routine
5
extract_ip_and_port() since the same chunk of code is called
6
from two place.
7
8
Cc: Zhang Chen <zhangckid@gmail.com>
9
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
10
Cc: Jason Wang <jasowang@redhat.com>
11
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
12
Signed-off-by: Jason Wang <jasowang@redhat.com>
13
---
14
net/colo.c | 18 ++++++++++--------
15
net/colo.h | 1 +
16
2 files changed, 11 insertions(+), 8 deletions(-)
17
18
diff --git a/net/colo.c b/net/colo.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/net/colo.c
21
+++ b/net/colo.c
22
@@ -XXX,XX +XXX,XX @@ int parse_packet_early(Packet *pkt)
23
return 0;
24
}
25
26
+void extract_ip_and_port(uint32_t tmp_ports, ConnectionKey *key, Packet *pkt)
27
+{
28
+ key->src = pkt->ip->ip_src;
29
+ key->dst = pkt->ip->ip_dst;
30
+ key->src_port = ntohs(tmp_ports >> 16);
31
+ key->dst_port = ntohs(tmp_ports & 0xffff);
32
+}
33
+
34
void fill_connection_key(Packet *pkt, ConnectionKey *key)
35
{
36
uint32_t tmp_ports;
37
@@ -XXX,XX +XXX,XX @@ void fill_connection_key(Packet *pkt, ConnectionKey *key)
38
case IPPROTO_SCTP:
39
case IPPROTO_UDPLITE:
40
tmp_ports = *(uint32_t *)(pkt->transport_header);
41
- key->src = pkt->ip->ip_src;
42
- key->dst = pkt->ip->ip_dst;
43
- key->src_port = ntohs(tmp_ports & 0xffff);
44
- key->dst_port = ntohs(tmp_ports >> 16);
45
+ extract_ip_and_port(tmp_ports, key, pkt);
46
break;
47
case IPPROTO_AH:
48
tmp_ports = *(uint32_t *)(pkt->transport_header + 4);
49
- key->src = pkt->ip->ip_src;
50
- key->dst = pkt->ip->ip_dst;
51
- key->src_port = ntohs(tmp_ports & 0xffff);
52
- key->dst_port = ntohs(tmp_ports >> 16);
53
+ extract_ip_and_port(tmp_ports, key, pkt);
54
break;
55
default:
56
break;
57
diff --git a/net/colo.h b/net/colo.h
58
index XXXXXXX..XXXXXXX 100644
59
--- a/net/colo.h
60
+++ b/net/colo.h
61
@@ -XXX,XX +XXX,XX @@ typedef struct Connection {
62
uint32_t connection_key_hash(const void *opaque);
63
int connection_key_equal(const void *opaque1, const void *opaque2);
64
int parse_packet_early(Packet *pkt);
65
+void extract_ip_and_port(uint32_t tmp_ports, ConnectionKey *key, Packet *pkt);
66
void fill_connection_key(Packet *pkt, ConnectionKey *key);
67
void reverse_connection_key(ConnectionKey *key);
68
Connection *connection_new(ConnectionKey *key);
69
--
70
2.7.4
71
72
diff view generated by jsdifflib
1
From: Mike Nawrocki <michael.nawrocki@gtri.gatech.edu>
1
From: yuanjungong <ruc_gongyuanjun@163.com>
2
2
3
Adds a new PCI ID for the i82559a (0x8086 0x1030) interface. The
3
Close fd before returning.
4
"x-use-alt-device-id" property controls whether this new ID is to be
5
used, and is true by default, and set to false in a compat entry.
6
4
7
Signed-off-by: Mike Nawrocki <michael.nawrocki@gtri.gatech.edu>
5
Buglink: https://bugs.launchpad.net/qemu/+bug/1904486
8
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
6
7
Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
10
---
11
hw/net/eepro100.c | 13 +++++++++++++
11
net/tap.c | 2 ++
12
include/hw/compat.h | 4 ++++
12
1 file changed, 2 insertions(+)
13
include/hw/pci/pci.h | 1 +
14
qemu-options.hx | 2 +-
15
4 files changed, 19 insertions(+), 1 deletion(-)
16
13
17
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
14
diff --git a/net/tap.c b/net/tap.c
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/net/eepro100.c
16
--- a/net/tap.c
20
+++ b/hw/net/eepro100.c
17
+++ b/net/tap.c
21
@@ -XXX,XX +XXX,XX @@ typedef struct {
18
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
22
const char *name;
19
if (ret < 0) {
23
const char *desc;
20
error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
24
uint16_t device_id;
21
name, fd);
25
+ uint16_t alt_device_id;
22
+ close(fd);
26
uint8_t revision;
23
return -1;
27
uint16_t subsystem_vendor_id;
24
}
28
uint16_t subsystem_id;
25
29
@@ -XXX,XX +XXX,XX @@ typedef struct {
26
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
30
/* Quasi static device properties (no need to save them). */
27
vhostfdname, vnet_hdr, fd, &err);
31
uint16_t stats_size;
28
if (err) {
32
bool has_extended_tcb_support;
29
error_propagate(errp, err);
33
+ bool use_alt_device_id;
30
+ close(fd);
34
} EEPRO100State;
31
return -1;
35
32
}
36
/* Word indices in EEPROM. */
33
} else if (tap->has_fds) {
37
@@ -XXX,XX +XXX,XX @@ static void e100_nic_realize(PCIDevice *pci_dev, Error **errp)
38
39
TRACE(OTHER, logout("\n"));
40
41
+ /* By default, the i82559a adapter uses the legacy PCI ID (for the
42
+ * i82557). This allows the PCI ID to be changed to the alternate
43
+ * i82559 ID if needed.
44
+ */
45
+ if (s->use_alt_device_id && strcmp(info->name, "i82559a") == 0) {
46
+ pci_config_set_device_id(s->dev.config, info->alt_device_id);
47
+ }
48
+
49
s->device = info->device;
50
51
e100_pci_reset(s, &local_err);
52
@@ -XXX,XX +XXX,XX @@ static E100PCIDeviceInfo e100_devices[] = {
53
.desc = "Intel i82559A Ethernet",
54
.device = i82559A,
55
.device_id = PCI_DEVICE_ID_INTEL_82557,
56
+ .alt_device_id = PCI_DEVICE_ID_INTEL_82559,
57
.revision = 0x06,
58
.stats_size = 80,
59
.has_extended_tcb_support = true,
60
@@ -XXX,XX +XXX,XX @@ static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s)
61
62
static Property e100_properties[] = {
63
DEFINE_NIC_PROPERTIES(EEPRO100State, conf),
64
+ DEFINE_PROP_BOOL("x-use-alt-device-id", EEPRO100State, use_alt_device_id,
65
+ true),
66
DEFINE_PROP_END_OF_LIST(),
67
};
68
69
diff --git a/include/hw/compat.h b/include/hw/compat.h
70
index XXXXXXX..XXXXXXX 100644
71
--- a/include/hw/compat.h
72
+++ b/include/hw/compat.h
73
@@ -XXX,XX +XXX,XX @@
74
.driver = "virtio-tablet-device",\
75
.property = "wheel-axis",\
76
.value = "false",\
77
+ },{\
78
+ .driver = "i82559a",\
79
+ .property = "x-use-alt-device-id",\
80
+ .value = "false",\
81
},
82
83
#define HW_COMPAT_2_9 \
84
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
85
index XXXXXXX..XXXXXXX 100644
86
--- a/include/hw/pci/pci.h
87
+++ b/include/hw/pci/pci.h
88
@@ -XXX,XX +XXX,XX @@ extern bool pci_available;
89
/* Intel (0x8086) */
90
#define PCI_DEVICE_ID_INTEL_82551IT 0x1209
91
#define PCI_DEVICE_ID_INTEL_82557 0x1229
92
+#define PCI_DEVICE_ID_INTEL_82559 0x1030
93
#define PCI_DEVICE_ID_INTEL_82801IR 0x2922
94
95
/* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */
96
diff --git a/qemu-options.hx b/qemu-options.hx
97
index XXXXXXX..XXXXXXX 100644
98
--- a/qemu-options.hx
99
+++ b/qemu-options.hx
100
@@ -XXX,XX +XXX,XX @@ that the card should have; this option currently only affects virtio cards; set
101
@var{v} = 0 to disable MSI-X. If no @option{-net} option is specified, a single
102
NIC is created. QEMU can emulate several different models of network card.
103
Valid values for @var{type} are
104
-@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559er},
105
+@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559a}, @code{i82559er},
106
@code{ne2k_pci}, @code{ne2k_isa}, @code{pcnet}, @code{rtl8139},
107
@code{e1000}, @code{smc91c111}, @code{lance} and @code{mcf_fec}.
108
Not all devices are supported on all targets. Use @code{-net nic,model=help}
109
--
34
--
110
2.7.4
35
2.7.4
111
36
112
37
diff view generated by jsdifflib
1
From: Mike Nawrocki <michael.nawrocki@gtri.gatech.edu>
1
From: Keqian Zhu <zhukeqian1@huawei.com>
2
2
3
The simple transmission mode was treating the area immediately after the
3
Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts)
4
transmit command block (TCB) as if it were a transmit buffer descriptor,
4
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
5
when in reality it is simply the packet data. This change simply copies
6
the data following the TCB into the packet buffer.
7
8
Signed-off-by: Mike Nawrocki <michael.nawrocki@gtri.gatech.edu>
9
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
10
Signed-off-by: Jason Wang <jasowang@redhat.com>
5
Signed-off-by: Jason Wang <jasowang@redhat.com>
11
---
6
---
12
hw/net/eepro100.c | 18 +++---------------
7
net/tap.c | 3 ++-
13
1 file changed, 3 insertions(+), 15 deletions(-)
8
1 file changed, 2 insertions(+), 1 deletion(-)
14
9
15
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
10
diff --git a/net/tap.c b/net/tap.c
16
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/net/eepro100.c
12
--- a/net/tap.c
18
+++ b/hw/net/eepro100.c
13
+++ b/net/tap.c
19
@@ -XXX,XX +XXX,XX @@ static void tx_command(EEPRO100State *s)
14
@@ -XXX,XX +XXX,XX @@ free_fail:
20
}
15
script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
21
assert(tcb_bytes <= sizeof(buf));
16
}
22
while (size < tcb_bytes) {
17
if (!downscript) {
23
- uint32_t tx_buffer_address = ldl_le_pci_dma(&s->dev, tbd_address);
18
- downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
24
- uint16_t tx_buffer_size = lduw_le_pci_dma(&s->dev, tbd_address + 4);
19
+ downscript = default_downscript =
25
-#if 0
20
+ get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT);
26
- uint16_t tx_buffer_el = lduw_le_pci_dma(&s->dev, tbd_address + 6);
21
}
27
-#endif
22
28
- if (tx_buffer_size == 0) {
23
if (tap->has_ifname) {
29
- /* Prevent an endless loop. */
30
- logout("loop in %s:%u\n", __FILE__, __LINE__);
31
- break;
32
- }
33
- tbd_address += 8;
34
TRACE(RXTX, logout
35
("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n",
36
- tx_buffer_address, tx_buffer_size));
37
- tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size);
38
- pci_dma_read(&s->dev, tx_buffer_address, &buf[size], tx_buffer_size);
39
- size += tx_buffer_size;
40
+ tbd_address, tcb_bytes));
41
+ pci_dma_read(&s->dev, tbd_address, &buf[size], tcb_bytes);
42
+ size += tcb_bytes;
43
}
44
if (tbd_array == 0xffffffff) {
45
/* Simplified mode. Was already handled by code above. */
46
--
24
--
47
2.7.4
25
2.7.4
48
26
49
27
diff view generated by jsdifflib