1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
< >
diff --git a/kernel/drivers/net/u***/r8152.c b/kernel/drivers/net/u***/r8152.c old mode 100644 new mode 100755 index 2bb336c..4213617 --- a/kernel/drivers/net/u***/r8152.c +++ b/kernel/drivers/net/u***/r8152.c @@ -26,6 +26,7 @@ #include #include #include +#include /* Information for net-next */ #define NETNEXT_VERSION "08" @@ -649,6 +650,21 @@ enum tx_csum_stat { TX_CSUM_NONE }; +int eth_mac_from_system_serial(u8 *addr) +{ + if (system_serial_low != 0 && system_serial_high != 0) { + printk("[eth]Create an address from the system serial number.n"); + addr[0] = (system_serial_high >> 24) & 0xfe;/* clear multicast bit */ + addr[1] = (system_serial_high >> 16) | 0x02;/* set local assignment bit (IEEE802) */ + addr[2] = system_serial_low >> 24; + addr[3] = system_serial_low >> 16; + addr[4] = system_serial_low >> 8; + addr[5] = system_serial_low; + printk("#############%s: ------------%pMn",__func__,addr); + } + return 0; +} + /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). * The RTL chips use a 64 element hash table based on the Ethernet CRC. */ @@ -1048,6 +1064,7 @@ static int set_ethernet_addr(struct r8152 *tp) netif_err(tp, probe, dev, "Invalid ether addr %pMn", sa.sa_data); eth_hw_addr_random(dev); + eth_mac_from_system_serial(dev->dev_addr); ether_addr_copy(sa.sa_data, dev->dev_addr); ret = rtl8152_set_mac_address(dev, &sa); netif_info(tp, probe, dev, "Random ether addr %pMn", |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
基于米尔瑞芯微RK3576核心板/开发板的人脸疲劳检测应用方案
498 浏览 0 评论
768 浏览 1 评论
667 浏览 1 评论
1893 浏览 1 评论
3138 浏览 1 评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 17:09 , Processed in 0.569440 second(s), Total 70, Slave 54 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号