* [Qemu-devel] [PATCH 0/2] fix updating of nic info @ 2013-10-17 7:02 Amos Kong 2013-10-17 7:02 ` [Qemu-devel] [PATCH 1/2] net/e1000: update network information when macaddr is changed in guest Amos Kong ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Amos Kong @ 2013-10-17 7:02 UTC (permalink / raw) To: qemu-devel; +Cc: anthony, stefanha, mst 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(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 1/2] net/e1000: update network information when macaddr is changed in guest 2013-10-17 7:02 [Qemu-devel] [PATCH 0/2] fix updating of nic info Amos Kong @ 2013-10-17 7:02 ` Amos Kong 2013-10-17 7:02 ` [Qemu-devel] [PATCH 2/2] net/rtl8139: " Amos Kong 2013-10-17 7:58 ` [Qemu-devel] [PATCH 0/2] fix updating of nic info Stefan Hajnoczi 2 siblings, 0 replies; 8+ messages in thread From: Amos Kong @ 2013-10-17 7:02 UTC (permalink / raw) To: qemu-devel; +Cc: anthony, stefanha, mst 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> --- hw/net/e1000.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 151d25e..7769be0 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -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 -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 2/2] net/rtl8139: update network information when macaddr is changed in guest 2013-10-17 7:02 [Qemu-devel] [PATCH 0/2] fix updating of nic info Amos Kong 2013-10-17 7:02 ` [Qemu-devel] [PATCH 1/2] net/e1000: update network information when macaddr is changed in guest Amos Kong @ 2013-10-17 7:02 ` Amos Kong 2013-10-17 7:58 ` [Qemu-devel] [PATCH 0/2] fix updating of nic info Stefan Hajnoczi 2 siblings, 0 replies; 8+ messages in thread From: Amos Kong @ 2013-10-17 7:02 UTC (permalink / raw) To: qemu-devel; +Cc: anthony, stefanha, mst 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> --- 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 c31199f..248d9e9 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -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 */ -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] fix updating of nic info 2013-10-17 7:02 [Qemu-devel] [PATCH 0/2] fix updating of nic info Amos Kong 2013-10-17 7:02 ` [Qemu-devel] [PATCH 1/2] net/e1000: update network information when macaddr is changed in guest Amos Kong 2013-10-17 7:02 ` [Qemu-devel] [PATCH 2/2] net/rtl8139: " Amos Kong @ 2013-10-17 7:58 ` Stefan Hajnoczi 2013-10-17 8:15 ` Michael S. Tsirkin 2 siblings, 1 reply; 8+ messages in thread From: Stefan Hajnoczi @ 2013-10-17 7:58 UTC (permalink / raw) To: Amos Kong; +Cc: stefanha, qemu-devel, anthony, mst On Thu, Oct 17, 2013 at 03:02:48PM +0800, Amos Kong wrote: > 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(-) Thanks, applied to my net tree: https://github.com/stefanha/qemu/commits/net Stefan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] fix updating of nic info 2013-10-17 7:58 ` [Qemu-devel] [PATCH 0/2] fix updating of nic info Stefan Hajnoczi @ 2013-10-17 8:15 ` Michael S. Tsirkin 2013-10-17 8:31 ` Amos Kong 0 siblings, 1 reply; 8+ messages in thread From: Michael S. Tsirkin @ 2013-10-17 8:15 UTC (permalink / raw) To: Stefan Hajnoczi; +Cc: Amos Kong, stefanha, qemu-devel, anthony On Thu, Oct 17, 2013 at 09:58:47AM +0200, Stefan Hajnoczi wrote: > On Thu, Oct 17, 2013 at 03:02:48PM +0800, Amos Kong wrote: > > 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(-) > > Thanks, applied to my net tree: > https://github.com/stefanha/qemu/commits/net > > Stefan 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 :) -- MST ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] fix updating of nic info 2013-10-17 8:15 ` Michael S. Tsirkin @ 2013-10-17 8:31 ` Amos Kong 2013-10-17 9:34 ` Michael S. Tsirkin 0 siblings, 1 reply; 8+ messages in thread From: Amos Kong @ 2013-10-17 8:31 UTC (permalink / raw) To: Michael S. Tsirkin; +Cc: Stefan Hajnoczi, stefanha, qemu-devel, anthony On Thu, Oct 17, 2013 at 11:15:21AM +0300, Michael S. Tsirkin wrote: > On Thu, Oct 17, 2013 at 09:58:47AM +0200, Stefan Hajnoczi wrote: > > On Thu, Oct 17, 2013 at 03:02:48PM +0800, Amos Kong wrote: > > > 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(-) > > > > Thanks, applied to my net tree: > > https://github.com/stefanha/qemu/commits/net > > > > Stefan > > 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. > -- > MST -- Amos. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] fix updating of nic info 2013-10-17 8:31 ` Amos Kong @ 2013-10-17 9:34 ` Michael S. Tsirkin 2013-10-18 10:02 ` Stefan Hajnoczi 0 siblings, 1 reply; 8+ messages in thread From: Michael S. Tsirkin @ 2013-10-17 9:34 UTC (permalink / raw) To: Amos Kong; +Cc: Stefan Hajnoczi, stefanha, qemu-devel, anthony On Thu, Oct 17, 2013 at 04:31:22PM +0800, Amos Kong wrote: > On Thu, Oct 17, 2013 at 11:15:21AM +0300, Michael S. Tsirkin wrote: > > On Thu, Oct 17, 2013 at 09:58:47AM +0200, Stefan Hajnoczi wrote: > > > On Thu, Oct 17, 2013 at 03:02:48PM +0800, Amos Kong wrote: > > > > 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(-) > > > > > > Thanks, applied to my net tree: > > > https://github.com/stefanha/qemu/commits/net > > > > > > Stefan > > > > 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. 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? > > -- > > MST > > -- > Amos. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] fix updating of nic info 2013-10-17 9:34 ` Michael S. Tsirkin @ 2013-10-18 10:02 ` Stefan Hajnoczi 0 siblings, 0 replies; 8+ messages in thread From: Stefan Hajnoczi @ 2013-10-18 10:02 UTC (permalink / raw) To: Michael S. Tsirkin; +Cc: Stefan Hajnoczi, Amos Kong, qemu-devel, anthony On Thu, Oct 17, 2013 at 12:34:27PM +0300, Michael S. Tsirkin wrote: > On Thu, Oct 17, 2013 at 04:31:22PM +0800, Amos Kong wrote: > > On Thu, Oct 17, 2013 at 11:15:21AM +0300, Michael S. Tsirkin wrote: > > > On Thu, Oct 17, 2013 at 09:58:47AM +0200, Stefan Hajnoczi wrote: > > > > On Thu, Oct 17, 2013 at 03:02:48PM +0800, Amos Kong wrote: > > > > > 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(-) > > > > > > > > Thanks, applied to my net tree: > > > > https://github.com/stefanha/qemu/commits/net > > > > > > > > Stefan > > > > > > 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. > > 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-10-18 10:02 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-17 7:02 [Qemu-devel] [PATCH 0/2] fix updating of nic info Amos Kong 2013-10-17 7:02 ` [Qemu-devel] [PATCH 1/2] net/e1000: update network information when macaddr is changed in guest Amos Kong 2013-10-17 7:02 ` [Qemu-devel] [PATCH 2/2] net/rtl8139: " Amos Kong 2013-10-17 7:58 ` [Qemu-devel] [PATCH 0/2] fix updating of nic info Stefan Hajnoczi 2013-10-17 8:15 ` Michael S. Tsirkin 2013-10-17 8:31 ` Amos Kong 2013-10-17 9:34 ` Michael S. Tsirkin 2013-10-18 10:02 ` 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).