Merge git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-mn10300
[safe/jmp/linux-2.6] / drivers / net / virtio_net.c
index e68813a..9c82a39 100644 (file)
@@ -565,6 +565,23 @@ stop_queue:
        goto done;
 }
 
+static int virtnet_set_mac_address(struct net_device *dev, void *p)
+{
+       struct virtnet_info *vi = netdev_priv(dev);
+       struct virtio_device *vdev = vi->vdev;
+       int ret;
+
+       ret = eth_mac_addr(dev, p);
+       if (ret)
+               return ret;
+
+       if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC))
+               vdev->config->set(vdev, offsetof(struct virtio_net_config, mac),
+                                 dev->dev_addr, dev->addr_len);
+
+       return 0;
+}
+
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void virtnet_netpoll(struct net_device *dev)
 {
@@ -774,7 +791,7 @@ static const struct net_device_ops virtnet_netdev = {
        .ndo_stop            = virtnet_close,
        .ndo_start_xmit      = start_xmit,
        .ndo_validate_addr   = eth_validate_addr,
-       .ndo_set_mac_address = eth_mac_addr,
+       .ndo_set_mac_address = virtnet_set_mac_address,
        .ndo_set_rx_mode     = virtnet_set_rx_mode,
        .ndo_change_mtu      = virtnet_change_mtu,
        .ndo_vlan_rx_add_vid = virnet_vlan_rx_add_vid,
@@ -934,6 +951,7 @@ static int virtnet_probe(struct virtio_device *vdev)
 
        vi->status = VIRTIO_NET_S_LINK_UP;
        virtnet_update_status(vi);
+       netif_carrier_on(dev);
 
        pr_debug("virtnet: registered device %s\n", dev->name);
        return 0;