cryptospore / rpms / qemu-kvm

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