qemu-e2k/hw/net
Mikhail Sennikovsky 7788c3f2e2 virtio-net: prevent offloads reset on migration
Currently offloads disabled by guest via the VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET
command are not preserved on VM migration.
Instead all offloads reported by guest features (via VIRTIO_PCI_GUEST_FEATURES)
get enabled.
What happens is: first the VirtIONet::curr_guest_offloads gets restored and offloads
are getting set correctly:

 #0  qemu_set_offload (nc=0x555556a11400, csum=1, tso4=0, tso6=0, ecn=0, ufo=0) at net/net.c:474
 #1  virtio_net_apply_guest_offloads (n=0x555557701ca0) at hw/net/virtio-net.c:720
 #2  virtio_net_post_load_device (opaque=0x555557701ca0, version_id=11) at hw/net/virtio-net.c:2334
 #3  vmstate_load_state (f=0x5555569dc010, vmsd=0x555556577c80 <vmstate_virtio_net_device>, opaque=0x555557701ca0, version_id=11)
     at migration/vmstate.c:168
 #4  virtio_load (vdev=0x555557701ca0, f=0x5555569dc010, version_id=11) at hw/virtio/virtio.c:2197
 #5  virtio_device_get (f=0x5555569dc010, opaque=0x555557701ca0, size=0, field=0x55555668cd00 <__compound_literal.5>) at hw/virtio/virtio.c:2036
 #6  vmstate_load_state (f=0x5555569dc010, vmsd=0x555556577ce0 <vmstate_virtio_net>, opaque=0x555557701ca0, version_id=11) at migration/vmstate.c:143
 #7  vmstate_load (f=0x5555569dc010, se=0x5555578189e0) at migration/savevm.c:829
 #8  qemu_loadvm_section_start_full (f=0x5555569dc010, mis=0x5555569eee20) at migration/savevm.c:2211
 #9  qemu_loadvm_state_main (f=0x5555569dc010, mis=0x5555569eee20) at migration/savevm.c:2395
 #10 qemu_loadvm_state (f=0x5555569dc010) at migration/savevm.c:2467
 #11 process_incoming_migration_co (opaque=0x0) at migration/migration.c:449

However later on the features are getting restored, and offloads get reset to
everything supported by features:

 #0  qemu_set_offload (nc=0x555556a11400, csum=1, tso4=1, tso6=1, ecn=0, ufo=0) at net/net.c:474
 #1  virtio_net_apply_guest_offloads (n=0x555557701ca0) at hw/net/virtio-net.c:720
 #2  virtio_net_set_features (vdev=0x555557701ca0, features=5104441767) at hw/net/virtio-net.c:773
 #3  virtio_set_features_nocheck (vdev=0x555557701ca0, val=5104441767) at hw/virtio/virtio.c:2052
 #4  virtio_load (vdev=0x555557701ca0, f=0x5555569dc010, version_id=11) at hw/virtio/virtio.c:2220
 #5  virtio_device_get (f=0x5555569dc010, opaque=0x555557701ca0, size=0, field=0x55555668cd00 <__compound_literal.5>) at hw/virtio/virtio.c:2036
 #6  vmstate_load_state (f=0x5555569dc010, vmsd=0x555556577ce0 <vmstate_virtio_net>, opaque=0x555557701ca0, version_id=11) at migration/vmstate.c:143
 #7  vmstate_load (f=0x5555569dc010, se=0x5555578189e0) at migration/savevm.c:829
 #8  qemu_loadvm_section_start_full (f=0x5555569dc010, mis=0x5555569eee20) at migration/savevm.c:2211
 #9  qemu_loadvm_state_main (f=0x5555569dc010, mis=0x5555569eee20) at migration/savevm.c:2395
 #10 qemu_loadvm_state (f=0x5555569dc010) at migration/savevm.c:2467
 #11 process_incoming_migration_co (opaque=0x0) at migration/migration.c:449

