Skip to contentSkip to conversation

Net patches

GIT PULL Stefan Hajnoczi 1 participant 4 messages Oct 18, 2013

lore
Share & tools
lore
#0 lore raw

v2:
* Dropped multicast MAC patch due to issues pointed out by Amos

The following changes since commit 1680d485777ecf436d724631ea8722cc0c66990e:

Merge remote-tracking branch 'rth/tcg-ldst-6' into staging (2013-10-14 09:59:59 -0700)

are available in the git repository at:

git://github.com/stefanha/qemu.git net

for you to fetch changes up to 23c37c37f0280761072c23bf67d3a4f3c0ff25aa:

net/rtl8139: update network information when macaddr is changed in guest (2013-10-18 13:28:09 +0200)

----------------------------------------------------------------
Amos Kong (3):
net: update nic info during device reset
net/e1000: update network information when macaddr is changed in guest net/rtl8139: update network information when macaddr is changed in guest

 hw/net/e1000.c   | 9 +++++++++
 hw/net/rtl8139.c | 7 ++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
#1 lore raw

[Qemu-devel] [PULL v2 1/3] net: update nic info during device reset

From: Amos Kong <[email protected]>

macaddr is reset during device reset, but nic info isn't updated, this problem exists in e1000 & rtl8139

---
 hw/net/e1000.c   | 1 +
 hw/net/rtl8139.c | 1 +
 2 files changed, 2 insertions(+)
hw/net/e1000.c +1 -0
index 151d25e..9a1c46e 100644
@@ -401,6 +401,7 @@ static void e1000_reset(void *opaque)
         d->mac_reg[RA] |= macaddr[i] << (8 * i);
         d->mac_reg[RA + 1] |= (i < 2) ? macaddr[i + 4] << (8 * i) : 0;
     }
+    qemu_format_nic_info_str(qemu_get_queue(d->nic), macaddr);
 }
 
 static void
hw/net/rtl8139.c +1 -0
index c31199f..9b4a650 100644
@@ -1214,6 +1214,7 @@ static void rtl8139_reset(DeviceState *d)
 
     /* restore MAC address */
     memcpy(s->phys, s->conf.macaddr.a, 6);
+    qemu_format_nic_info_str(qemu_get_queue(s->nic), s->phys);
 
     /* reset interrupt mask */
     s->IntrStatus = 0;
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL v2 2/3] net/e1000: update network information when macaddr is changed in guest

In reply to Stefan Hajnoczi

From: Amos Kong <[email protected]>

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.

---
 hw/net/e1000.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/net/e1000.c +8 -0
index 9a1c46e..70a59fd 100644
@@ -1106,7 +1106,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
Signature · 1 line
1.8.3.1
#3 lore raw

[Qemu-devel] [PULL v2 3/3] net/rtl8139: update network information when macaddr is changed in guest

In reply to Stefan Hajnoczi

From: Amos Kong <[email protected]>

rtl8139 has same problem as e1000, nic info isn't updated when macaddr is changed in guest.

This patch updates the nic info when the last bit of macaddr is written.

---
 hw/net/rtl8139.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/net/rtl8139.c +5 -1
index 9b4a650..3225f3d 100644
@@ -2741,8 +2741,12 @@ static void rtl8139_io_writeb(void *opaque, uint8_t addr, uint32_t val)
 
     switch (addr)
     {
-        case MAC0 ... MAC0+5:
+        case MAC0 ... MAC0+4:
+            s->phys[addr - MAC0] = val;
+            break;
+        case MAC0+5:
             s->phys[addr - MAC0] = val;
+            qemu_format_nic_info_str(qemu_get_queue(s->nic), s->phys);
             break;
         case MAC0+6 ... MAC0+7:
             /* reserved */
Signature · 1 line
1.8.3.1