1 | The following changes since commit 199e19ee538eb61fd08b1c1ee5aa838ebdcc968e: | 1 | The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging (2017-06-05 15:28:12 +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 6701e5514beab7b781a10424a94e9850c707287c: | 9 | for you to fetch changes up to 9925990d01a92564af55f6f69d0f5f59b47609b1: |
10 | 10 | ||
11 | Revert "Change net/socket.c to use socket_*() functions" again (2017-06-07 10:58:31 +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 | Daniel P. Berrange (1): | 16 | Keqian Zhu (1): |
17 | Revert "Change net/socket.c to use socket_*() functions" again | 17 | net: Use correct default-path macro for downscript |
18 | 18 | ||
19 | Mao Zhongyi (1): | 19 | Paolo Bonzini (1): |
20 | net/rocker: Cleanup the useless return value check | 20 | net: do not exit on "netdev_add help" monitor command |
21 | 21 | ||
22 | hw/net/rocker/rocker.c | 9 ++-- | 22 | Prasad J Pandit (1): |
23 | hw/net/rocker/rocker_desc.c | 4 +- | 23 | hw/net/e1000e: advance desc_offset in case of null descriptor |
24 | net/socket.c | 127 +++++++++++++++++++------------------------- | 24 | |
25 | 3 files changed, 60 insertions(+), 80 deletions(-) | 25 | Yuri Benditovich (1): |
26 | net: purge queued rx packets on queue deletion | ||
27 | |||
28 | yuanjungong (1): | ||
29 | tap: fix a memory leak | ||
30 | |||
31 | hw/net/e1000e_core.c | 8 +++--- | ||
32 | include/net/net.h | 1 + | ||
33 | monitor/hmp-cmds.c | 6 ++++ | ||
34 | net/net.c | 80 +++++++++++++++++++++++++++------------------------- | ||
35 | net/tap.c | 5 +++- | ||
36 | 5 files changed, 57 insertions(+), 43 deletions(-) | ||
26 | 37 | ||
27 | 38 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
1 | 2 | ||
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. | ||
8 | |||
9 | Reported-by: Cheol-woo Myung <330cjfdn@gmail.com> | ||
10 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
11 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
12 | --- | ||
13 | hw/net/e1000e_core.c | 8 ++++---- | ||
14 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
15 | |||
16 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/net/e1000e_core.c | ||
19 | +++ b/hw/net/e1000e_core.c | ||
20 | @@ -XXX,XX +XXX,XX @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt, | ||
21 | (const char *) &fcs_pad, e1000x_fcs_len(core->mac)); | ||
22 | } | ||
23 | } | ||
24 | - desc_offset += desc_size; | ||
25 | - if (desc_offset >= total_size) { | ||
26 | - is_last = true; | ||
27 | - } | ||
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); | ||
38 | -- | ||
39 | 2.7.4 | ||
40 | |||
41 | diff view generated by jsdifflib |
1 | From: "Daniel P. Berrange" <berrange@redhat.com> | 1 | From: Paolo Bonzini <pbonzini@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | This reverts commit 883e4f7624e10b98d16d9adaffb8b1795664d899. | 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 | This code changed net/socket.c from using socket()+connect(), | 8 | "netdev_add help" is not fixed by this patch; that is left for |
6 | to using socket_connect(). In theory this is great, but in | 9 | later work. |
7 | practice this has completely broken the ability to connect | ||
8 | the frontend and backend: | ||
9 | 10 | ||
10 | $ ./x86_64-softmmu/qemu-system-x86_64 \ | 11 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
11 | -device e1000,id=e0,netdev=hn0,mac=DE:AD:BE:EF:AF:05 \ | ||
12 | -netdev socket,id=hn0,connect=localhost:1234 | ||
13 | qemu-system-x86_64: -device e1000,id=e0,netdev=hn0,mac=DE:AD:BE:EF:AF:05: Property 'e1000.netdev' can't find value 'hn0' | ||
14 | |||
15 | The old code would call net_socket_fd_init() synchronously, | ||
16 | while letting the connect() complete in the backgorund. The | ||
17 | new code moved net_socket_fd_init() so that it is only called | ||
18 | after connect() completes in the background. | ||
19 | |||
20 | Thus at the time we initialize the NIC frontend, the backend | ||
21 | does not exist. | ||
22 | |||
23 | The socket_connect() conversion as done is a bad fit for the | ||
24 | current code, since it did not try to change the way it deals | ||
25 | with async connection completion. Rather than try to fix this, | ||
26 | just revert the socket_connect() conversion entirely. | ||
27 | |||
28 | The code is about to be converted to use QIOChannel which | ||
29 | will let the problem be solved in a cleaner manner. This | ||
30 | revert is more suitable for stable branches in the meantime. | ||
31 | |||
32 | Signed-off-by: Daniel P. Berrange <berrange@redhat.com> | ||
33 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
34 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 12 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
35 | --- | 13 | --- |
36 | net/socket.c | 127 ++++++++++++++++++++++++++--------------------------------- | 14 | include/net/net.h | 1 + |
37 | 1 file changed, 56 insertions(+), 71 deletions(-) | 15 | monitor/hmp-cmds.c | 6 +++++ |
16 | net/net.c | 68 +++++++++++++++++++++++++++--------------------------- | ||
17 | 3 files changed, 41 insertions(+), 34 deletions(-) | ||
38 | 18 | ||
39 | diff --git a/net/socket.c b/net/socket.c | 19 | diff --git a/include/net/net.h b/include/net/net.h |
40 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
41 | --- a/net/socket.c | 21 | --- a/include/net/net.h |
42 | +++ b/net/socket.c | 22 | +++ b/include/net/net.h |
43 | @@ -XXX,XX +XXX,XX @@ static int net_socket_listen_init(NetClientState *peer, | 23 | @@ -XXX,XX +XXX,XX @@ extern const char *host_net_devices[]; |
24 | |||
25 | /* from net.c */ | ||
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 | { | 44 | { |
45 | NetClientState *nc; | 45 | Error *err = NULL; |
46 | NetSocketState *s; | 46 | QemuOpts *opts; |
47 | - SocketAddress *saddr; | 47 | + const char *type = qdict_get_try_str(qdict, "type"); |
48 | - int ret; | 48 | |
49 | - Error *local_error = NULL; | 49 | + if (type && is_help_option(type)) { |
50 | + struct sockaddr_in saddr; | 50 | + show_netdevs(); |
51 | + int fd, ret; | 51 | + return; |
52 | |||
53 | - saddr = socket_parse(host_str, &local_error); | ||
54 | - if (saddr == NULL) { | ||
55 | - error_report_err(local_error); | ||
56 | + if (parse_host_port(&saddr, host_str) < 0) | ||
57 | + return -1; | ||
58 | + | ||
59 | + fd = qemu_socket(PF_INET, SOCK_STREAM, 0); | ||
60 | + if (fd < 0) { | ||
61 | + perror("socket"); | ||
62 | return -1; | ||
63 | } | ||
64 | + qemu_set_nonblock(fd); | ||
65 | + | ||
66 | + socket_set_fast_reuse(fd); | ||
67 | |||
68 | - ret = socket_listen(saddr, &local_error); | ||
69 | + ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)); | ||
70 | if (ret < 0) { | ||
71 | - qapi_free_SocketAddress(saddr); | ||
72 | - error_report_err(local_error); | ||
73 | + perror("bind"); | ||
74 | + closesocket(fd); | ||
75 | + return -1; | ||
76 | + } | 52 | + } |
77 | + ret = listen(fd, 0); | 53 | opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err); |
78 | + if (ret < 0) { | 54 | if (err) { |
79 | + perror("listen"); | 55 | goto out; |
80 | + closesocket(fd); | 56 | diff --git a/net/net.c b/net/net.c |
81 | return -1; | 57 | index XXXXXXX..XXXXXXX 100644 |
82 | } | 58 | --- a/net/net.c |
83 | 59 | +++ b/net/net.c | |
84 | nc = qemu_new_net_client(&net_socket_info, peer, model, name); | 60 | @@ -XXX,XX +XXX,XX @@ |
85 | s = DO_UPCAST(NetSocketState, nc, nc); | 61 | #include "qemu/config-file.h" |
86 | s->fd = -1; | 62 | #include "qemu/ctype.h" |
87 | - s->listen_fd = ret; | 63 | #include "qemu/iov.h" |
88 | + s->listen_fd = fd; | 64 | +#include "qemu/qemu-print.h" |
89 | s->nc.link_down = true; | 65 | #include "qemu/main-loop.h" |
90 | net_socket_rs_init(&s->rs, net_socket_rs_finalize); | 66 | #include "qemu/option.h" |
91 | 67 | #include "qapi/error.h" | |
92 | qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s); | 68 | @@ -XXX,XX +XXX,XX @@ static int net_client_init1(const Netdev *netdev, bool is_netdev, Error **errp) |
93 | - qapi_free_SocketAddress(saddr); | ||
94 | return 0; | 69 | return 0; |
95 | } | 70 | } |
96 | 71 | ||
97 | -typedef struct { | 72 | -static void show_netdevs(void) |
98 | - NetClientState *peer; | 73 | +void show_netdevs(void) |
99 | - SocketAddress *saddr; | 74 | { |
100 | - char *model; | 75 | int idx; |
101 | - char *name; | 76 | const char *available_netdevs[] = { |
102 | -} socket_connect_data; | 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"); | ||
103 | - | 94 | - |
104 | -static void socket_connect_data_free(socket_connect_data *c) | 95 | - if (is_netdev && type && is_help_option(type)) { |
105 | -{ | 96 | - show_netdevs(); |
106 | - qapi_free_SocketAddress(c->saddr); | 97 | - exit(0); |
107 | - g_free(c->model); | 98 | - } else { |
108 | - g_free(c->name); | 99 | - /* Parse convenience option format ip6-net=fec0::0[/64] */ |
109 | - g_free(c); | 100 | - const char *ip6_net = qemu_opt_get(opts, "ipv6-net"); |
110 | -} | 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 | - } | ||
111 | - | 135 | - |
112 | -static void net_socket_connected(int fd, Error *err, void *opaque) | 136 | - qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort); |
113 | -{ | 137 | - qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len, |
114 | - socket_connect_data *c = opaque; | 138 | - &error_abort); |
115 | - NetSocketState *s; | 139 | - qemu_opt_unset(opts, "ipv6-net"); |
116 | - char *addr_str = NULL; | 140 | + /* Handle user-specified prefix length. */ |
117 | - Error *local_error = NULL; | 141 | + if (substrings[1] && |
118 | - | 142 | + qemu_strtoul(substrings[1], NULL, 10, &prefix_len)) |
119 | - addr_str = socket_address_to_string(c->saddr, &local_error); | 143 | + { |
120 | - if (addr_str == NULL) { | 144 | + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, |
121 | - error_report_err(local_error); | 145 | + "ipv6-prefixlen", "a number"); |
122 | - closesocket(fd); | 146 | + goto out; |
123 | - goto end; | 147 | } |
124 | - } | 148 | + |
125 | - | 149 | + qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort); |
126 | - s = net_socket_fd_init(c->peer, c->model, c->name, fd, true); | 150 | + qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len, |
127 | - if (!s) { | 151 | + &error_abort); |
128 | - closesocket(fd); | 152 | + qemu_opt_unset(opts, "ipv6-net"); |
129 | - goto end; | 153 | } |
130 | - } | 154 | |
131 | - | 155 | /* Create an ID for -net if the user did not specify one */ |
132 | - snprintf(s->nc.info_str, sizeof(s->nc.info_str), | 156 | @@ -XXX,XX +XXX,XX @@ static int net_init_client(void *dummy, QemuOpts *opts, Error **errp) |
133 | - "socket: connect to %s", addr_str); | 157 | |
134 | - | 158 | static int net_init_netdev(void *dummy, QemuOpts *opts, Error **errp) |
135 | -end: | ||
136 | - g_free(addr_str); | ||
137 | - socket_connect_data_free(c); | ||
138 | -} | ||
139 | - | ||
140 | static int net_socket_connect_init(NetClientState *peer, | ||
141 | const char *model, | ||
142 | const char *name, | ||
143 | const char *host_str) | ||
144 | { | 159 | { |
145 | - socket_connect_data *c = g_new0(socket_connect_data, 1); | 160 | + const char *type = qemu_opt_get(opts, "type"); |
146 | - int fd = -1; | 161 | + |
147 | - Error *local_error = NULL; | 162 | + if (type && is_help_option(type)) { |
148 | + NetSocketState *s; | 163 | + show_netdevs(); |
149 | + int fd, connected, ret; | 164 | + exit(0); |
150 | + struct sockaddr_in saddr; | ||
151 | |||
152 | - c->peer = peer; | ||
153 | - c->model = g_strdup(model); | ||
154 | - c->name = g_strdup(name); | ||
155 | - c->saddr = socket_parse(host_str, &local_error); | ||
156 | - if (c->saddr == NULL) { | ||
157 | - goto err; | ||
158 | - } | ||
159 | + if (parse_host_port(&saddr, host_str) < 0) | ||
160 | + return -1; | ||
161 | |||
162 | - fd = socket_connect(c->saddr, net_socket_connected, c, &local_error); | ||
163 | + fd = qemu_socket(PF_INET, SOCK_STREAM, 0); | ||
164 | if (fd < 0) { | ||
165 | - goto err; | ||
166 | + perror("socket"); | ||
167 | + return -1; | ||
168 | } | ||
169 | + qemu_set_nonblock(fd); | ||
170 | |||
171 | + connected = 0; | ||
172 | + for(;;) { | ||
173 | + ret = connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)); | ||
174 | + if (ret < 0) { | ||
175 | + if (errno == EINTR || errno == EWOULDBLOCK) { | ||
176 | + /* continue */ | ||
177 | + } else if (errno == EINPROGRESS || | ||
178 | + errno == EALREADY || | ||
179 | + errno == EINVAL) { | ||
180 | + break; | ||
181 | + } else { | ||
182 | + perror("connect"); | ||
183 | + closesocket(fd); | ||
184 | + return -1; | ||
185 | + } | ||
186 | + } else { | ||
187 | + connected = 1; | ||
188 | + break; | ||
189 | + } | ||
190 | + } | 165 | + } |
191 | + s = net_socket_fd_init(peer, model, name, fd, connected); | 166 | return net_client_init(opts, true, errp); |
192 | + if (!s) | ||
193 | + return -1; | ||
194 | + snprintf(s->nc.info_str, sizeof(s->nc.info_str), | ||
195 | + "socket: connect to %s:%d", | ||
196 | + inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); | ||
197 | return 0; | ||
198 | - | ||
199 | -err: | ||
200 | - error_report_err(local_error); | ||
201 | - socket_connect_data_free(c); | ||
202 | - return -1; | ||
203 | } | 167 | } |
204 | 168 | ||
205 | static int net_socket_mcast_init(NetClientState *peer, | ||
206 | -- | 169 | -- |
207 | 2.7.4 | 170 | 2.7.4 |
208 | 171 | ||
209 | 172 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Yuri Benditovich <yuri.benditovich@daynix.com> | ||
1 | 2 | ||
3 | https://bugzilla.redhat.com/show_bug.cgi?id=1829272 | ||
4 | When deleting queue pair, purge pending RX packets if any. | ||
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) | ||
14 | |||
15 | Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> | ||
16 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
17 | --- | ||
18 | net/net.c | 12 ++++++++---- | ||
19 | 1 file changed, 8 insertions(+), 4 deletions(-) | ||
20 | |||
21 | diff --git a/net/net.c b/net/net.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/net/net.c | ||
24 | +++ b/net/net.c | ||
25 | @@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic) | ||
26 | |||
27 | qemu_macaddr_set_free(&nic->conf->macaddr); | ||
28 | |||
29 | - /* If this is a peer NIC and peer has already been deleted, free it now. */ | ||
30 | - if (nic->peer_deleted) { | ||
31 | - for (i = 0; i < queues; i++) { | ||
32 | - qemu_free_net_client(qemu_get_subqueue(nic, i)->peer); | ||
33 | + for (i = 0; i < queues; i++) { | ||
34 | + NetClientState *nc = qemu_get_subqueue(nic, i); | ||
35 | + /* If this is a peer NIC and peer has already been deleted, free it now. */ | ||
36 | + if (nic->peer_deleted) { | ||
37 | + qemu_free_net_client(nc->peer); | ||
38 | + } else if (nc->peer) { | ||
39 | + /* if there are RX packets pending, complete them */ | ||
40 | + qemu_purge_queued_packets(nc->peer); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | -- | ||
45 | 2.7.4 | ||
46 | |||
47 | diff view generated by jsdifflib |
1 | From: Mao Zhongyi <maozy.fnst@cn.fujitsu.com> | 1 | From: yuanjungong <ruc_gongyuanjun@163.com> |
---|---|---|---|
2 | 2 | ||
3 | None of pci_dma_read()'s callers check the return value except | 3 | Close fd before returning. |
4 | rocker. There is no need to check it because it always return | ||
5 | 0. So the check work is useless. Remove it entirely. | ||
6 | 4 | ||
7 | Suggested-by: Markus Armbruster <armbru@redhat.com> | 5 | Buglink: https://bugs.launchpad.net/qemu/+bug/1904486 |
8 | Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.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/rocker/rocker.c | 9 +++------ | 11 | net/tap.c | 2 ++ |
12 | hw/net/rocker/rocker_desc.c | 4 +--- | 12 | 1 file changed, 2 insertions(+) |
13 | 2 files changed, 4 insertions(+), 9 deletions(-) | ||
14 | 13 | ||
15 | diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c | 14 | diff --git a/net/tap.c b/net/tap.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/net/rocker/rocker.c | 16 | --- a/net/tap.c |
18 | +++ b/hw/net/rocker/rocker.c | 17 | +++ b/net/tap.c |
19 | @@ -XXX,XX +XXX,XX @@ static int tx_consume(Rocker *r, DescInfo *info) | 18 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, |
20 | goto err_no_mem; | 19 | if (ret < 0) { |
20 | error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d", | ||
21 | name, fd); | ||
22 | + close(fd); | ||
23 | return -1; | ||
21 | } | 24 | } |
22 | 25 | ||
23 | - if (pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base, | 26 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, |
24 | - iov[iovcnt].iov_len)) { | 27 | vhostfdname, vnet_hdr, fd, &err); |
25 | - err = -ROCKER_ENXIO; | 28 | if (err) { |
26 | - goto err_bad_io; | 29 | error_propagate(errp, err); |
27 | - } | 30 | + close(fd); |
28 | + pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base, | 31 | return -1; |
29 | + iov[iovcnt].iov_len); | 32 | } |
30 | + | 33 | } else if (tap->has_fds) { |
31 | iovcnt++; | ||
32 | } | ||
33 | |||
34 | @@ -XXX,XX +XXX,XX @@ static int tx_consume(Rocker *r, DescInfo *info) | ||
35 | err = fp_port_eg(r->fp_port[port], iov, iovcnt); | ||
36 | |||
37 | err_too_many_frags: | ||
38 | -err_bad_io: | ||
39 | err_no_mem: | ||
40 | err_bad_attr: | ||
41 | for (i = 0; i < ROCKER_TX_FRAGS_MAX; i++) { | ||
42 | diff --git a/hw/net/rocker/rocker_desc.c b/hw/net/rocker/rocker_desc.c | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/hw/net/rocker/rocker_desc.c | ||
45 | +++ b/hw/net/rocker/rocker_desc.c | ||
46 | @@ -XXX,XX +XXX,XX @@ char *desc_get_buf(DescInfo *info, bool read_only) | ||
47 | return NULL; | ||
48 | } | ||
49 | |||
50 | - if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size)) { | ||
51 | - return NULL; | ||
52 | - } | ||
53 | + pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size); | ||
54 | |||
55 | return info->buf; | ||
56 | } | ||
57 | -- | 34 | -- |
58 | 2.7.4 | 35 | 2.7.4 |
59 | 36 | ||
60 | 37 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Keqian Zhu <zhukeqian1@huawei.com> | ||
1 | 2 | ||
3 | Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts) | ||
4 | Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> | ||
5 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
6 | --- | ||
7 | net/tap.c | 3 ++- | ||
8 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
9 | |||
10 | diff --git a/net/tap.c b/net/tap.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/net/tap.c | ||
13 | +++ b/net/tap.c | ||
14 | @@ -XXX,XX +XXX,XX @@ free_fail: | ||
15 | script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT); | ||
16 | } | ||
17 | if (!downscript) { | ||
18 | - downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT); | ||
19 | + downscript = default_downscript = | ||
20 | + get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT); | ||
21 | } | ||
22 | |||
23 | if (tap->has_ifname) { | ||
24 | -- | ||
25 | 2.7.4 | ||
26 | |||
27 | diff view generated by jsdifflib |