From 08fd49f9d0167bafa18876b85a2bc39018ef7f32 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 17 Dec 2023 20:56:45 +0100 Subject: [PATCH] [RTL8852BU] Update for upstream change netif_napi_add() => netif_napi_add_weight() https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b48b89f Add missing new argument to cfg80211_ch_switch_notify() https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b8c9024 roam_info.bssid => roam_info.links[0].bssid https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=efbabc1 cfg80211_rtw_*_key(): add int link_id https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e7a7b84 struct wireless_dev: current_bss => connected https://github.com/lwfinger/rtl8723du/commit/39c864c REGULATORY_IGNORE_STALE_KICKOFF undeclared: https://github.com/morrownr/88x2bu-20210702/issues/165 Signed-off-by: MichaIng --- .../rtl8852bu/os_dep/linux/ioctl_cfg80211.c | 39 +++++++++++++++++-- .../staging/rtl8852bu/os_dep/linux/os_intfs.c | 2 +- .../rtl8852bu/os_dep/linux/wifi_regd.c | 2 +- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8852bu/os_dep/linux/ioctl_cfg80211.c b/drivers/staging/rtl8852bu/os_dep/linux/ioctl_cfg80211.c index 17078a4c8b7f..fc00c89a9e47 100755 --- a/drivers/staging/rtl8852bu/os_dep/linux/ioctl_cfg80211.c +++ b/drivers/staging/rtl8852bu/os_dep/linux/ioctl_cfg80211.c @@ -483,7 +483,9 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) if (started) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) + cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0, 0, false); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)) /* --- cfg80211_ch_switch_started_notfiy() --- * A new parameter, bool quiet, is added from Linux kernel v5.11, @@ -504,7 +506,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(6, 1, 0)) + cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0); +#else cfg80211_ch_switch_notify(adapter->pnetdev, &chdef); +#endif #else int freq = rtw_ch2freq(ch); @@ -1188,7 +1194,7 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter) #endif #if defined(CPTCFG_VERSION) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - roam_info.bssid = cur_network->network.MacAddress; + roam_info.links[0].bssid = cur_network->network.MacAddress; 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; @@ -1935,6 +1941,9 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param } static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) + , int link_id +#endif , u8 key_index #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) , bool pairwise @@ -2097,6 +2106,9 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev } static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) + , int link_id +#endif , u8 keyid #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) , bool pairwise @@ -2285,7 +2297,9 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev } static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) + int link_id, u8 key_index, bool pairwise, const u8 *mac_addr) +#elif (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)) */ u8 key_index, const u8 *mac_addr) @@ -2305,7 +2319,11 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, } static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) + struct net_device *ndev, int link_id, u8 key_index +#else struct net_device *ndev, u8 key_index +#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) , bool unicast, bool multicast #endif @@ -2353,7 +2371,11 @@ 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, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) + struct net_device *ndev, int link_id, u8 key_index) +#else struct net_device *ndev, u8 key_index) +#endif { #define SET_DEF_KEY_PARAM_FMT " key_index=%d" #define SET_DEF_KEY_PARAM_ARG , key_index @@ -5417,7 +5439,11 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd return ret; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +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); @@ -6366,6 +6392,9 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) static int cfg80211_rtw_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) + unsigned int link_id, +#endif struct cfg80211_chan_def *chandef) { _adapter *padapter = wiphy_to_adapter(wiphy); @@ -10785,7 +10814,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->current_bss) { +#else + if (wdev->connected) { +#endif RTW_INFO(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter)); rtw_cfg80211_indicate_disconnect(adapter, 0, 1); } diff --git a/drivers/staging/rtl8852bu/os_dep/linux/os_intfs.c b/drivers/staging/rtl8852bu/os_dep/linux/os_intfs.c index 87fe3b82611d..49822a148373 100755 --- a/drivers/staging/rtl8852bu/os_dep/linux/os_intfs.c +++ b/drivers/staging/rtl8852bu/os_dep/linux/os_intfs.c @@ -291,7 +291,7 @@ int rtw_ndev_init(struct net_device *dev) rtw_adapter_proc_init(dev); #ifdef CONFIG_RTW_NAPI - netif_napi_add(dev, &adapter->napi, rtw_recv_napi_poll, RTL_NAPI_WEIGHT); + netif_napi_add_weight(dev, &adapter->napi, rtw_recv_napi_poll, RTL_NAPI_WEIGHT); #endif /* CONFIG_RTW_NAPI */ return 0; diff --git a/drivers/staging/rtl8852bu/os_dep/linux/wifi_regd.c b/drivers/staging/rtl8852bu/os_dep/linux/wifi_regd.c index d2a1ef98a58d..8d7207291da4 100644 --- a/drivers/staging/rtl8852bu/os_dep/linux/wifi_regd.c +++ b/drivers/staging/rtl8852bu/os_dep/linux/wifi_regd.c @@ -693,7 +693,7 @@ int rtw_regd_init(struct wiphy *wiphy) wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS; #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 39)) wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF; #endif