From patchwork Thu Oct 17 07:02:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amos Kong X-Patchwork-Id: 284103 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BF7BC2C0097 for ; Thu, 17 Oct 2013 18:04:42 +1100 (EST) Received: from localhost ([::1]:50605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWhdQ-0003B8-LA for incoming@patchwork.ozlabs.org; Thu, 17 Oct 2013 03:04:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWhc7-0001V5-CP for qemu-devel@nongnu.org; Thu, 17 Oct 2013 03:03:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWhc1-0003O4-DH for qemu-devel@nongnu.org; Thu, 17 Oct 2013 03:03:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWhc1-0003Nn-4i for qemu-devel@nongnu.org; Thu, 17 Oct 2013 03:03:13 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9H73Bd5001451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 17 Oct 2013 03:03:11 -0400 Received: from amosk.info.com ([10.66.5.176]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9H7312W029043; Thu, 17 Oct 2013 03:03:08 -0400 From: Amos Kong To: qemu-devel@nongnu.org Date: Thu, 17 Oct 2013 15:02:49 +0800 Message-Id: <1381993370-26201-2-git-send-email-akong@redhat.com> In-Reply-To: <1381993370-26201-1-git-send-email-akong@redhat.com> References: <1381993370-26201-1-git-send-email-akong@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: anthony@codemonkey.ws, stefanha@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH 1/2] net/e1000: update network information when macaddr is changed in guest 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 If we change macaddr in guest by 'ifconfig eth0 hw ether 12:12:12:34:35:36', the mac register of e1000 is already updated, but we don't update network information in qemu. Therefor, the information in monitor is wrong. This patch updates nic info when the second part of macaddr is written. Signed-off-by: Amos Kong --- hw/net/e1000.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 151d25e..7769be0 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -1105,7 +1105,15 @@ mac_read_clr8(E1000State *s, int index) static void mac_writereg(E1000State *s, int index, uint32_t val) { + uint32_t macaddr[2]; + s->mac_reg[index] = val; + + if (index == RA + 1) { + macaddr[0] = cpu_to_le32(s->mac_reg[RA]); + macaddr[1] = cpu_to_le32(s->mac_reg[RA + 1]); + qemu_format_nic_info_str(qemu_get_queue(s->nic), (uint8_t *)macaddr); + } } static void