qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/2] net/e1000: update network information when maca


From: Amos Kong
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

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]