summaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2012-06-29 07:10:06 +0200
committerDavid S. Miller <davem@davemloft.net>2012-06-30 10:08:00 +0200
commitf2f2c8b42d5b1858e1680133fcd4bea5c8dcdb2c (patch)
tree277f7daa2ea17676e7749583f7a7513b54aa088a /drivers/net/virtio_net.c
parentnet: introduce new priv_flag indicating iface capable of change mac when running (diff)
downloadlinux-f2f2c8b42d5b1858e1680133fcd4bea5c8dcdb2c.tar.xz
linux-f2f2c8b42d5b1858e1680133fcd4bea5c8dcdb2c.zip
virtio_net: use IFF_LIVE_ADDR_CHANGE priv_flag
Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 36a16d581f71..1db445b2ecc7 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -679,12 +679,11 @@ 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;
- struct sockaddr *addr = p;
+ int ret;
- if (!is_valid_ether_addr(addr->sa_data))
- return -EADDRNOTAVAIL;
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
- dev->addr_assign_type &= ~NET_ADDR_RANDOM;
+ 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),
@@ -1063,7 +1062,7 @@ static int virtnet_probe(struct virtio_device *vdev)
return -ENOMEM;
/* Set up network device as normal. */
- dev->priv_flags |= IFF_UNICAST_FLT;
+ dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
dev->netdev_ops = &virtnet_netdev;
dev->features = NETIF_F_HIGHDMA;