* [Qemu-devel] [6534] qemu:virtio-net: Allow setting the MAC address via set_config ( Alex Williamson)
@ 2009-02-05 22:36 Anthony Liguori
0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2009-02-05 22:36 UTC (permalink / raw)
To: qemu-devel
Revision: 6534
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6534
Author: aliguori
Date: 2009-02-05 22:36:08 +0000 (Thu, 05 Feb 2009)
Log Message:
-----------
qemu:virtio-net: Allow setting the MAC address via set_config (Alex Williamson)
Allow the guest to write to the MAC address config space and update
the network info string when it does. Rename get_config for symmetry.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Modified Paths:
--------------
trunk/hw/virtio-net.c
Modified: trunk/hw/virtio-net.c
===================================================================
--- trunk/hw/virtio-net.c 2009-02-05 22:36:04 UTC (rev 6533)
+++ trunk/hw/virtio-net.c 2009-02-05 22:36:08 UTC (rev 6534)
@@ -40,7 +40,7 @@
return (VirtIONet *)vdev;
}
-static void virtio_net_update_config(VirtIODevice *vdev, uint8_t *config)
+static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
{
VirtIONet *n = to_virtio_net(vdev);
struct virtio_net_config netcfg;
@@ -50,6 +50,19 @@
memcpy(config, &netcfg, sizeof(netcfg));
}
+static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config)
+{
+ VirtIONet *n = to_virtio_net(vdev);
+ struct virtio_net_config netcfg;
+
+ memcpy(&netcfg, config, sizeof(netcfg));
+
+ if (memcmp(netcfg.mac, n->mac, 6)) {
+ memcpy(n->mac, netcfg.mac, 6);
+ qemu_format_nic_info_str(n->vc, n->mac);
+ }
+}
+
static void virtio_net_set_link_status(VLANClientState *vc)
{
VirtIONet *n = vc->opaque;
@@ -337,7 +350,8 @@
if (!n)
return;
- n->vdev.get_config = virtio_net_update_config;
+ n->vdev.get_config = virtio_net_get_config;
+ n->vdev.set_config = virtio_net_set_config;
n->vdev.get_features = virtio_net_get_features;
n->vdev.set_features = virtio_net_set_features;
n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-02-05 22:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-05 22:36 [Qemu-devel] [6534] qemu:virtio-net: Allow setting the MAC address via set_config ( Alex Williamson) Anthony Liguori
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).