diff --git a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c index 2c288b12..304ce375 100644 --- a/os_dep/linux/ioctl_linux.c +++ b/os_dep/linux/ioctl_linux.c @@ -9922,8 +9922,11 @@ 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)) + eth_hw_addr_set(padapter->pnetdev, get_hal_mac_addr(padapter)); +#else _rtw_memcpy(padapter->pnetdev->dev_addr, get_hal_mac_addr(padapter), ETH_ALEN); /* set mac addr to net_device */ - +#endif #ifdef CONFIG_P2P rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter)); #endif diff --git a/os_dep/linux/mlme_linux.c b/os_dep/linux/mlme_linux.c index 67255452..b7c08b65 100644 --- a/os_dep/linux/mlme_linux.c +++ b/os_dep/linux/mlme_linux.c @@ -402,8 +402,11 @@ int hostapd_mode_init(_adapter *padapter) mac[4] = 0x11; mac[5] = 0x12; +#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 17, 0)) + eth_hw_addr_set(pnetdev, mac); +#else _rtw_memcpy(pnetdev->dev_addr, mac, ETH_ALEN); - +#endif rtw_netif_carrier_off(pnetdev); diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 01c25bd4..4bd3a081 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1187,7 +1187,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)) + eth_hw_addr_set(pnetdev, sa->sa_data); /* set mac addr to net_device */ +#else _rtw_memcpy(pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */ +#endif #if 0 if (rtw_is_hw_init_completed(padapter)) { @@ -1612,8 +1616,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)) + eth_hw_addr_set(ndev, adapter_mac_addr(adapter)); /* set mac addr to net_device */ +#else _rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN); +#endif #if defined(CONFIG_NET_NS) dev_net_set(ndev, wiphy_net(adapter_to_wiphy(adapter))); #endif //defined(CONFIG_NET_NS) @@ -2529,7 +2536,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)) + eth_hw_addr_set(pnetdev, adapter_mac_addr(padapter)); +#else _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); +#endif } #endif /*CONFIG_PLATFORM_INTEL_BYT*/ @@ -3166,7 +3177,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)) + eth_hw_addr_set(pnetdev, adapter_mac_addr(padapter)); +#else _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); +#endif #endif /* CONFIG_PLATFORM_INTEL_BYT */ rtw_clr_surprise_removed(padapter); @@ -4855,4 +4870,4 @@ int get_openhd_override_channel(void){ } int get_openhd_override_channel_width(void){ return openhd_override_channel_width; -} \ No newline at end of file +} diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 0cb1c2fe..efd6adb8 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -2167,8 +2167,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)) + eth_hw_addr_set(pnetdev, adapter_mac_addr(padapter)); +#else _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); - +#endif if (rtnl_lock_needed) ret = register_netdev(pnetdev); else