virtio-net: Switch to using announce timer

Switch virtio's self announcement to use the AnnounceTimer.
It keeps it's own AnnounceTimer (per device), and starts running it
using a migration post-load and a virtual clock; that way the
announce happens once the guest is actually running.
The timer uses the migration parameters to set the timing of
the repeats.

Based on earlier patches by myself and
 Vladislav Yasevich <vyasevic@redhat.com>

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
Dr. David Alan Gilbert 2019-02-27 13:24:07 +00:00 committed by Jason Wang
parent ee3d96baf3
commit 9d8c6a258c
3 changed files with 30 additions and 15 deletions

View file

@ -17,6 +17,7 @@
#include "qemu/units.h"
#include "standard-headers/linux/virtio_net.h"
#include "hw/virtio/virtio.h"
#include "net/announce.h"
#define TYPE_VIRTIO_NET "virtio-net-device"
#define VIRTIO_NET(obj) \
@ -181,8 +182,7 @@ struct VirtIONet {
char *netclient_name;
char *netclient_type;
uint64_t curr_guest_offloads;
QEMUTimer *announce_timer;
int announce_counter;
AnnounceTimer announce_timer;
bool needs_vnet_hdr_swap;
bool mtu_bypass_backend;
};