From fb54d50700c3aa4d31ffb8388c0528b26d0dad32 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Fri, 19 Aug 2022 06:54:27 +0200 Subject: [PATCH] Support for 5.19.2 Signed-off-by: Igor Pecovnik --- .../rtl8189es/os_dep/linux/ioctl_cfg80211.c | 62 ++++++++++++------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/drivers/net/wireless/rtl8189es/os_dep/linux/ioctl_cfg80211.c b/drivers/net/wireless/rtl8189es/os_dep/linux/ioctl_cfg80211.c index 6a8ec2796cd9..4e752b944f05 100644 --- a/drivers/net/wireless/rtl8189es/os_dep/linux/ioctl_cfg80211.c +++ b/drivers/net/wireless/rtl8189es/os_dep/linux/ioctl_cfg80211.c @@ -82,7 +82,7 @@ #endif /* - * In the current design of Wi-Fi driver, it will return success to the system (e.g. supplicant) + * In the current design of Wi-Fi driver, it will return success to the system (e.g. supplicant) * when Wi-Fi driver decides to abort the scan request in the scan flow by default. * Defining this flag makes Wi-Fi driver to return -EBUSY to the system if Wi-Fi driver is too busy to do the scan. */ @@ -219,7 +219,7 @@ static u8 rtw_chbw_to_cfg80211_chan_def(struct wiphy *wiphy, struct cfg80211_cha if (!chan) goto exit; - if (bw == CHANNEL_WIDTH_20) + if (bw == CHANNEL_WIDTH_20) chdef->width = ht ? NL80211_CHAN_WIDTH_20 : NL80211_CHAN_WIDTH_20_NOHT; else if (bw == CHANNEL_WIDTH_40) chdef->width = NL80211_CHAN_WIDTH_40; @@ -280,7 +280,7 @@ static void rtw_get_chbw_from_cfg80211_chan_def(struct cfg80211_chan_def *chdef, rtw_warn_on(1); *ch = 0; return; - } + } switch (chdef->width) { case NL80211_CHAN_WIDTH_20_NOHT: @@ -439,7 +439,11 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 if (ret != _SUCCESS) 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); @@ -1112,7 +1116,11 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter) #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; @@ -1614,8 +1622,8 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param _rtw_memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8); _rtw_memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8); padapter->securitypriv.binstallGrpkey = _TRUE; - if (param->u.crypt.idx < 4) - _rtw_memcpy(padapter->securitypriv.iv_seq[param->u.crypt.idx], param->u.crypt.seq, 8); + if (param->u.crypt.idx < 4) + _rtw_memcpy(padapter->securitypriv.iv_seq[param->u.crypt.idx], param->u.crypt.seq, 8); padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; rtw_set_key(padapter, &padapter->securitypriv, param->u.crypt.idx, 1, _TRUE); @@ -1863,7 +1871,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) || (MLME_IS_STA(adapter) && !pairwise) #endif - ) { + ) { /* WEP key, TX GTK/IGTK, RX GTK/IGTK(for STA mode) */ if (is_wep_enc(sec->dot118021XGrpPrivacy)) { if (keyid >= WEP_KEYS) @@ -1952,7 +1960,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev } ret = 0; - + exit: RTW_INFO(FUNC_NDEV_FMT GET_KEY_PARAM_FMT_S @@ -5138,7 +5146,11 @@ 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); @@ -5754,7 +5766,7 @@ static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *n if (del_sta) { u8 sta_addr[ETH_ALEN]; u8 updated = _FALSE; - + _rtw_memcpy(sta_addr, del_sta->cmn.mac_addr, ETH_ALEN); updated = ap_free_sta(adapter, del_sta, 0, 0, 1); rtw_mesh_expire_peer(stapriv->padapter, sta_addr); @@ -5840,7 +5852,7 @@ static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *nde else _rtw_memcpy(mac, plink->addr, ETH_ALEN); #endif - + sinfo->filled = 0; if (psta) { @@ -7979,7 +7991,7 @@ void dump_mesh_config(void *sel, const struct mesh_config *conf) RTW_PRINT_SEL(sel, "path_refresh_time:%u\n", conf->path_refresh_time); RTW_PRINT_SEL(sel, "min_discovery_timeout:%u\n", conf->min_discovery_timeout); RTW_PRINT_SEL(sel, "dot11MeshHWMPactivePathTimeout:%u\n", conf->dot11MeshHWMPactivePathTimeout); - RTW_PRINT_SEL(sel, "dot11MeshHWMPpreqMinInterval:%u\n", conf->dot11MeshHWMPpreqMinInterval); + RTW_PRINT_SEL(sel, "dot11MeshHWMPpreqMinInterval:%u\n", conf->dot11MeshHWMPpreqMinInterval); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) RTW_PRINT_SEL(sel, "dot11MeshHWMPperrMinInterval:%u\n", conf->dot11MeshHWMPperrMinInterval); #endif @@ -7994,11 +8006,11 @@ void dump_mesh_config(void *sel, const struct mesh_config *conf) RTW_PRINT_SEL(sel, "dot11MeshForwarding:%d\n", conf->dot11MeshForwarding); RTW_PRINT_SEL(sel, "rssi_threshold:%d\n", conf->rssi_threshold); #endif - + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) RTW_PRINT_SEL(sel, "ht_opmode:0x%04x\n", conf->ht_opmode); #endif - + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) RTW_PRINT_SEL(sel, "dot11MeshHWMPactivePathToRootTimeout:%u\n", conf->dot11MeshHWMPactivePathToRootTimeout); RTW_PRINT_SEL(sel, "dot11MeshHWMProotInterval:%u\n", conf->dot11MeshHWMProotInterval); @@ -8009,7 +8021,7 @@ void dump_mesh_config(void *sel, const struct mesh_config *conf) RTW_PRINT_SEL(sel, "power_mode:%s\n", nl80211_mesh_power_mode_str(conf->power_mode)); RTW_PRINT_SEL(sel, "dot11MeshAwakeWindowDuration:%u\n", conf->dot11MeshAwakeWindowDuration); #endif - + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) RTW_PRINT_SEL(sel, "plink_timeout:%u\n", conf->plink_timeout); #endif @@ -8145,14 +8157,14 @@ static void rtw_cfg80211_mesh_cfg_set(_adapter *adapter, const struct mesh_confi if (chk_mesh_attr(NL80211_MESHCONF_HT_OPMODE, mask)); #endif #endif - + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) if (chk_mesh_attr(NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, mask)) mcfg->dot11MeshHWMPactivePathToRootTimeout = conf->dot11MeshHWMPactivePathToRootTimeout; if (chk_mesh_attr(NL80211_MESHCONF_HWMP_ROOT_INTERVAL, mask)) mcfg->dot11MeshHWMProotInterval = conf->dot11MeshHWMProotInterval; if (chk_mesh_attr(NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, mask)) - mcfg->dot11MeshHWMPconfirmationInterval = conf->dot11MeshHWMPconfirmationInterval; + mcfg->dot11MeshHWMPconfirmationInterval = conf->dot11MeshHWMPconfirmationInterval; #endif #if 0 /* TBD */ @@ -8210,7 +8222,7 @@ u8 *rtw_cfg80211_construct_mesh_beacon_ies(struct wiphy *wiphy, _adapter *adapte #endif if (!ch) goto exit; - + #if defined(CONFIG_80211AC_VHT) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) vht = ht && ch > 14 && bw >= CHANNEL_WIDTH_80; /* VHT40/VHT20? */ #endif @@ -8541,7 +8553,7 @@ static int cfg80211_rtw_join_mesh(struct wiphy *wiphy, struct net_device *dev, ret = -EINVAL; goto exit; } - + rtw_mesh_work(&adapter->mesh_work); exit: @@ -8621,7 +8633,7 @@ static int cfg80211_rtw_del_mpath(struct wiphy *wiphy, struct net_device *dev } } else { rtw_mesh_path_flush_by_iface(adapter); - } + } exit: return ret; @@ -8922,13 +8934,13 @@ int cfg80211_rtw_resume(struct wiphy *wiphy) { //rtw_sitesurvey_cmd(padapter, NULL); rtw_sitesurvey_cmd(padapter, &parm); _exit_critical_bh(&pmlmepriv->lock, &irqL); - + for (PNOWakeupScanWaitCnt = 0; PNOWakeupScanWaitCnt < 10; PNOWakeupScanWaitCnt++) { if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _FALSE) break; rtw_msleep_os(1000); } - + _enter_critical_bh(&pmlmepriv->lock, &irqL); cfg80211_sched_scan_results(padapter->rtw_wdev->wiphy); _exit_critical_bh(&pmlmepriv->lock, &irqL); @@ -8936,7 +8948,7 @@ int cfg80211_rtw_resume(struct wiphy *wiphy) { } RTW_DBG("<== %s\n",__func__); return 0; - + } #endif /* CONFIG_PNO_SUPPORT */ @@ -9827,7 +9839,7 @@ int rtw_hostapd_acs_dump_survey(struct wiphy *wiphy, struct net_device *netdev, #elif defined(CONFIG_RTW_ACS) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) rtw_cfg80211_set_survey_info_with_clm(padapter, idx, info); #else - RTW_ERR("%s: unknown acs operation!\n", __func__); + RTW_ERR("%s: unknown acs operation!\n", __func__); #endif return ret; @@ -10237,7 +10249,13 @@ 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->connected) { + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) + 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); } -- Created with Armbian build tools https://github.com/armbian/build