qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: qemu-devel@nongnu.org
Cc: rusty@rustcorp.com.au, virtualization@lists.linux-foundation.org,
	stefanha@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [RFC qemu PATCH] only writing out the last byte of MAC makes it have effect
Date: Thu, 21 Mar 2013 14:44:50 +0800	[thread overview]
Message-ID: <1363848290-30344-1-git-send-email-akong@redhat.com> (raw)
In-Reply-To: <1363834956-9409-1-git-send-email-akong@redhat.com>

The lengcy guests don't have mac programming command, we don't know when
it's safe to use MAC. This patch changed qemu to makes MAC change effect
when the last byte of MAC is written to config space.

MAC address takes first 6 bytes of config space of virtio-net, the addr
is 5 when the last byte is written in virtio_config_writeb().

MAC change will effect when n->mac is updated in virtio_net_set_config().

Signed-off-by: Amos Kong <akong@redhat.com>
---
 hw/virtio.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/hw/virtio.c b/hw/virtio.c
index 26fbc79..2e08302 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -605,8 +605,9 @@ void virtio_config_writeb(VirtIODevice *vdev, uint32_t addr, uint32_t data)
 
     stb_p(vdev->config + addr, val);
 
-    if (vdev->set_config)
+    if (vdev->set_config && (addr == 5 || strcmp(vdev->name, "virtio-net"))) {
         vdev->set_config(vdev, vdev->config);
+    }
 }
 
 void virtio_config_writew(VirtIODevice *vdev, uint32_t addr, uint32_t data)
-- 
1.7.1

  reply	other threads:[~2013-03-21  6:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21  3:02 [Qemu-devel] [RFC virt-spec PATCH] only writing out the last byte of MAC makes it have effect Amos Kong
2013-03-21  6:44 ` Amos Kong [this message]
2013-03-21 10:51   ` [Qemu-devel] [RFC qemu " Michael S. Tsirkin
2013-03-22  0:15     ` Rusty Russell
2013-03-25  2:23       ` Amos Kong
2013-03-25  6:58         ` Michael S. Tsirkin
2013-04-08  7:05           ` Amos Kong
2013-03-21 10:53 ` [Qemu-devel] [RFC virt-spec " Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363848290-30344-1-git-send-email-akong@redhat.com \
    --to=akong@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).