qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v2 0/3] Net patches
@ 2013-10-18 16:38 Stefan Hajnoczi
  2013-10-18 16:38 ` [Qemu-devel] [PULL v2 1/3] net: update nic info during device reset Stefan Hajnoczi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2013-10-18 16:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Anthony Liguori

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(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL v2 1/3] net: update nic info during device reset
  2013-10-18 16:38 [Qemu-devel] [PULL v2 0/3] Net patches Stefan Hajnoczi
@ 2013-10-18 16:38 ` Stefan Hajnoczi
  2013-10-18 16:38 ` [Qemu-devel] [PULL v2 2/3] net/e1000: update network information when macaddr is changed in guest Stefan Hajnoczi
  2013-10-18 16:38 ` [Qemu-devel] [PULL v2 3/3] net/rtl8139: " Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2013-10-18 16:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Amos Kong, Stefan Hajnoczi, Anthony Liguori

From: Amos Kong <akong@redhat.com>

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

Signed-off-by: Amos Kong <akong@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/net/e1000.c   | 1 +
 hw/net/rtl8139.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 151d25e..9a1c46e 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
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index c31199f..9b4a650 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;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL v2 2/3] net/e1000: update network information when macaddr is changed in guest
  2013-10-18 16:38 [Qemu-devel] [PULL v2 0/3] Net patches Stefan Hajnoczi
  2013-10-18 16:38 ` [Qemu-devel] [PULL v2 1/3] net: update nic info during device reset Stefan Hajnoczi
@ 2013-10-18 16:38 ` Stefan Hajnoczi
  2013-10-18 16:38 ` [Qemu-devel] [PULL v2 3/3] net/rtl8139: " Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2013-10-18 16:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Amos Kong, Stefan Hajnoczi, Anthony Liguori

From: Amos Kong <akong@redhat.com>

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 <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/net/e1000.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 9a1c46e..70a59fd 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -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
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL v2 3/3] net/rtl8139: update network information when macaddr is changed in guest
  2013-10-18 16:38 [Qemu-devel] [PULL v2 0/3] Net patches Stefan Hajnoczi
  2013-10-18 16:38 ` [Qemu-devel] [PULL v2 1/3] net: update nic info during device reset Stefan Hajnoczi
  2013-10-18 16:38 ` [Qemu-devel] [PULL v2 2/3] net/e1000: update network information when macaddr is changed in guest Stefan Hajnoczi
@ 2013-10-18 16:38 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2013-10-18 16:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Amos Kong, Stefan Hajnoczi, Anthony Liguori

From: Amos Kong <akong@redhat.com>

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.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/net/rtl8139.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 9b4a650..3225f3d 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -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 */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-18 16:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-18 16:38 [Qemu-devel] [PULL v2 0/3] Net patches Stefan Hajnoczi
2013-10-18 16:38 ` [Qemu-devel] [PULL v2 1/3] net: update nic info during device reset Stefan Hajnoczi
2013-10-18 16:38 ` [Qemu-devel] [PULL v2 2/3] net/e1000: update network information when macaddr is changed in guest Stefan Hajnoczi
2013-10-18 16:38 ` [Qemu-devel] [PULL v2 3/3] net/rtl8139: " Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).