diff options
-rw-r--r-- | drivers/net/sungem.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 616be8d0fa85..08ea61db46fe 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -2530,6 +2530,35 @@ static struct net_device_stats *gem_get_stats(struct net_device *dev) | |||
2530 | return &gp->net_stats; | 2530 | return &gp->net_stats; |
2531 | } | 2531 | } |
2532 | 2532 | ||
2533 | static int gem_set_mac_address(struct net_device *dev, void *addr) | ||
2534 | { | ||
2535 | struct sockaddr *macaddr = (struct sockaddr *) addr; | ||
2536 | struct gem *gp = dev->priv; | ||
2537 | unsigned char *e = &dev->dev_addr[0]; | ||
2538 | |||
2539 | if (!is_valid_ether_addr(macaddr->sa_data)) | ||
2540 | return -EADDRNOTAVAIL; | ||
2541 | |||
2542 | if (!netif_running(dev) || !netif_device_present(dev)) { | ||
2543 | /* We'll just catch it later when the | ||
2544 | * device is up'd or resumed. | ||
2545 | */ | ||
2546 | memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len); | ||
2547 | return 0; | ||
2548 | } | ||
2549 | |||
2550 | mutex_lock(&gp->pm_mutex); | ||
2551 | memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len); | ||
2552 | if (gp->running) { | ||
2553 | writel((e[4] << 8) | e[5], gp->regs + MAC_ADDR0); | ||
2554 | writel((e[2] << 8) | e[3], gp->regs + MAC_ADDR1); | ||
2555 | writel((e[0] << 8) | e[1], gp->regs + MAC_ADDR2); | ||
2556 | } | ||
2557 | mutex_unlock(&gp->pm_mutex); | ||
2558 | |||
2559 | return 0; | ||
2560 | } | ||
2561 | |||
2533 | static void gem_set_multicast(struct net_device *dev) | 2562 | static void gem_set_multicast(struct net_device *dev) |
2534 | { | 2563 | { |
2535 | struct gem *gp = dev->priv; | 2564 | struct gem *gp = dev->priv; |
@@ -3122,6 +3151,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev, | |||
3122 | dev->change_mtu = gem_change_mtu; | 3151 | dev->change_mtu = gem_change_mtu; |
3123 | dev->irq = pdev->irq; | 3152 | dev->irq = pdev->irq; |
3124 | dev->dma = 0; | 3153 | dev->dma = 0; |
3154 | dev->set_mac_address = gem_set_mac_address; | ||
3125 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3155 | #ifdef CONFIG_NET_POLL_CONTROLLER |
3126 | dev->poll_controller = gem_poll_controller; | 3156 | dev->poll_controller = gem_poll_controller; |
3127 | #endif | 3157 | #endif |