From ced770c458ec56e00c9a60e487292f9c83bb2bf4 Mon Sep 17 00:00:00 2001 From: Shiwei Zhang Date: Fri, 23 Dec 2022 14:27:38 +0800 Subject: [PATCH] fix for linux 6.1 --- os_dep/linux/ioctl_cfg80211.c | 14 +++++++------- os_dep/linux/os_intfs.c | 2 +- os_dep/osdep_service.c | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 84ed47a..5fae32a 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -1635,8 +1635,8 @@ exit: return ret; } -static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev - , u8 key_index +static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, + int link_id, u8 key_index #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) , bool pairwise #endif @@ -1779,8 +1779,8 @@ addkey_end: } -static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev - , u8 keyid +static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, + int link_id, u8 keyid #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) , bool pairwise #endif @@ -1944,7 +1944,7 @@ exit: return ret; } -static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, +static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, int link_id, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) u8 key_index, bool pairwise, const u8 *mac_addr) #else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */ @@ -1965,7 +1965,7 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, } static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, - struct net_device *ndev, u8 key_index + struct net_device *ndev, int link_id, u8 key_index #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) , bool unicast, bool multicast #endif @@ -2013,7 +2013,7 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)) int cfg80211_rtw_set_default_mgmt_key(struct wiphy *wiphy, - struct net_device *ndev, u8 key_index) + struct net_device *ndev, int link_id, u8 key_index) { #define SET_DEF_KEY_PARAM_FMT " key_index=%d" #define SET_DEF_KEY_PARAM_ARG , key_index diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 248d4f7..7bd0ca6 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1643,7 +1643,7 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name) u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj); #ifdef CONFIG_RTW_NAPI - netif_napi_add(ndev, &adapter->napi, rtw_recv_napi_poll, RTL_NAPI_WEIGHT); + netif_napi_add(ndev, &adapter->napi, rtw_recv_napi_poll); #endif /* CONFIG_RTW_NAPI */ #if defined(CONFIG_IOCTL_CFG80211) diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index d4a01c8..5ba97cd 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -2614,15 +2614,15 @@ u64 rtw_division64(u64 x, u64 y) inline u32 rtw_random32(void) { #ifdef PLATFORM_LINUX -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) - return prandom_u32(); -#elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) - u32 random_int; - get_random_bytes(&random_int , 4); - return random_int; -#else - return random32(); -#endif +// #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +// return prandom_u32(); +// #elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) +// u32 random_int; +// get_random_bytes(&random_int , 4); +// return random_int; +// #else + return get_random_u32(); +// #endif #elif defined(PLATFORM_WINDOWS) #error "to be implemented\n" #elif defined(PLATFORM_FREEBSD)