Fix this by preserving the state in saved_guest_offloads field and
pushing out offload initialization to the new post load hook.

Cc: qemu-stable@nongnu.org
Signed-off-by: Mikhail Sennikovsky <mikhail.sennikovskii@cloud.ionos.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2019-10-29 10:28:07 +08:00
..
can Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
fsl_etsec hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer API 2019-10-24 17:16:28 +01:00
rocker Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
allwinner_emac.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
cadence_gem.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
dp8393x.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
e1000_regs.h e1000: Rename the SEC symbol to SEQEC 2017-09-08 08:17:37 +08:00
e1000.c hw/net/e1000: Fix erroneous comment 2019-08-21 10:42:10 +02:00
e1000e_core.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
e1000e_core.h Supply missing header guards 2019-06-12 13:20:21 +02:00
e1000e.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
e1000x_common.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
e1000x_common.h Supply missing header guards 2019-06-12 13:20:21 +02:00
eepro100.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
etraxfs_eth.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
ftgmac100.c aspeed: add support for the Aspeed MII controller of the AST2600 2019-10-15 18:09:05 +01:00
imx_fec.c target-arm queue: 2019-08-16 17:21:40 +01:00
Kconfig net: add tulip (dec21143) driver 2019-10-29 10:28:07 +08:00
lan9118.c hw/net/lan9118.c: Switch to transaction-based ptimer API 2019-10-15 18:09:03 +01:00
lance.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
Makefile.objs net: add tulip (dec21143) driver 2019-10-29 10:28:07 +08:00
mcf_fec.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
milkymist-minimac2.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
mipsnet.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
ne2000-isa.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
ne2000-pci.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
ne2000.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
ne2000.h Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
net_rx_pkt.c net: Transmit zero UDP checksum as 0xFFFF 2017-11-20 11:08:00 +08:00
net_rx_pkt.h net_pkt: Extend packet abstraction as required by e1000e functionality 2016-06-02 10:42:28 +08:00
net_tx_pkt.c net: fix misaligned member access 2018-03-02 18:44:00 +00:00
net_tx_pkt.h clean-includes: run it once more 2016-06-16 18:39:03 +02:00
opencores_eth.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
pcnet-pci.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
pcnet.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
pcnet.h memory: Fix type of IOMMUMemoryRegionClass member @parent_class 2019-08-16 13:31:51 +02:00
rtl8139.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
smc91c111.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
spapr_llan.c spapr: Replace spapr_vio_qirq() helper with spapr_vio_irq_pulse() helper 2019-10-04 19:08:22 +10:00
stellaris_enet.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
sungem.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
sunhme.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
trace-events net: add tulip (dec21143) driver 2019-10-29 10:28:07 +08:00
tulip.c net: add tulip (dec21143) driver 2019-10-29 10:28:07 +08:00
tulip.h net: add tulip (dec21143) driver 2019-10-29 10:28:07 +08:00
vhost_net-stub.c vhost-net: move stubs to a separate file 2019-02-21 12:28:01 -05:00
vhost_net.c Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
virtio-net.c virtio-net: prevent offloads reset on migration 2019-10-29 10:28:07 +08:00
vmware_utils.h hw/net/vmxnet3: Fix code to work on big endian hosts, too 2017-11-20 11:08:00 +08:00
vmxnet3_defs.h Supply missing header guards 2019-06-12 13:20:21 +02:00
vmxnet3.c hw/net/vmxnet3: Fix leftover unregister_savevm 2019-09-12 11:13:55 +01:00
vmxnet3.h hw/net/vmxnet3: Fix code to work on big endian hosts, too 2017-11-20 11:08:00 +08:00
vmxnet_debug.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
xen_nic.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
xgmac.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
xilinx_axienet.c hw/net/xilinx_axi: Use object_initialize_child for correct ref. counting 2019-09-03 16:20:34 +01:00
xilinx_ethlite.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00