From patchwork Wed Nov 25 18:49:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 39434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5B50EB7BBB for ; Thu, 26 Nov 2009 06:32:27 +1100 (EST) Received: from localhost ([127.0.0.1]:51796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDNbE-0007jT-Ks for incoming@patchwork.ozlabs.org; Wed, 25 Nov 2009 14:32:24 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDMym-0007S9-Tk for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDMya-0007JL-Gp for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:36 -0500 Received: from [199.232.76.173] (port=49015 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDMya-0007J5-59 for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45147) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDMyZ-0000FL-5S for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:27 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAPIqQpn015257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 25 Nov 2009 13:52:26 -0500 Received: from blaa.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAPIqNfV026876; Wed, 25 Nov 2009 13:52:25 -0500 Received: by blaa.localdomain (Postfix, from userid 500) id 461E4B0B3; Wed, 25 Nov 2009 18:49:43 +0000 (GMT) From: Mark McLoughlin To: qemu-devel@nongnu.org Date: Wed, 25 Nov 2009 18:49:32 +0000 Message-Id: <1259174977-26212-40-git-send-email-markmc@redhat.com> In-Reply-To: <1259174977-26212-1-git-send-email-markmc@redhat.com> References: <1259174977-26212-1-git-send-email-markmc@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Mark McLoughlin Subject: [Qemu-devel] [PATCH 39/44] net: fix qemu_announce_self() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that we have a way to iterate NICs. Signed-off-by: Mark McLoughlin --- savevm.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/savevm.c b/savevm.c index 4668843..3cfc5aa 100644 --- a/savevm.c +++ b/savevm.c @@ -123,24 +123,24 @@ static int announce_self_create(uint8_t *buf, return 60; /* len (FCS will be added by hardware) */ } -static void qemu_announce_self_once(void *opaque) +static void qemu_announce_self_iter(NICState *nic, void *opaque) { - int i, len; - VLANState *vlan; - VLANClientState *vc; uint8_t buf[60]; + int len; + + len = announce_self_create(buf, nic->conf->macaddr.a); + + qemu_send_packet_raw(&nic->nc, buf, len); +} + + +static void qemu_announce_self_once(void *opaque) +{ static int count = SELF_ANNOUNCE_ROUNDS; QEMUTimer *timer = *(QEMUTimer **)opaque; - for (i = 0; i < MAX_NICS; i++) { - if (!nd_table[i].used) - continue; - len = announce_self_create(buf, nd_table[i].macaddr); - vlan = nd_table[i].vlan; - QTAILQ_FOREACH(vc, &vlan->clients, next) { - qemu_send_packet_raw(vc, buf, len); - } - } + qemu_foreach_nic(qemu_announce_self_iter, NULL); + if (--count) { /* delay 50ms, 150ms, 250ms, ... */ qemu_mod_timer(timer, qemu_get_clock(rt_clock) +