From patchwork Wed Mar 28 05:40:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 149142 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 21474B6EEB for ; Wed, 28 Mar 2012 16:45:16 +1100 (EST) Received: from localhost ([::1]:38122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SClh3-0003Yr-SV for incoming@patchwork.ozlabs.org; Wed, 28 Mar 2012 01:45:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SClgq-0003J9-IO for qemu-devel@nongnu.org; Wed, 28 Mar 2012 01:45:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SClgo-0005EQ-FY for qemu-devel@nongnu.org; Wed, 28 Mar 2012 01:45:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SClgo-0005EA-7b for qemu-devel@nongnu.org; Wed, 28 Mar 2012 01:44:58 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2S5itLD017622 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 Mar 2012 01:44:55 -0400 Received: from amd-6168-8-1.englab.nay.redhat.com (amd-6168-8-1.englab.nay.redhat.com [10.66.104.52]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q2S5iqM6005058; Wed, 28 Mar 2012 01:44:53 -0400 To: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, quintela@redhat.com, rusty@rustcorp.com.au, qemu-devel@nongnu.org, mst@redhat.com, pbonzini@redhat.com From: Jason Wang Date: Wed, 28 Mar 2012 13:40:12 +0800 Message-ID: <20120328054012.34135.77090.stgit@amd-6168-8-1.englab.nay.redhat.com> In-Reply-To: <20120328053356.34135.42669.stgit@amd-6168-8-1.englab.nay.redhat.com> References: <20120328053356.34135.42669.stgit@amd-6168-8-1.englab.nay.redhat.com> User-Agent: StGit/0.16-1-g60c4 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [V6 PATCH 1/4] net: announce self after vm start X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org qemu_announce_self() were moved to vm_start(). This is because we may want to let guest to send the gratuitous packets. A global variable need_announce were introduced to record the pending announcement, and vm_start() would send gratuitous packet depends on this value. Signed-off-by: Jason Wang Reviewed-by: Paolo Bonzini --- migration.c | 2 +- migration.h | 2 ++ vl.c | 5 +++++ 3 files changed, 8 insertions(+), 1 deletions(-) diff --git a/migration.c b/migration.c index 00fa1e3..861cce9 100644 --- a/migration.c +++ b/migration.c @@ -88,7 +88,7 @@ void process_incoming_migration(QEMUFile *f) fprintf(stderr, "load of migration failed\n"); exit(0); } - qemu_announce_self(); + need_announce = true; DPRINTF("successfully loaded vm state\n"); /* Make sure all file formats flush their mutable metadata */ diff --git a/migration.h b/migration.h index 372b066..0a31463 100644 --- a/migration.h +++ b/migration.h @@ -95,4 +95,6 @@ void migrate_add_blocker(Error *reason); */ void migrate_del_blocker(Error *reason); +extern bool need_announce; + #endif diff --git a/vl.c b/vl.c index 65f11f2..05ebf57 100644 --- a/vl.c +++ b/vl.c @@ -231,6 +231,7 @@ int boot_menu; uint8_t *boot_splash_filedata; int boot_splash_filedata_size; uint8_t qemu_extra_params_fw[2]; +bool need_announce = false; typedef struct FWBootEntry FWBootEntry; @@ -1266,6 +1267,10 @@ void vm_start(void) vm_state_notify(1, RUN_STATE_RUNNING); resume_all_vcpus(); monitor_protocol_event(QEVENT_RESUME, NULL); + if (need_announce) { + need_announce = false; + qemu_announce_self(); + } } }