diff options
author | Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> | 2016-02-01 11:18:03 +0530 |
---|---|---|
committer | Alexey Kardashevskiy <aik@ozlabs.ru> | 2016-02-08 16:40:39 +1100 |
commit | aa9566d2ed5c4fdcaa385759475c75bb0d0801d4 (patch) | |
tree | daa8fa79c2720690ed98fc8b2ca7281729ffde61 /lib/libvirtio/virtio-net.c | |
parent | 31312dcf4430c372318ed56ba5a9006fc6546d8d (diff) | |
download | SLOF-aa9566d2ed5c4fdcaa385759475c75bb0d0801d4.zip SLOF-aa9566d2ed5c4fdcaa385759475c75bb0d0801d4.tar.gz SLOF-aa9566d2ed5c4fdcaa385759475c75bb0d0801d4.tar.bz2 |
virtio-net: move setup-mac to the open routine
MAC reading should be done after the initialization of the device after
the features negotiation.
Adjust the open routine accordingly. There is no point in sending the
mac address to the virtionet_open. Change the signature. Also read the
mac address directly from the config space to remove the dependency of
getting the mac address from the open routine.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'lib/libvirtio/virtio-net.c')
-rw-r--r-- | lib/libvirtio/virtio-net.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libvirtio/virtio-net.c b/lib/libvirtio/virtio-net.c index 83a99db..f8b8cec 100644 --- a/lib/libvirtio/virtio-net.c +++ b/lib/libvirtio/virtio-net.c @@ -157,7 +157,9 @@ static int virtionet_init(net_driver_t *driver) virtio_queue_notify(&virtiodev, VQ_RX); driver->running = 1; - + for(i = 0; i < (int)sizeof(driver->mac_addr); i++) { + driver->mac_addr[i] = virtio_get_config(&virtiodev, i, 1); + } return 0; dev_error: @@ -284,7 +286,7 @@ static int virtionet_receive(char *buf, int maxlen) return len; } -net_driver_t *virtionet_open(char *mac_addr, int len, struct virtio_device *dev) +net_driver_t *virtionet_open(struct virtio_device *dev) { net_driver_t *driver; @@ -294,7 +296,6 @@ net_driver_t *virtionet_open(char *mac_addr, int len, struct virtio_device *dev) return NULL; } - memcpy(driver->mac_addr, mac_addr, 6); driver->running = 0; if (virtionet_init_pci(dev)) |