Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134291
b: refs/heads/master
c: 9c46f6d
h: refs/heads/master
i:
  134289: 045c758
  134287: 3fe6542
v: v3
  • Loading branch information
Alex Williamson authored and David S. Miller committed Feb 5, 2009
1 parent 97c07b6 commit 7d9f140
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0bde95690d65653e420d04856c5d5783155c747c
refs/heads/master: 9c46f6d42f1b5627c49a5906cb5b315ad8716ff0
23 changes: 21 additions & 2 deletions trunk/drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,22 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
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;

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)
{
Expand Down Expand Up @@ -774,7 +790,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,
Expand Down Expand Up @@ -860,8 +876,11 @@ static int virtnet_probe(struct virtio_device *vdev)
vdev->config->get(vdev,
offsetof(struct virtio_net_config, mac),
dev->dev_addr, dev->addr_len);
} else
} else {
random_ether_addr(dev->dev_addr);
vdev->config->set(vdev, offsetof(struct virtio_net_config, mac),
dev->dev_addr, dev->addr_len);
}

/* Set up our device-specific information */
vi = netdev_priv(dev);
Expand Down

0 comments on commit 7d9f140

Please sign in to comment.