cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 7825ef61b703c017c2b4ae56007046f0acd3fee6 Mon Sep 17 00:00:00 2001
9ae3a8
From: Amos Kong <akong@redhat.com>
9ae3a8
Date: Tue, 5 Nov 2013 09:17:40 +0100
9ae3a8
Subject: [PATCH 08/25] net/e1000: update network information when macaddr is changed in guest
9ae3a8
9ae3a8
RH-Author: Amos Kong <akong@redhat.com>
9ae3a8
Message-id: <1383643062-1844-3-git-send-email-akong@redhat.com>
9ae3a8
Patchwork-id: 55369
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH 2/4] net/e1000: update network information when macaddr is changed in guest
9ae3a8
Bugzilla: 922589
9ae3a8
RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com>
9ae3a8
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
9ae3a8
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
9ae3a8
Bugzilla: 922589
9ae3a8
9ae3a8
If we change macaddr in guest by 'ifconfig eth0 hw ether 12:12:12:34:35:36',
9ae3a8
the mac register of e1000 is already updated, but we don't update
9ae3a8
network information in qemu. Therefor, the information in monitor
9ae3a8
is wrong.
9ae3a8
9ae3a8
This patch updates nic info when the second part of macaddr is written.
9ae3a8
9ae3a8
Signed-off-by: Amos Kong <akong@redhat.com>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit 7c36507c2b8776266f50c5e2739bd18279953b93)
9ae3a8
---
9ae3a8
 hw/net/e1000.c |    8 ++++++++
9ae3a8
 1 files changed, 8 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/net/e1000.c |    8 ++++++++
9ae3a8
 1 files changed, 8 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
9ae3a8
index d273ef2..87a84a7 100644
9ae3a8
--- a/hw/net/e1000.c
9ae3a8
+++ b/hw/net/e1000.c
9ae3a8
@@ -971,7 +971,15 @@ mac_read_clr8(E1000State *s, int index)
9ae3a8
 static void
9ae3a8
 mac_writereg(E1000State *s, int index, uint32_t val)
9ae3a8
 {
9ae3a8
+    uint32_t macaddr[2];
9ae3a8
+
9ae3a8
     s->mac_reg[index] = val;
9ae3a8
+
9ae3a8
+    if (index == RA + 1) {
9ae3a8
+        macaddr[0] = cpu_to_le32(s->mac_reg[RA]);
9ae3a8
+        macaddr[1] = cpu_to_le32(s->mac_reg[RA + 1]);
9ae3a8
+        qemu_format_nic_info_str(qemu_get_queue(s->nic), (uint8_t *)macaddr);
9ae3a8
+    }
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8