diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2019-03-05 09:33:20 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2019-03-05 09:33:20 +0000 |
| commit | 0984a157c1c053394adbf64ed7de97f1aebe6a2d (patch) | |
| tree | 8c750c38d4bd328a10e3965e7cb39d27cfc6b8b8 /migration/savevm.c | |
| parent | b6179aaff961627fcb59d7b234297966b81ac726 (diff) | |
| parent | 4b9b70000218640a42c3ea908a12665e5840b6cd (diff) | |
| download | focaccia-qemu-0984a157c1c053394adbf64ed7de97f1aebe6a2d.tar.gz focaccia-qemu-0984a157c1c053394adbf64ed7de97f1aebe6a2d.zip | |
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
# gpg: Signature made Tue 05 Mar 2019 07:06:28 GMT # gpg: using RSA key EF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * remotes/jasowang/tags/net-pull-request: tests: Add a test for qemu self announcements hmp: Add hmp_announce_self qmp: Add announce-self command virtio-net: Allow qemu_announce_self to trigger virtio announcements net: Add a network device specific self-announcement ability migration: Switch to using announce timer virtio-net: Switch to using announce timer migration: Add announce parameters net: Introduce announce timer net: netmap: improve netmap_receive_iov() net: netmap: simplify netmap_receive() net: netmap: small improvements netmap_send() net/colo-compare.c: Remove duplicated code Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration/savevm.c')
| -rw-r--r-- | migration/savevm.c | 72 |
1 files changed, 3 insertions, 69 deletions
diff --git a/migration/savevm.c b/migration/savevm.c index 322660438d..b3868f7fb5 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -57,13 +57,7 @@ #include "sysemu/replay.h" #include "qjson.h" #include "migration/colo.h" - -#ifndef ETH_P_RARP -#define ETH_P_RARP 0x8035 -#endif -#define ARP_HTYPE_ETH 0x0001 -#define ARP_PTYPE_IP 0x0800 -#define ARP_OP_REQUEST_REV 0x3 +#include "net/announce.h" const unsigned int postcopy_ram_discard_version = 0; @@ -125,67 +119,6 @@ static struct mig_cmd_args { * generic extendable format with an exception for two old entities. */ -static int announce_self_create(uint8_t *buf, - uint8_t *mac_addr) -{ - /* Ethernet header. */ - memset(buf, 0xff, 6); /* destination MAC addr */ - memcpy(buf + 6, mac_addr, 6); /* source MAC addr */ - *(uint16_t *)(buf + 12) = htons(ETH_P_RARP); /* ethertype */ - - /* RARP header. */ - *(uint16_t *)(buf + 14) = htons(ARP_HTYPE_ETH); /* hardware addr space */ - *(uint16_t *)(buf + 16) = htons(ARP_PTYPE_IP); /* protocol addr space */ - *(buf + 18) = 6; /* hardware addr length (ethernet) */ - *(buf + 19) = 4; /* protocol addr length (IPv4) */ - *(uint16_t *)(buf + 20) = htons(ARP_OP_REQUEST_REV); /* opcode */ - memcpy(buf + 22, mac_addr, 6); /* source hw addr */ - memset(buf + 28, 0x00, 4); /* source protocol addr */ - memcpy(buf + 32, mac_addr, 6); /* target hw addr */ - memset(buf + 38, 0x00, 4); /* target protocol addr */ - - /* Padding to get up to 60 bytes (ethernet min packet size, minus FCS). */ - memset(buf + 42, 0x00, 18); - - return 60; /* len (FCS will be added by hardware) */ -} - -static void qemu_announce_self_iter(NICState *nic, void *opaque) -{ - uint8_t buf[60]; - int len; - - trace_qemu_announce_self_iter(qemu_ether_ntoa(&nic->conf->macaddr)); - len = announce_self_create(buf, nic->conf->macaddr.a); - - qemu_send_packet_raw(qemu_get_queue(nic), buf, len); -} - - -static void qemu_announce_self_once(void *opaque) -{ - static int count = SELF_ANNOUNCE_ROUNDS; - QEMUTimer *timer = *(QEMUTimer **)opaque; - - qemu_foreach_nic(qemu_announce_self_iter, NULL); - - if (--count) { - /* delay 50ms, 150ms, 250ms, ... */ - timer_mod(timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + - self_announce_delay(count)); - } else { - timer_del(timer); - timer_free(timer); - } -} - -void qemu_announce_self(void) -{ - static QEMUTimer *timer; - timer = timer_new_ms(QEMU_CLOCK_REALTIME, qemu_announce_self_once, &timer); - qemu_announce_self_once(&timer); -} - /***********************************************************/ /* savevm/loadvm support */ @@ -1765,13 +1698,14 @@ static void loadvm_postcopy_handle_run_bh(void *opaque) { Error *local_err = NULL; HandleRunBhData *data = opaque; + MigrationIncomingState *mis = migration_incoming_get_current(); /* TODO we should move all of this lot into postcopy_ram.c or a shared code * in migration.c */ cpu_synchronize_all_post_init(); - qemu_announce_self(); + qemu_announce_self(&mis->announce_timer, migrate_announce_params()); /* Make sure all file formats flush their mutable metadata. * If we get an error here, just don't restart the VM yet. */ |