diff options
author | Anthony Liguori <aliguori@amazon.com> | 2013-10-18 10:02:48 -0700 |
---|---|---|
committer | Anthony Liguori <aliguori@amazon.com> | 2013-10-18 10:02:48 -0700 |
commit | 3551643eb7198398017829a7d26646de1710b0b6 (patch) | |
tree | 43d61e418d0a4bd4c092848d020aa2fbc3e57a33 /hw | |
parent | 1da9772d83576cef463b88adb7c390f978ef4ea3 (diff) | |
parent | 23c37c37f0280761072c23bf67d3a4f3c0ff25aa (diff) |
Merge remote-tracking branch 'stefanha/net' into staging
# By Amos Kong
# Via Stefan Hajnoczi
* stefanha/net:
net/rtl8139: update network information when macaddr is changed in guest
net/e1000: update network information when macaddr is changed in guest
net: update nic info during device reset
Message-id: 1382103314-21608-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/net/e1000.c | 9 | ||||
-rw-r--r-- | hw/net/rtl8139.c | 7 |
2 files changed, 15 insertions, 1 deletions
diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 151d25e0b7..70a59fde7f 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -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 @@ -1105,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 diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index c31199f8c8..3225f3d3e5 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -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; @@ -2740,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 */ |