1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-28 03:47:31 +02:00

[ar71xx] move random MAC address generation into the platform initialization code

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14204 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2009-01-26 14:55:09 +00:00
parent d66ff4b458
commit 03b0188081
3 changed files with 13 additions and 12 deletions

View File

@ -15,6 +15,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/etherdevice.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/ath9k_platform.h> #include <linux/ath9k_platform.h>
@ -456,8 +457,15 @@ void __init ar71xx_add_device_eth(unsigned int id)
break; break;
} }
memcpy(pdata->mac_addr, ar71xx_mac_base, ETH_ALEN); if (is_valid_ether_addr(ar71xx_mac_base)) {
pdata->mac_addr[5] += ar71xx_eth_instance; memcpy(pdata->mac_addr, ar71xx_mac_base, ETH_ALEN);
pdata->mac_addr[5] += ar71xx_eth_instance;
} else {
random_ether_addr(pdata->mac_addr);
printk(KERN_DEBUG
"ar71xx: using random MAC address for eth%d\n",
ar71xx_eth_instance);
}
platform_device_register(pdev); platform_device_register(pdev);
ar71xx_eth_instance++; ar71xx_eth_instance++;

View File

@ -38,7 +38,7 @@
#define ETH_FCS_LEN 4 #define ETH_FCS_LEN 4
#define AG71XX_DRV_NAME "ag71xx" #define AG71XX_DRV_NAME "ag71xx"
#define AG71XX_DRV_VERSION "0.5.16" #define AG71XX_DRV_VERSION "0.5.17"
#define AG71XX_NAPI_WEIGHT 64 #define AG71XX_NAPI_WEIGHT 64
#define AG71XX_OOM_REFILL (1 + HZ/10) #define AG71XX_OOM_REFILL (1 + HZ/10)

View File

@ -868,16 +868,9 @@ static int __init ag71xx_probe(struct platform_device *pdev)
ag->oom_timer.data = (unsigned long) dev; ag->oom_timer.data = (unsigned long) dev;
ag->oom_timer.function = ag71xx_oom_timer_handler; ag->oom_timer.function = ag71xx_oom_timer_handler;
netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); memcpy(dev->dev_addr, pdata->mac_addr, ETH_ALEN);
if (is_valid_ether_addr(pdata->mac_addr)) netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT);
memcpy(dev->dev_addr, pdata->mac_addr, ETH_ALEN);
else {
dev->dev_addr[0] = 0xde;
dev->dev_addr[1] = 0xad;
get_random_bytes(&dev->dev_addr[2], 3);
dev->dev_addr[5] = pdev->id & 0xff;
}
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {