diff --git a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c index f169dc9..0e14473 100644 --- a/os_dep/linux/ioctl_linux.c +++ b/os_dep/linux/ioctl_linux.c @@ -9786,7 +9786,12 @@ static int rtw_mp_efuse_set(struct net_device *dev, rtw_hal_read_chip_info(padapter); /* set mac addr*/ rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter)); + + #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) _rtw_memcpy(padapter->pnetdev->dev_addr, get_hal_mac_addr(padapter), ETH_ALEN); /* set mac addr to net_device */ + #else + eth_hw_addr_set(padapter->pnetdev, get_hal_mac_addr(padapter)); + #endif #ifdef CONFIG_P2P rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter)); diff --git a/os_dep/linux/mlme_linux.c b/os_dep/linux/mlme_linux.c index 39c0ac1..d8e672b 100644 --- a/os_dep/linux/mlme_linux.c +++ b/os_dep/linux/mlme_linux.c @@ -400,7 +400,11 @@ int hostapd_mode_init(_adapter *padapter) mac[4] = 0x11; mac[5] = 0x12; + #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) _rtw_memcpy(pnetdev->dev_addr, mac, ETH_ALEN); + #else + eth_hw_addr_set(pnetdev, mac); + #endif rtw_netif_carrier_off(pnetdev); diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 808be91..864c6ae 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1241,7 +1241,11 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *addr) } _rtw_memcpy(adapter_mac_addr(padapter), sa->sa_data, ETH_ALEN); /* set mac addr to adapter */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) _rtw_memcpy(pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */ + #else + eth_hw_addr_set(pnetdev, sa->sa_data); + #endif #if 0 if (rtw_is_hw_init_completed(padapter)) { @@ -1703,7 +1707,11 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name) /* alloc netdev name */ rtw_init_netdev_name(ndev, name); + #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) _rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN); + #else + eth_hw_addr_set(ndev, adapter_mac_addr(adapter)); + #endif /* Tell the network stack we exist */ @@ -2671,7 +2679,11 @@ int _netdev_vir_if_open(struct net_device *pnetdev) rtw_mbid_camid_alloc(padapter, adapter_mac_addr(padapter)); #endif rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter)); + #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); + #else + eth_hw_addr_set(pnetdev, adapter_mac_addr(padapter)); + #endif } #endif /*CONFIG_PLATFORM_INTEL_BYT*/ @@ -3420,7 +3432,11 @@ int _netdev_open(struct net_device *pnetdev) rtw_mbid_camid_alloc(padapter, adapter_mac_addr(padapter)); #endif rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter)); + #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); + #else + eth_hw_addr_set(pnetdev, adapter_mac_addr(padapter)); + #endif #endif /* CONFIG_PLATFORM_INTEL_BYT */ rtw_clr_surprise_removed(padapter); diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index c7e60ea..b6c8ae8 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -2513,7 +2513,11 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname) rtw_init_netdev_name(pnetdev, ifname); + #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); + #else + eth_hw_addr_set(pnetdev, adapter_mac_addr(padapter)); + #endif if (rtnl_lock_needed) ret = register_netdev(pnetdev);