From 6dda660a6af1b18654bbbbedd933cdf30683b7a1 Mon Sep 17 00:00:00 2001 From: morrownr Date: Thu, 18 Aug 2022 09:56:32 -0500 Subject: [PATCH] support for kernels 5.19.2 and 6.0 --- README.md | 2 +- os_dep/linux/ioctl_cfg80211.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 490a8d1..f9968bc 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ echo "blacklist rtw88_8822bu" > /etc/modprobe.d/rtw8822bu.conf ### Compatible Kernels - Kernels: 4.19 - 5.11 (Realtek) -- Kernels: 5.12 - 5.19 (community support) +- Kernels: 5.12 - 6.0 (community support) ### Tested Linux Distributions diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 39faaf8..a97c7a8 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -475,7 +475,11 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, if (!rtw_cfg80211_allow_ch_switch_notify(adapter)) goto exit; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) + cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0); +#else cfg80211_ch_switch_notify(adapter->pnetdev, &chdef); +#endif #else int freq = rtw_ch2freq(ch); @@ -490,8 +494,12 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, } ctype = rtw_chbw_to_nl80211_channel_type(ch, bw, offset, ht); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) + cfg80211_ch_switch_notify(adapter->pnetdev, freq, ctype, 0); +#else cfg80211_ch_switch_notify(adapter->pnetdev, freq, ctype); #endif +#endif exit: return ret; @@ -1139,7 +1147,11 @@ check_bss: #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) + roam_info.links[0].bssid = cur_network->network.MacAddress; +#else roam_info.bssid = cur_network->network.MacAddress; +#endif roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2; roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2; roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6; @@ -5375,7 +5387,12 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd return ret; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) +static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, + unsigned int link_id) +#else static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) +#endif { _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev); @@ -6751,7 +6768,11 @@ exit: #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) static int cfg80211_rtw_get_channel(struct wiphy *wiphy, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) + struct wireless_dev *wdev, unsigned int link_id, +#else struct wireless_dev *wdev, +#endif struct cfg80211_chan_def *chandef) { _adapter *padapter = wiphy_to_adapter(wiphy); @@ -10686,7 +10707,11 @@ void rtw_wdev_unregister(struct wireless_dev *wdev) rtw_cfg80211_indicate_scan_done(adapter, _TRUE); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) + if (wdev->links[0].client.current_bss) { + #else if (wdev->current_bss) { + #endif RTW_INFO(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter)); rtw_cfg80211_indicate_disconnect(adapter, 0, 1); }