From patchwork Wed Dec 2 12:04:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 40030 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 3E537B7BC7 for ; Thu, 3 Dec 2009 00:59:31 +1100 (EST) Received: from localhost ([127.0.0.1]:43947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFpjs-0007Bn-M5 for incoming@patchwork.ozlabs.org; Wed, 02 Dec 2009 08:59:28 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFny6-0004Wq-G2 for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:06:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFny1-0004Ug-Qu for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:06:02 -0500 Received: from [199.232.76.173] (port=42935 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFny0-0004Uc-UM for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45031) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFny0-0004EB-GO for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:56 -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 nB2C5tGd020946 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Dec 2009 07:05:55 -0500 Received: from localhost.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 nB2C5ILN029769; Wed, 2 Dec 2009 07:05:54 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 2 Dec 2009 13:04:23 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: 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: mst@redhat.com Subject: [Qemu-devel] [PATCH 25/41] virtio-net: MAC_TABLE_ENTRIES has never been bigger 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 Signed-off-by: Juan Quintela --- hw/virtio-net.c | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 57ad20b..e5c6ea0 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -20,6 +20,8 @@ #define VIRTIO_NET_VM_VERSION 11 +/* MAC_TABLE_ENTRIES can only grow, you can't make it smaller, or you + broke VMState backward compatiblity */ #define MAC_TABLE_ENTRIES 64 #define MAX_VLAN (1 << 12) /* Per 802.1Q definition */ @@ -740,15 +742,8 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) if (version_id >= 5) { n->mac_table.in_use = qemu_get_be32(f); - /* MAC_TABLE_ENTRIES may be different from the saved image */ - if (n->mac_table.in_use <= MAC_TABLE_ENTRIES) { - qemu_get_buffer(f, n->mac_table.macs, - n->mac_table.in_use * ETH_ALEN); - } else if (n->mac_table.in_use) { - qemu_fseek(f, n->mac_table.in_use * ETH_ALEN, SEEK_CUR); - n->mac_table.multi_overflow = n->mac_table.uni_overflow = 1; - n->mac_table.in_use = 0; - } + qemu_get_buffer(f, n->mac_table.macs, + n->mac_table.in_use * ETH_ALEN); } if (version_id >= 6)