fix updating of nic info
cover fix updating of nic info
I tried to change macaddr in guest, addr in guest is updated, and guest network is fine. But the nic information in monitor isn't update. This problem both exists in e1000 and rtl8139.
1) change macaddr in guest by ifconfig guest)# ifconfig eth0 hw ether 12:12:12:34:35:36 guest)# ifconfig eth0
2) check network information in monitor
(qemu) info network
Amos Kong (2):
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 | 8 ++++++++ hw/net/rtl8139.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 net/e1000: update network information when macaddr is changed in guest
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
@@ -1105,7 +1105,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
PATCH 2/2 net/rtl8139: update network information when macaddr is changed in guest
In reply to Amos Kongrtl8139 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
@@ -2740,8 +2740,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
Stefan Hajnoczi
AppliedQuoted 11 lines · Amos Kong
I tried to change macaddr in guest, addr in guest is updated, and guest network is fine. But the nic information in monitor isn't update. This problem both exists in e1000 and rtl8139.
1) change macaddr in guest by ifconfig guest)# ifconfig eth0 hw ether 12:12:12:34:35:36 guest)# ifconfig eth0
2) check network information in monitor
(qemu) info network
Quoted 8 lines
Amos Kong (2):
net/e1000: update network information when macaddr is changed in guest net/rtl8139: update network information when macaddr is changed in
guesthw/net/e1000.c | 8 ++++++++ hw/net/rtl8139.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)
Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net
Stefan
Quoted 17 lines · Stefan Hajnoczi
Quoted 16 lines · Amos Kong
I tried to change macaddr in guest, addr in guest is updated, and guest network is fine. But the nic information in monitor isn't update. This problem both exists in e1000 and rtl8139.
1) change macaddr in guest by ifconfig guest)# ifconfig eth0 hw ether 12:12:12:34:35:36 guest)# ifconfig eth0
2) check network information in monitor
(qemu) info networkAmos Kong (2):
net/e1000: update network information when macaddr is changed in guest net/rtl8139: update network information when macaddr is changed in
guest
Quoted 8 lines
Quoted 3 lines
hw/net/e1000.c | 8 ++++++++ hw/net/rtl8139.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/netStefan
Please revert, this is buggy:
info is changed on guest mac write but is
not reverted on reset.
Let's fix it properly, no need to introduce
new regressions when fixing old bugs :)
Signature · 1 line
MST
Quoted 27 lines · Michael S. Tsirkin
Quoted 17 lines · Stefan Hajnoczi
Quoted 16 lines · Amos Kong
I tried to change macaddr in guest, addr in guest is updated, and guest network is fine. But the nic information in monitor isn't update. This problem both exists in e1000 and rtl8139.
1) change macaddr in guest by ifconfig guest)# ifconfig eth0 hw ether 12:12:12:34:35:36 guest)# ifconfig eth0
2) check network information in monitor
(qemu) info networkAmos Kong (2):
net/e1000: update network information when macaddr is changed in guest net/rtl8139: update network information when macaddr is changed in
guestQuoted 8 lines
Quoted 3 lines
hw/net/e1000.c | 8 ++++++++ hw/net/rtl8139.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/netStefan
Quoted 7 lines
Please revert, this is buggy:
info is changed on guest mac write but is
not reverted on reset.Let's fix it properly, no need to introduce
new regressions when fixing old bugs :)
After 'system_reset' or 'reboot', nic info can't be changed until device init.
Updating nic info during reset is another issue, I will send patch to fix it.
Quoted 2 lines
Signature · 1 line
MST
Signature · 1 line
Amos.
Quoted 33 lines · Amos Kong
Quoted 32 lines · Michael S. Tsirkin
Quoted 17 lines · Stefan Hajnoczi
Quoted 16 lines · Amos Kong
I tried to change macaddr in guest, addr in guest is updated, and guest network is fine. But the nic information in monitor isn't update. This problem both exists in e1000 and rtl8139.
1) change macaddr in guest by ifconfig guest)# ifconfig eth0 hw ether 12:12:12:34:35:36 guest)# ifconfig eth0
2) check network information in monitor
(qemu) info networkAmos Kong (2):
net/e1000: update network information when macaddr is changed in guest net/rtl8139: update network information when macaddr is changed in
guestQuoted 8 lines
Quoted 3 lines
hw/net/e1000.c | 8 ++++++++ hw/net/rtl8139.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/netStefan
Please revert, this is buggy:
info is changed on guest mac write but is
not reverted on reset.
Quoted 8 lines
Quoted 2 lines
Let's fix it properly, no need to introduce
new regressions when fixing old bugs :)After '
system_reset' or 'reboot', nic info can't be changed until device init.Updating nic info during reset is another issue, I will send patch to fix it.
OK so let's apply the reset change first, then these patches on top. This way we don't break bisect.
Stefan can you rearrange pls?
Quoted 5 lines
Quoted 2 lines
Signature · 1 line
MSTSignature · 1 line
Amos.
Quoted 40 lines · Michael S. Tsirkin
Quoted 39 lines · Amos Kong
Quoted 27 lines · Michael S. Tsirkin
Quoted 17 lines · Stefan Hajnoczi
Quoted 16 lines · Amos Kong
I tried to change macaddr in guest, addr in guest is updated, and guest network is fine. But the nic information in monitor isn't update. This problem both exists in e1000 and rtl8139.
1) change macaddr in guest by ifconfig guest)# ifconfig eth0 hw ether 12:12:12:34:35:36 guest)# ifconfig eth0
2) check network information in monitor
(qemu) info networkAmos Kong (2):
net/e1000: update network information when macaddr is changed in guest net/rtl8139: update network information when macaddr is changed in
guestQuoted 8 lines
Quoted 3 lines
hw/net/e1000.c | 8 ++++++++ hw/net/rtl8139.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/netStefan
Quoted 7 lines
Please revert, this is buggy:
info is changed on guest mac write but is
not reverted on reset.Let's fix it properly, no need to introduce
new regressions when fixing old bugs :)After '
system_reset' or 'reboot', nic info can't be changed until device init.
Quoted 6 lines
Quoted 2 lines
Updating nic info during reset is another issue, I will send patch to fix it.
OK so let's apply the reset change first, then these patches on top. This way we don't break bisect.
Stefan can you rearrange pls?
Yes, I will reorder the patches. Thanks for spotting this problem.
Stefan