From: Amos Kong <akong@redhat.com>
To: qemu-devel@nongnu.org
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
Date: Thu, 17 Oct 2013 15:02:49 +0800 [thread overview]
Message-ID: <1381993370-26201-2-git-send-email-akong@redhat.com> (raw)
In-Reply-To: <1381993370-26201-1-git-send-email-akong@redhat.com>
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 <akong@redhat.com>
---
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
--
1.8.3.1
next prev parent reply other threads:[~2013-10-17 7:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-17 7:02 [Qemu-devel] [PATCH 0/2] fix updating of nic info Amos Kong
2013-10-17 7:02 ` Amos Kong [this message]
2013-10-17 7:02 ` [Qemu-devel] [PATCH 2/2] net/rtl8139: update network information when macaddr is changed in guest Amos Kong
2013-10-17 7:58 ` [Qemu-devel] [PATCH 0/2] fix updating of nic info Stefan Hajnoczi
2013-10-17 8:15 ` Michael S. Tsirkin
2013-10-17 8:31 ` Amos Kong
2013-10-17 9:34 ` Michael S. Tsirkin
2013-10-18 10:02 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381993370-26201-2-git-send-email-akong@redhat.com \
--to=akong@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).