[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [6534] qemu:virtio-net: Allow setting the MAC address via s
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [6534] qemu:virtio-net: Allow setting the MAC address via set_config ( Alex Williamson) |
Date: |
Thu, 05 Feb 2009 22:36:08 +0000 |
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 <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [6534] qemu:virtio-net: Allow setting the MAC address via set_config ( Alex Williamson),
Anthony Liguori <=