1 | The following changes since commit 915d34c5f99b0ab91517c69f54272bfdb6ca2b32: | 1 | The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2018-04-09 17:29:10 +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 5f523530915e57a14ffb8c00e22252bfa557441c: | 9 | for you to fetch changes up to 9925990d01a92564af55f6f69d0f5f59b47609b1: |
10 | 10 | ||
11 | e1000: Old machine types, turn new subsection off (2018-04-10 11:30:04 +0800) | 11 | net: Use correct default-path macro for downscript (2020-11-24 10:40:17 +0800) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | 14 | ||
15 | A series from David that switches to use subsection instead of version | 15 | ---------------------------------------------------------------- |
16 | bumping for e1000 to keep migration compatibility for old | 16 | Keqian Zhu (1): |
17 | versions. This will ease the downstream maintaining. | 17 | net: Use correct default-path macro for downscript |
18 | 18 | ||
19 | Please merge. | 19 | Paolo Bonzini (1): |
20 | net: do not exit on "netdev_add help" monitor command | ||
20 | 21 | ||
21 | Thanks | 22 | Prasad J Pandit (1): |
23 | hw/net/e1000e: advance desc_offset in case of null descriptor | ||
22 | 24 | ||
23 | ---------------------------------------------------------------- | 25 | Yuri Benditovich (1): |
24 | Dr. David Alan Gilbert (6): | 26 | net: purge queued rx packets on queue deletion |
25 | e1000: Convert v3 fields to subsection | ||
26 | e1000: Dupe offload data on reading old stream | ||
27 | e1000: wire new subsection to property | ||
28 | e1000: Migrate props via a temporary structure | ||
29 | e1000: Choose which set of props to migrate | ||
30 | e1000: Old machine types, turn new subsection off | ||
31 | 27 | ||
32 | hw/net/e1000.c | 103 ++++++++++++++++++++++++++++++++++++++++------------ | 28 | yuanjungong (1): |
33 | include/hw/compat.h | 4 ++ | 29 | tap: fix a memory leak |
34 | 2 files changed, 84 insertions(+), 23 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(-) | ||
35 | 37 | ||
36 | 38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> | ||
2 | 1 | ||
3 | A bunch of new TSO fields were introduced by d62644b4 and this bumped | ||
4 | the VMState version; however it's easier for those trying to keep | ||
5 | backwards migration compatibility if these fields are added in a | ||
6 | subsection instead. | ||
7 | |||
8 | Move the new fields to a subsection. | ||
9 | |||
10 | Since this was added after 2.11, this change will only affect | ||
11 | compatbility with 2.12-rc0. | ||
12 | |||
13 | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||
14 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
15 | --- | ||
16 | hw/net/e1000.c | 34 ++++++++++++++++++++++------------ | ||
17 | 1 file changed, 22 insertions(+), 12 deletions(-) | ||
18 | |||
19 | diff --git a/hw/net/e1000.c b/hw/net/e1000.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/net/e1000.c | ||
22 | +++ b/hw/net/e1000.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_e1000_full_mac_state = { | ||
24 | } | ||
25 | }; | ||
26 | |||
27 | +static const VMStateDescription vmstate_e1000_tx_tso_state = { | ||
28 | + .name = "e1000/tx_tso_state", | ||
29 | + .version_id = 1, | ||
30 | + .minimum_version_id = 1, | ||
31 | + .fields = (VMStateField[]) { | ||
32 | + VMSTATE_UINT8(tx.tso_props.ipcss, E1000State), | ||
33 | + VMSTATE_UINT8(tx.tso_props.ipcso, E1000State), | ||
34 | + VMSTATE_UINT16(tx.tso_props.ipcse, E1000State), | ||
35 | + VMSTATE_UINT8(tx.tso_props.tucss, E1000State), | ||
36 | + VMSTATE_UINT8(tx.tso_props.tucso, E1000State), | ||
37 | + VMSTATE_UINT16(tx.tso_props.tucse, E1000State), | ||
38 | + VMSTATE_UINT32(tx.tso_props.paylen, E1000State), | ||
39 | + VMSTATE_UINT8(tx.tso_props.hdr_len, E1000State), | ||
40 | + VMSTATE_UINT16(tx.tso_props.mss, E1000State), | ||
41 | + VMSTATE_INT8(tx.tso_props.ip, E1000State), | ||
42 | + VMSTATE_INT8(tx.tso_props.tcp, E1000State), | ||
43 | + VMSTATE_END_OF_LIST() | ||
44 | + } | ||
45 | +}; | ||
46 | + | ||
47 | static const VMStateDescription vmstate_e1000 = { | ||
48 | .name = "e1000", | ||
49 | - .version_id = 3, | ||
50 | + .version_id = 2, | ||
51 | .minimum_version_id = 1, | ||
52 | .pre_save = e1000_pre_save, | ||
53 | .post_load = e1000_post_load, | ||
54 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_e1000 = { | ||
55 | VMSTATE_UINT32_SUB_ARRAY(mac_reg, E1000State, RA, 32), | ||
56 | VMSTATE_UINT32_SUB_ARRAY(mac_reg, E1000State, MTA, 128), | ||
57 | VMSTATE_UINT32_SUB_ARRAY(mac_reg, E1000State, VFTA, 128), | ||
58 | - VMSTATE_UINT8_V(tx.tso_props.ipcss, E1000State, 3), | ||
59 | - VMSTATE_UINT8_V(tx.tso_props.ipcso, E1000State, 3), | ||
60 | - VMSTATE_UINT16_V(tx.tso_props.ipcse, E1000State, 3), | ||
61 | - VMSTATE_UINT8_V(tx.tso_props.tucss, E1000State, 3), | ||
62 | - VMSTATE_UINT8_V(tx.tso_props.tucso, E1000State, 3), | ||
63 | - VMSTATE_UINT16_V(tx.tso_props.tucse, E1000State, 3), | ||
64 | - VMSTATE_UINT32_V(tx.tso_props.paylen, E1000State, 3), | ||
65 | - VMSTATE_UINT8_V(tx.tso_props.hdr_len, E1000State, 3), | ||
66 | - VMSTATE_UINT16_V(tx.tso_props.mss, E1000State, 3), | ||
67 | - VMSTATE_INT8_V(tx.tso_props.ip, E1000State, 3), | ||
68 | - VMSTATE_INT8_V(tx.tso_props.tcp, E1000State, 3), | ||
69 | VMSTATE_END_OF_LIST() | ||
70 | }, | ||
71 | .subsections = (const VMStateDescription*[]) { | ||
72 | &vmstate_e1000_mit_state, | ||
73 | &vmstate_e1000_full_mac_state, | ||
74 | + &vmstate_e1000_tx_tso_state, | ||
75 | NULL | ||
76 | } | ||
77 | }; | ||
78 | -- | ||
79 | 2.7.4 | ||
80 | |||
81 | diff view generated by jsdifflib |
1 | From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> | 1 | From: Prasad J Pandit <pjp@fedoraproject.org> |
---|---|---|---|
2 | 2 | ||
3 | Turn the newly added subsection off for old machine types | 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 | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | 9 | Reported-by: Cheol-woo Myung <330cjfdn@gmail.com> |
10 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
6 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 11 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
7 | --- | 12 | --- |
8 | include/hw/compat.h | 4 ++++ | 13 | hw/net/e1000e_core.c | 8 ++++---- |
9 | 1 file changed, 4 insertions(+) | 14 | 1 file changed, 4 insertions(+), 4 deletions(-) |
10 | 15 | ||
11 | diff --git a/include/hw/compat.h b/include/hw/compat.h | 16 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c |
12 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/include/hw/compat.h | 18 | --- a/hw/net/e1000e_core.c |
14 | +++ b/include/hw/compat.h | 19 | +++ b/hw/net/e1000e_core.c |
15 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt, |
16 | .driver = "vhost-user-blk-pci",\ | 21 | (const char *) &fcs_pad, e1000x_fcs_len(core->mac)); |
17 | .property = "vectors",\ | 22 | } |
18 | .value = "2",\ | 23 | } |
19 | + },{\ | 24 | - desc_offset += desc_size; |
20 | + .driver = "e1000",\ | 25 | - if (desc_offset >= total_size) { |
21 | + .property = "migrate_tso_props",\ | 26 | - is_last = true; |
22 | + .value = "off",\ | 27 | - } |
23 | }, | 28 | } else { /* as per intel docs; skip descriptors with null buf addr */ |
24 | 29 | trace_e1000e_rx_null_descriptor(); | |
25 | #define HW_COMPAT_2_10 \ | 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); | ||
26 | -- | 38 | -- |
27 | 2.7.4 | 39 | 2.7.4 |
28 | 40 | ||
29 | 41 | diff view generated by jsdifflib |
1 | From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> | 1 | From: Paolo Bonzini <pbonzini@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | When we're using the subsection we migrate both | 3 | "netdev_add help" is causing QEMU to exit because the code that |
4 | the 'props' and 'tso_props' data; when we're not using | 4 | invokes show_netdevs is shared between CLI and HMP processing. |
5 | the subsection (to migrate to 2.11 or old machine types) we've | 5 | Move the check to the callers so that exit(0) remains only |
6 | got to choose what to migrate in the main structure. | 6 | in the CLI flow. |
7 | 7 | ||
8 | If we're using the subsection migrate 'props' in the main structure. | 8 | "netdev_add help" is not fixed by this patch; that is left for |
9 | If we're not using the subsection then migrate the last one | 9 | later work. |
10 | that changed, which gives behaviour similar to the old behaviour. | ||
11 | 10 | ||
12 | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | 11 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
13 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 12 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
14 | --- | 13 | --- |
15 | hw/net/e1000.c | 18 +++++++++++++++++- | 14 | include/net/net.h | 1 + |
16 | 1 file changed, 17 insertions(+), 1 deletion(-) | 15 | monitor/hmp-cmds.c | 6 +++++ |
16 | net/net.c | 68 +++++++++++++++++++++++++++--------------------------- | ||
17 | 3 files changed, 41 insertions(+), 34 deletions(-) | ||
17 | 18 | ||
18 | diff --git a/hw/net/e1000.c b/hw/net/e1000.c | 19 | diff --git a/include/net/net.h b/include/net/net.h |
19 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/net/e1000.c | 21 | --- a/include/net/net.h |
21 | +++ b/hw/net/e1000.c | 22 | +++ b/include/net/net.h |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct E1000State_st { | 23 | @@ -XXX,XX +XXX,XX @@ extern const char *host_net_devices[]; |
23 | #define E1000_FLAG_TSO (1 << E1000_FLAG_TSO_BIT) | 24 | |
24 | uint32_t compat_flags; | 25 | /* from net.c */ |
25 | bool received_tx_tso; | 26 | int net_client_parse(QemuOptsList *opts_list, const char *str); |
26 | + bool use_tso_for_migration; | 27 | +void show_netdevs(void); |
27 | e1000x_txd_props mig_props; | 28 | int net_init_clients(Error **errp); |
28 | } E1000State; | 29 | void net_check_clients(void); |
29 | 30 | void net_cleanup(void); | |
30 | @@ -XXX,XX +XXX,XX @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) | 31 | diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c |
31 | if (dtype == E1000_TXD_CMD_DEXT) { /* context descriptor */ | 32 | index XXXXXXX..XXXXXXX 100644 |
32 | if (le32_to_cpu(xp->cmd_and_length) & E1000_TXD_CMD_TSE) { | 33 | --- a/monitor/hmp-cmds.c |
33 | e1000x_read_tx_ctx_descr(xp, &tp->tso_props); | 34 | +++ b/monitor/hmp-cmds.c |
34 | + s->use_tso_for_migration = 1; | 35 | @@ -XXX,XX +XXX,XX @@ |
35 | tp->tso_frames = 0; | 36 | #include "qemu/option.h" |
36 | } else { | 37 | #include "qemu/timer.h" |
37 | e1000x_read_tx_ctx_descr(xp, &tp->props); | 38 | #include "qemu/sockets.h" |
38 | + s->use_tso_for_migration = 0; | 39 | +#include "qemu/help_option.h" |
39 | } | 40 | #include "monitor/monitor-internal.h" |
40 | return; | 41 | #include "qapi/error.h" |
41 | } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { | 42 | #include "qapi/clone-visitor.h" |
42 | @@ -XXX,XX +XXX,XX @@ static int e1000_pre_save(void *opaque) | 43 | @@ -XXX,XX +XXX,XX @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict) |
43 | s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE; | 44 | { |
44 | } | 45 | Error *err = NULL; |
45 | 46 | QemuOpts *opts; | |
46 | - s->mig_props = s->tx.props; | 47 | + const char *type = qdict_get_try_str(qdict, "type"); |
47 | + /* Decide which set of props to migrate in the main structure */ | 48 | |
48 | + if (chkflag(TSO) || !s->use_tso_for_migration) { | 49 | + if (type && is_help_option(type)) { |
49 | + /* Either we're migrating with the extra subsection, in which | 50 | + show_netdevs(); |
50 | + * case the mig_props is always 'props' OR | 51 | + return; |
51 | + * we've not got the subsection, but 'props' was the last | ||
52 | + * updated. | ||
53 | + */ | ||
54 | + s->mig_props = s->tx.props; | ||
55 | + } else { | ||
56 | + /* We're not using the subsection, and 'tso_props' was | ||
57 | + * the last updated. | ||
58 | + */ | ||
59 | + s->mig_props = s->tx.tso_props; | ||
60 | + } | 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) | ||
61 | return 0; | 69 | return 0; |
62 | } | 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 | } | ||
63 | 168 | ||
64 | -- | 169 | -- |
65 | 2.7.4 | 170 | 2.7.4 |
66 | 171 | ||
67 | 172 | diff view generated by jsdifflib |
1 | From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> | 1 | From: Yuri Benditovich <yuri.benditovich@daynix.com> |
---|---|---|---|
2 | 2 | ||
3 | Swing the tx.props out via a temporary structure, so in future patches | 3 | https://bugzilla.redhat.com/show_bug.cgi?id=1829272 |
4 | we can select what we're going to send. | 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) | ||
5 | 14 | ||
6 | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | 15 | Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> |
7 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 16 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
8 | --- | 17 | --- |
9 | hw/net/e1000.c | 27 +++++++++++++++------------ | 18 | net/net.c | 12 ++++++++---- |
10 | 1 file changed, 15 insertions(+), 12 deletions(-) | 19 | 1 file changed, 8 insertions(+), 4 deletions(-) |
11 | 20 | ||
12 | diff --git a/hw/net/e1000.c b/hw/net/e1000.c | 21 | diff --git a/net/net.c b/net/net.c |
13 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/net/e1000.c | 23 | --- a/net/net.c |
15 | +++ b/hw/net/e1000.c | 24 | +++ b/net/net.c |
16 | @@ -XXX,XX +XXX,XX @@ typedef struct E1000State_st { | 25 | @@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic) |
17 | #define E1000_FLAG_TSO (1 << E1000_FLAG_TSO_BIT) | 26 | |
18 | uint32_t compat_flags; | 27 | qemu_macaddr_set_free(&nic->conf->macaddr); |
19 | bool received_tx_tso; | 28 | |
20 | + e1000x_txd_props mig_props; | 29 | - /* If this is a peer NIC and peer has already been deleted, free it now. */ |
21 | } E1000State; | 30 | - if (nic->peer_deleted) { |
22 | 31 | - for (i = 0; i < queues; i++) { | |
23 | #define chkflag(x) (s->compat_flags & E1000_FLAG_##x) | 32 | - qemu_free_net_client(qemu_get_subqueue(nic, i)->peer); |
24 | @@ -XXX,XX +XXX,XX @@ static int e1000_pre_save(void *opaque) | 33 | + for (i = 0; i < queues; i++) { |
25 | s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE; | 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 | } | ||
26 | } | 42 | } |
27 | 43 | ||
28 | + s->mig_props = s->tx.props; | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | @@ -XXX,XX +XXX,XX @@ static int e1000_post_load(void *opaque, int version_id) | ||
33 | qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500); | ||
34 | } | ||
35 | |||
36 | + s->tx.props = s->mig_props; | ||
37 | if (!s->received_tx_tso) { | ||
38 | /* We received only one set of offload data (tx.props) | ||
39 | * and haven't got tx.tso_props. The best we can do | ||
40 | * is dupe the data. | ||
41 | */ | ||
42 | - s->tx.tso_props = s->tx.props; | ||
43 | + s->tx.tso_props = s->mig_props; | ||
44 | } | ||
45 | return 0; | ||
46 | } | ||
47 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_e1000 = { | ||
48 | VMSTATE_UINT16(eecd_state.bitnum_out, E1000State), | ||
49 | VMSTATE_UINT16(eecd_state.reading, E1000State), | ||
50 | VMSTATE_UINT32(eecd_state.old_eecd, E1000State), | ||
51 | - VMSTATE_UINT8(tx.props.ipcss, E1000State), | ||
52 | - VMSTATE_UINT8(tx.props.ipcso, E1000State), | ||
53 | - VMSTATE_UINT16(tx.props.ipcse, E1000State), | ||
54 | - VMSTATE_UINT8(tx.props.tucss, E1000State), | ||
55 | - VMSTATE_UINT8(tx.props.tucso, E1000State), | ||
56 | - VMSTATE_UINT16(tx.props.tucse, E1000State), | ||
57 | - VMSTATE_UINT32(tx.props.paylen, E1000State), | ||
58 | - VMSTATE_UINT8(tx.props.hdr_len, E1000State), | ||
59 | - VMSTATE_UINT16(tx.props.mss, E1000State), | ||
60 | + VMSTATE_UINT8(mig_props.ipcss, E1000State), | ||
61 | + VMSTATE_UINT8(mig_props.ipcso, E1000State), | ||
62 | + VMSTATE_UINT16(mig_props.ipcse, E1000State), | ||
63 | + VMSTATE_UINT8(mig_props.tucss, E1000State), | ||
64 | + VMSTATE_UINT8(mig_props.tucso, E1000State), | ||
65 | + VMSTATE_UINT16(mig_props.tucse, E1000State), | ||
66 | + VMSTATE_UINT32(mig_props.paylen, E1000State), | ||
67 | + VMSTATE_UINT8(mig_props.hdr_len, E1000State), | ||
68 | + VMSTATE_UINT16(mig_props.mss, E1000State), | ||
69 | VMSTATE_UINT16(tx.size, E1000State), | ||
70 | VMSTATE_UINT16(tx.tso_frames, E1000State), | ||
71 | VMSTATE_UINT8(tx.sum_needed, E1000State), | ||
72 | - VMSTATE_INT8(tx.props.ip, E1000State), | ||
73 | - VMSTATE_INT8(tx.props.tcp, E1000State), | ||
74 | + VMSTATE_INT8(mig_props.ip, E1000State), | ||
75 | + VMSTATE_INT8(mig_props.tcp, E1000State), | ||
76 | VMSTATE_BUFFER(tx.header, E1000State), | ||
77 | VMSTATE_BUFFER(tx.data, E1000State), | ||
78 | VMSTATE_UINT16_ARRAY(eeprom_data, E1000State, 64), | ||
79 | -- | 44 | -- |
80 | 2.7.4 | 45 | 2.7.4 |
81 | 46 | ||
82 | 47 | diff view generated by jsdifflib |
1 | From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> | 1 | From: yuanjungong <ruc_gongyuanjun@163.com> |
---|---|---|---|
2 | 2 | ||
3 | Wire the new subsection from the previous commit to a property | 3 | Close fd before returning. |
4 | so we can turn it off easily. | ||
5 | 4 | ||
6 | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | 5 | Buglink: https://bugs.launchpad.net/qemu/+bug/1904486 |
6 | |||
7 | Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 9 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
8 | --- | 10 | --- |
9 | hw/net/e1000.c | 12 ++++++++++++ | 11 | net/tap.c | 2 ++ |
10 | 1 file changed, 12 insertions(+) | 12 | 1 file changed, 2 insertions(+) |
11 | 13 | ||
12 | diff --git a/hw/net/e1000.c b/hw/net/e1000.c | 14 | diff --git a/net/tap.c b/net/tap.c |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/net/e1000.c | 16 | --- a/net/tap.c |
15 | +++ b/hw/net/e1000.c | 17 | +++ b/net/tap.c |
16 | @@ -XXX,XX +XXX,XX @@ typedef struct E1000State_st { | 18 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, |
17 | #define E1000_FLAG_AUTONEG_BIT 0 | 19 | if (ret < 0) { |
18 | #define E1000_FLAG_MIT_BIT 1 | 20 | error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d", |
19 | #define E1000_FLAG_MAC_BIT 2 | 21 | name, fd); |
20 | +#define E1000_FLAG_TSO_BIT 3 | 22 | + close(fd); |
21 | #define E1000_FLAG_AUTONEG (1 << E1000_FLAG_AUTONEG_BIT) | 23 | return -1; |
22 | #define E1000_FLAG_MIT (1 << E1000_FLAG_MIT_BIT) | 24 | } |
23 | #define E1000_FLAG_MAC (1 << E1000_FLAG_MAC_BIT) | 25 | |
24 | +#define E1000_FLAG_TSO (1 << E1000_FLAG_TSO_BIT) | 26 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, |
25 | uint32_t compat_flags; | 27 | vhostfdname, vnet_hdr, fd, &err); |
26 | bool received_tx_tso; | 28 | if (err) { |
27 | } E1000State; | 29 | error_propagate(errp, err); |
28 | @@ -XXX,XX +XXX,XX @@ static bool e1000_full_mac_needed(void *opaque) | 30 | + close(fd); |
29 | return chkflag(MAC); | 31 | return -1; |
30 | } | 32 | } |
31 | 33 | } else if (tap->has_fds) { | |
32 | +static bool e1000_tso_state_needed(void *opaque) | ||
33 | +{ | ||
34 | + E1000State *s = opaque; | ||
35 | + | ||
36 | + return chkflag(TSO); | ||
37 | +} | ||
38 | + | ||
39 | static const VMStateDescription vmstate_e1000_mit_state = { | ||
40 | .name = "e1000/mit_state", | ||
41 | .version_id = 1, | ||
42 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_e1000_tx_tso_state = { | ||
43 | .name = "e1000/tx_tso_state", | ||
44 | .version_id = 1, | ||
45 | .minimum_version_id = 1, | ||
46 | + .needed = e1000_tso_state_needed, | ||
47 | .post_load = e1000_tx_tso_post_load, | ||
48 | .fields = (VMStateField[]) { | ||
49 | VMSTATE_UINT8(tx.tso_props.ipcss, E1000State), | ||
50 | @@ -XXX,XX +XXX,XX @@ static Property e1000_properties[] = { | ||
51 | compat_flags, E1000_FLAG_MIT_BIT, true), | ||
52 | DEFINE_PROP_BIT("extra_mac_registers", E1000State, | ||
53 | compat_flags, E1000_FLAG_MAC_BIT, true), | ||
54 | + DEFINE_PROP_BIT("migrate_tso_props", E1000State, | ||
55 | + compat_flags, E1000_FLAG_TSO_BIT, true), | ||
56 | DEFINE_PROP_END_OF_LIST(), | ||
57 | }; | ||
58 | |||
59 | -- | 34 | -- |
60 | 2.7.4 | 35 | 2.7.4 |
61 | 36 | ||
62 | 37 | diff view generated by jsdifflib |
1 | From: "Dr. David Alan Gilbert" <dgilbert@redhat.com> | 1 | From: Keqian Zhu <zhukeqian1@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | Old QEMUs only had one set of offload data; when we only receive | 3 | Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts) |
4 | one lot, dupe the received data - that should give us about the | 4 | Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> |
5 | same bug level as the old version. | ||
6 | |||
7 | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||
8 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 5 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
9 | --- | 6 | --- |
10 | hw/net/e1000.c | 16 ++++++++++++++++ | 7 | net/tap.c | 3 ++- |
11 | 1 file changed, 16 insertions(+) | 8 | 1 file changed, 2 insertions(+), 1 deletion(-) |
12 | 9 | ||
13 | diff --git a/hw/net/e1000.c b/hw/net/e1000.c | 10 | diff --git a/net/tap.c b/net/tap.c |
14 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/net/e1000.c | 12 | --- a/net/tap.c |
16 | +++ b/hw/net/e1000.c | 13 | +++ b/net/tap.c |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct E1000State_st { | 14 | @@ -XXX,XX +XXX,XX @@ free_fail: |
18 | #define E1000_FLAG_MIT (1 << E1000_FLAG_MIT_BIT) | 15 | script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT); |
19 | #define E1000_FLAG_MAC (1 << E1000_FLAG_MAC_BIT) | 16 | } |
20 | uint32_t compat_flags; | 17 | if (!downscript) { |
21 | + bool received_tx_tso; | 18 | - downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT); |
22 | } E1000State; | 19 | + downscript = default_downscript = |
23 | 20 | + get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT); | |
24 | #define chkflag(x) (s->compat_flags & E1000_FLAG_##x) | 21 | } |
25 | @@ -XXX,XX +XXX,XX @@ static int e1000_post_load(void *opaque, int version_id) | 22 | |
26 | qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500); | 23 | if (tap->has_ifname) { |
27 | } | ||
28 | |||
29 | + if (!s->received_tx_tso) { | ||
30 | + /* We received only one set of offload data (tx.props) | ||
31 | + * and haven't got tx.tso_props. The best we can do | ||
32 | + * is dupe the data. | ||
33 | + */ | ||
34 | + s->tx.tso_props = s->tx.props; | ||
35 | + } | ||
36 | + return 0; | ||
37 | +} | ||
38 | + | ||
39 | +static int e1000_tx_tso_post_load(void *opaque, int version_id) | ||
40 | +{ | ||
41 | + E1000State *s = opaque; | ||
42 | + s->received_tx_tso = true; | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_e1000_tx_tso_state = { | ||
47 | .name = "e1000/tx_tso_state", | ||
48 | .version_id = 1, | ||
49 | .minimum_version_id = 1, | ||
50 | + .post_load = e1000_tx_tso_post_load, | ||
51 | .fields = (VMStateField[]) { | ||
52 | VMSTATE_UINT8(tx.tso_props.ipcss, E1000State), | ||
53 | VMSTATE_UINT8(tx.tso_props.ipcso, E1000State), | ||
54 | -- | 24 | -- |
55 | 2.7.4 | 25 | 2.7.4 |
56 | 26 | ||
57 | 27 | diff view generated by jsdifflib |