diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/virtio_net.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index e68813a246db..3d0033920224 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -565,6 +565,22 @@ stop_queue: | |||
565 | goto done; | 565 | goto done; |
566 | } | 566 | } |
567 | 567 | ||
568 | static int virtnet_set_mac_address(struct net_device *dev, void *p) | ||
569 | { | ||
570 | struct virtnet_info *vi = netdev_priv(dev); | ||
571 | struct virtio_device *vdev = vi->vdev; | ||
572 | int ret; | ||
573 | |||
574 | ret = eth_mac_addr(dev, p); | ||
575 | if (ret) | ||
576 | return ret; | ||
577 | |||
578 | vdev->config->set(vdev, offsetof(struct virtio_net_config, mac), | ||
579 | dev->dev_addr, dev->addr_len); | ||
580 | |||
581 | return 0; | ||
582 | } | ||
583 | |||
568 | #ifdef CONFIG_NET_POLL_CONTROLLER | 584 | #ifdef CONFIG_NET_POLL_CONTROLLER |
569 | static void virtnet_netpoll(struct net_device *dev) | 585 | static void virtnet_netpoll(struct net_device *dev) |
570 | { | 586 | { |
@@ -774,7 +790,7 @@ static const struct net_device_ops virtnet_netdev = { | |||
774 | .ndo_stop = virtnet_close, | 790 | .ndo_stop = virtnet_close, |
775 | .ndo_start_xmit = start_xmit, | 791 | .ndo_start_xmit = start_xmit, |
776 | .ndo_validate_addr = eth_validate_addr, | 792 | .ndo_validate_addr = eth_validate_addr, |
777 | .ndo_set_mac_address = eth_mac_addr, | 793 | .ndo_set_mac_address = virtnet_set_mac_address, |
778 | .ndo_set_rx_mode = virtnet_set_rx_mode, | 794 | .ndo_set_rx_mode = virtnet_set_rx_mode, |
779 | .ndo_change_mtu = virtnet_change_mtu, | 795 | .ndo_change_mtu = virtnet_change_mtu, |
780 | .ndo_vlan_rx_add_vid = virnet_vlan_rx_add_vid, | 796 | .ndo_vlan_rx_add_vid = virnet_vlan_rx_add_vid, |
@@ -860,8 +876,11 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
860 | vdev->config->get(vdev, | 876 | vdev->config->get(vdev, |
861 | offsetof(struct virtio_net_config, mac), | 877 | offsetof(struct virtio_net_config, mac), |
862 | dev->dev_addr, dev->addr_len); | 878 | dev->dev_addr, dev->addr_len); |
863 | } else | 879 | } else { |
864 | random_ether_addr(dev->dev_addr); | 880 | random_ether_addr(dev->dev_addr); |
881 | vdev->config->set(vdev, offsetof(struct virtio_net_config, mac), | ||
882 | dev->dev_addr, dev->addr_len); | ||
883 | } | ||
865 | 884 | ||
866 | /* Set up our device-specific information */ | 885 | /* Set up our device-specific information */ |
867 | vi = netdev_priv(dev); | 886 | vi = netdev_priv(dev); |