build/patch/misc/wireless-rtl8811cu-5.19.2.patch

243 lines
9.4 KiB
Diff

From 3c2f7f560304d97eb29c4616aa39c95a60470b53 Mon Sep 17 00:00:00 2001
From: Igor Pecovnik <igor.pecovnik@gmail.com>
Date: Fri, 19 Aug 2022 08:12:57 +0200
Subject: [PATCH] Support for 5.19.x
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
---
.../rtl8811cu/os_dep/linux/ioctl_cfg80211.c | 60 ++++++++++++-------
1 file changed, 39 insertions(+), 21 deletions(-)
diff --git a/drivers/net/wireless/rtl8811cu/os_dep/linux/ioctl_cfg80211.c b/drivers/net/wireless/rtl8811cu/os_dep/linux/ioctl_cfg80211.c
index d9c81c9947fc..d13b0bd72fde 100644
--- a/drivers/net/wireless/rtl8811cu/os_dep/linux/ioctl_cfg80211.c
+++ b/drivers/net/wireless/rtl8811cu/os_dep/linux/ioctl_cfg80211.c
@@ -80,7 +80,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.
*/
@@ -321,7 +321,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;
@@ -355,7 +355,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:
@@ -417,7 +417,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);
@@ -1085,7 +1089,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;
@@ -1578,8 +1586,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);
@@ -1824,7 +1832,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)
@@ -1913,7 +1921,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
@@ -4929,7 +4937,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);
@@ -5585,7 +5597,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) {
@@ -7534,7 +7546,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
@@ -7549,11 +7561,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);
@@ -7564,7 +7576,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
@@ -7700,14 +7712,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 */
@@ -7765,7 +7777,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
@@ -8090,7 +8102,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:
@@ -8171,7 +8183,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;
@@ -8472,13 +8484,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);
@@ -8486,7 +8498,7 @@ int cfg80211_rtw_resume(struct wiphy *wiphy) {
}
RTW_DBG("<== %s\n",__func__);
return 0;
-
+
}
#endif /* CONFIG_PNO_SUPPORT */
@@ -9369,7 +9381,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;
@@ -9679,7 +9691,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