1 | The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06: | 1 | The following changes since commit d90f154867ec0ec22fd719164b88716e8fd48672: |
---|---|---|---|
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/dg-gitlab/tags/ppc-for-6.1-20210504' into staging (2021-05-05 20:29:14 +0100) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the git repository at: |
6 | 6 | ||
7 | https://github.com/jasowang/qemu.git tags/net-pull-request | 7 | https://github.com/jasowang/qemu.git tags/net-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 9925990d01a92564af55f6f69d0f5f59b47609b1: | 9 | for you to fetch changes up to 7ec0d72cd519e569b6d1ef11be770beb67dd0824: |
10 | 10 | ||
11 | net: Use correct default-path macro for downscript (2020-11-24 10:40:17 +0800) | 11 | tap-bsd: Remove special casing for older OpenBSD releases (2021-05-26 16:20:27 +0800) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | 14 | ||
15 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
16 | Keqian Zhu (1): | 16 | Brad Smith (1): |
17 | net: Use correct default-path macro for downscript | 17 | tap-bsd: Remove special casing for older OpenBSD releases |
18 | 18 | ||
19 | Paolo Bonzini (1): | 19 | Guenter Roeck (1): |
20 | net: do not exit on "netdev_add help" monitor command | 20 | hw/net/imx_fec: return 0xffff when accessing non-existing PHY |
21 | 21 | ||
22 | Prasad J Pandit (1): | 22 | Laurent Vivier (1): |
23 | hw/net/e1000e: advance desc_offset in case of null descriptor | 23 | virtio-net: failover: add missing remove_migration_state_change_notifier() |
24 | 24 | ||
25 | Yuri Benditovich (1): | 25 | hw/net/imx_fec.c | 8 +++----- |
26 | net: purge queued rx packets on queue deletion | 26 | hw/net/trace-events | 2 ++ |
27 | 27 | hw/net/virtio-net.c | 1 + | |
28 | yuanjungong (1): | 28 | net/tap-bsd.c | 8 -------- |
29 | tap: fix a memory leak | 29 | 4 files changed, 6 insertions(+), 13 deletions(-) |
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(-) | ||
37 | 30 | ||
38 | 31 | ||
32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
2 | 1 | ||
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 |
Deleted patch | |||
---|---|---|---|
1 | From: Paolo Bonzini <pbonzini@redhat.com> | ||
2 | 1 | ||
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. | ||
7 | |||
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> | ||
12 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
13 | --- | ||
14 | include/net/net.h | 1 + | ||
15 | monitor/hmp-cmds.c | 6 +++++ | ||
16 | net/net.c | 68 +++++++++++++++++++++++++++--------------------------- | ||
17 | 3 files changed, 41 insertions(+), 34 deletions(-) | ||
18 | |||
19 | diff --git a/include/net/net.h b/include/net/net.h | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/include/net/net.h | ||
22 | +++ b/include/net/net.h | ||
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 | { | ||
45 | Error *err = NULL; | ||
46 | QemuOpts *opts; | ||
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 | } | ||
71 | |||
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 | } | ||
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 | -- | ||
170 | 2.7.4 | ||
171 | |||
172 | diff view generated by jsdifflib |
1 | From: Keqian Zhu <zhukeqian1@huawei.com> | 1 | From: Guenter Roeck <linux@roeck-us.net> |
---|---|---|---|
2 | 2 | ||
3 | Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts) | 3 | If a PHY does not exist, attempts to read from it should return 0xffff. |
4 | Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> | 4 | Otherwise the Linux kernel will believe that a PHY is there and select |
5 | the non-existing PHY. This in turn will result in network errors later | ||
6 | on since the real PHY is not selected or configured. | ||
7 | |||
8 | Since reading from or writing to a non-existing PHY is not an emulation | ||
9 | error, replace guest error messages with traces. | ||
10 | |||
11 | Fixes: 461c51ad4275 ("Add a phy-num property to the i.MX FEC emulator") | ||
12 | Cc: Jean-Christophe Dubois <jcd@tribudubois.net> | ||
13 | Reviewed-by: Bin Meng <bmeng.cn@gmail.com> | ||
14 | Tested-by: Bin Meng <bmeng.cn@gmail.com> | ||
15 | Reviewed-by: Philippe Mathieu-Daud茅 <f4bug@amsat.org> | ||
16 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
5 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 17 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
6 | --- | 18 | --- |
7 | net/tap.c | 3 ++- | 19 | hw/net/imx_fec.c | 8 +++----- |
8 | 1 file changed, 2 insertions(+), 1 deletion(-) | 20 | hw/net/trace-events | 2 ++ |
21 | 2 files changed, 5 insertions(+), 5 deletions(-) | ||
9 | 22 | ||
10 | diff --git a/net/tap.c b/net/tap.c | 23 | diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c |
11 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/net/tap.c | 25 | --- a/hw/net/imx_fec.c |
13 | +++ b/net/tap.c | 26 | +++ b/hw/net/imx_fec.c |
14 | @@ -XXX,XX +XXX,XX @@ free_fail: | 27 | @@ -XXX,XX +XXX,XX @@ static uint32_t imx_phy_read(IMXFECState *s, int reg) |
15 | script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT); | 28 | uint32_t phy = reg / 32; |
16 | } | 29 | |
17 | if (!downscript) { | 30 | if (phy != s->phy_num) { |
18 | - downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT); | 31 | - qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad phy num %u\n", |
19 | + downscript = default_downscript = | 32 | - TYPE_IMX_FEC, __func__, phy); |
20 | + get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT); | 33 | - return 0; |
21 | } | 34 | + trace_imx_phy_read_num(phy, s->phy_num); |
22 | 35 | + return 0xffff; | |
23 | if (tap->has_ifname) { | 36 | } |
37 | |||
38 | reg %= 32; | ||
39 | @@ -XXX,XX +XXX,XX @@ static void imx_phy_write(IMXFECState *s, int reg, uint32_t val) | ||
40 | uint32_t phy = reg / 32; | ||
41 | |||
42 | if (phy != s->phy_num) { | ||
43 | - qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad phy num %u\n", | ||
44 | - TYPE_IMX_FEC, __func__, phy); | ||
45 | + trace_imx_phy_write_num(phy, s->phy_num); | ||
46 | return; | ||
47 | } | ||
48 | |||
49 | diff --git a/hw/net/trace-events b/hw/net/trace-events | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/hw/net/trace-events | ||
52 | +++ b/hw/net/trace-events | ||
53 | @@ -XXX,XX +XXX,XX @@ i82596_channel_attention(void *s) "%p: Received CHANNEL ATTENTION" | ||
54 | |||
55 | # imx_fec.c | ||
56 | imx_phy_read(uint32_t val, int phy, int reg) "0x%04"PRIx32" <= phy[%d].reg[%d]" | ||
57 | +imx_phy_read_num(int phy, int configured) "read request from unconfigured phy %d (configured %d)" | ||
58 | imx_phy_write(uint32_t val, int phy, int reg) "0x%04"PRIx32" => phy[%d].reg[%d]" | ||
59 | +imx_phy_write_num(int phy, int configured) "write request to unconfigured phy %d (configured %d)" | ||
60 | imx_phy_update_link(const char *s) "%s" | ||
61 | imx_phy_reset(void) "" | ||
62 | imx_fec_read_bd(uint64_t addr, int flags, int len, int data) "tx_bd 0x%"PRIx64" flags 0x%04x len %d data 0x%08x" | ||
24 | -- | 63 | -- |
25 | 2.7.4 | 64 | 2.7.4 |
26 | 65 | ||
27 | 66 | diff view generated by jsdifflib |
1 | From: Yuri Benditovich <yuri.benditovich@daynix.com> | 1 | From: Laurent Vivier <lvivier@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | https://bugzilla.redhat.com/show_bug.cgi?id=1829272 | 3 | In the failover case configuration, virtio_net_device_realize() uses an |
4 | When deleting queue pair, purge pending RX packets if any. | 4 | add_migration_state_change_notifier() to add a state notifier, but this |
5 | Example of problematic flow: | 5 | notifier is not removed by the unrealize function when the virtio-net |
6 | 1. Bring up q35 VM with tap (vhost off) and virtio-net or e1000e | 6 | card is unplugged. |
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 | 7 | ||
15 | Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> | 8 | If the card is unplugged and a migration is started, the notifier is |
9 | called and as it is not valid anymore QEMU crashes. | ||
10 | |||
11 | This patch fixes the problem by adding the | ||
12 | remove_migration_state_change_notifier() in virtio_net_device_unrealize(). | ||
13 | |||
14 | The problem can be reproduced with: | ||
15 | |||
16 | $ qemu-system-x86_64 -enable-kvm -m 1g -M q35 \ | ||
17 | -device pcie-root-port,slot=4,id=root1 \ | ||
18 | -device pcie-root-port,slot=5,id=root2 \ | ||
19 | -device virtio-net-pci,id=net1,mac=52:54:00:6f:55:cc,failover=on,bus=root1 \ | ||
20 | -monitor stdio disk.qcow2 | ||
21 | (qemu) device_del net1 | ||
22 | (qemu) migrate "exec:gzip -c > STATEFILE.gz" | ||
23 | |||
24 | Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. | ||
25 | 0x0000000000000000 in ?? () | ||
26 | (gdb) bt | ||
27 | #0 0x0000000000000000 in () | ||
28 | #1 0x0000555555d726d7 in notifier_list_notify (...) | ||
29 | at .../util/notify.c:39 | ||
30 | #2 0x0000555555842c1a in migrate_fd_connect (...) | ||
31 | at .../migration/migration.c:3975 | ||
32 | #3 0x0000555555950f7d in migration_channel_connect (...) | ||
33 | error@entry=0x0) at .../migration/channel.c:107 | ||
34 | #4 0x0000555555910922 in exec_start_outgoing_migration (...) | ||
35 | at .../migration/exec.c:42 | ||
36 | |||
37 | Reported-by: Igor Mammedov <imammedo@redhat.com> | ||
38 | Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||
39 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
40 | Signed-off-by: Laurent Vivier <lvivier@redhat.com> | ||
16 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 41 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
17 | --- | 42 | --- |
18 | net/net.c | 12 ++++++++---- | 43 | hw/net/virtio-net.c | 1 + |
19 | 1 file changed, 8 insertions(+), 4 deletions(-) | 44 | 1 file changed, 1 insertion(+) |
20 | 45 | ||
21 | diff --git a/net/net.c b/net/net.c | 46 | diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c |
22 | index XXXXXXX..XXXXXXX 100644 | 47 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/net/net.c | 48 | --- a/hw/net/virtio-net.c |
24 | +++ b/net/net.c | 49 | +++ b/hw/net/virtio-net.c |
25 | @@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic) | 50 | @@ -XXX,XX +XXX,XX @@ static void virtio_net_device_unrealize(DeviceState *dev) |
26 | 51 | ||
27 | qemu_macaddr_set_free(&nic->conf->macaddr); | 52 | if (n->failover) { |
28 | 53 | device_listener_unregister(&n->primary_listener); | |
29 | - /* If this is a peer NIC and peer has already been deleted, free it now. */ | 54 | + remove_migration_state_change_notifier(&n->migration_state); |
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 | } | 55 | } |
43 | 56 | ||
57 | max_queues = n->multiqueue ? n->max_queues : 1; | ||
44 | -- | 58 | -- |
45 | 2.7.4 | 59 | 2.7.4 |
46 | 60 | ||
47 | 61 | diff view generated by jsdifflib |
1 | From: yuanjungong <ruc_gongyuanjun@163.com> | 1 | From: Brad Smith <brad@comstyle.com> |
---|---|---|---|
2 | 2 | ||
3 | Close fd before returning. | 3 | OpenBSD added support for tap(4) 10 releases ago. |
4 | 4 | ||
5 | Buglink: https://bugs.launchpad.net/qemu/+bug/1904486 | 5 | Remove the special casing for older releases. |
6 | 6 | ||
7 | Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com> | 7 | Signed-off-by: Brad Smith <brad@comstyle.com> |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 8 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
10 | --- | 9 | --- |
11 | net/tap.c | 2 ++ | 10 | net/tap-bsd.c | 8 -------- |
12 | 1 file changed, 2 insertions(+) | 11 | 1 file changed, 8 deletions(-) |
13 | 12 | ||
14 | diff --git a/net/tap.c b/net/tap.c | 13 | diff --git a/net/tap-bsd.c b/net/tap-bsd.c |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/net/tap.c | 15 | --- a/net/tap-bsd.c |
17 | +++ b/net/tap.c | 16 | +++ b/net/tap-bsd.c |
18 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, | 17 | @@ -XXX,XX +XXX,XX @@ |
19 | if (ret < 0) { | 18 | #include <net/if_tap.h> |
20 | error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d", | 19 | #endif |
21 | name, fd); | 20 | |
22 | + close(fd); | 21 | -#if defined(__OpenBSD__) |
23 | return -1; | 22 | -#include <sys/param.h> |
23 | -#endif | ||
24 | - | ||
25 | #ifndef __FreeBSD__ | ||
26 | int tap_open(char *ifname, int ifname_size, int *vnet_hdr, | ||
27 | int vnet_hdr_required, int mq_required, Error **errp) | ||
28 | @@ -XXX,XX +XXX,XX @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, | ||
29 | if (*ifname) { | ||
30 | snprintf(dname, sizeof dname, "/dev/%s", ifname); | ||
31 | } else { | ||
32 | -#if defined(__OpenBSD__) && OpenBSD < 201605 | ||
33 | - snprintf(dname, sizeof dname, "/dev/tun%d", i); | ||
34 | -#else | ||
35 | snprintf(dname, sizeof dname, "/dev/tap%d", i); | ||
36 | -#endif | ||
24 | } | 37 | } |
25 | 38 | TFR(fd = open(dname, O_RDWR)); | |
26 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, | 39 | if (fd >= 0) { |
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 | -- | 40 | -- |
35 | 2.7.4 | 41 | 2.7.4 |
36 | 42 | ||
37 | 43 | diff view generated by jsdifflib |