diff --git a/patch/kernel/sunxi-next/90-02-add_rtl8189es-experimental.patch b/patch/kernel/sunxi-next/90-02-add_rtl8189es-experimental.patch index 492932f970..d7dfcc466b 100644 --- a/patch/kernel/sunxi-next/90-02-add_rtl8189es-experimental.patch +++ b/patch/kernel/sunxi-next/90-02-add_rtl8189es-experimental.patch @@ -22169,7 +22169,7 @@ index 0000000..e83c090 + diff --git a/drivers/net/wireless/rtl8189es/core/rtw_ieee80211.c b/drivers/net/wireless/rtl8189es/core/rtw_ieee80211.c new file mode 100644 -index 0000000..6834fd5 +index 0000000..2ad3de5 --- /dev/null +++ b/drivers/net/wireless/rtl8189es/core/rtw_ieee80211.c @@ -0,0 +1,2583 @@ @@ -316929,15 +316929,15 @@ index 0000000..418d793 +} +#endif //CONFIG_PLATFORM_SPRD diff --git a/drivers/net/wireless/rtl8189es/os_dep/linux/ioctl_cfg80211.c b/drivers/net/wireless/rtl8189es/os_dep/linux/ioctl_cfg80211.c -new file mode 100644 -index 0000000..ae3ea89 +new file mode 100755 +index 0000000..621d32c --- /dev/null +++ b/drivers/net/wireless/rtl8189es/os_dep/linux/ioctl_cfg80211.c -@@ -0,0 +1,6750 @@ +@@ -0,0 +1,6788 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. -+ * ++ * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. @@ -317199,7 +317199,7 @@ index 0000000..ae3ea89 + } + + //spt_band.ht_cap -+ ++ +exit: + + return spt_band; @@ -317211,7 +317211,7 @@ index 0000000..ae3ea89 + + if(!spt_band) + return; -+ ++ + if(spt_band->band == IEEE80211_BAND_2GHZ) + { + size = sizeof(struct ieee80211_supported_band) @@ -317222,11 +317222,11 @@ index 0000000..ae3ea89 + { + size = sizeof(struct ieee80211_supported_band) + + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM -+ + sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM; ++ + sizeof(struct ieee80211_rate)*RTW_A_RATES_NUM; + } + else + { -+ ++ + } + rtw_mfree((u8*)spt_band, size); +} @@ -317300,7 +317300,7 @@ index 0000000..ae3ea89 +{ + struct ieee80211_channel *notify_channel; + struct cfg80211_bss *bss = NULL; -+ //struct ieee80211_supported_band *band; ++ //struct ieee80211_supported_band *band; + u16 channel; + u32 freq; + u64 notify_timestamp; @@ -317317,7 +317317,7 @@ index 0000000..ae3ea89 + struct rtw_ieee80211_hdr *pwlanhdr; + unsigned short *fctrl; + u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -+ ++ + struct wireless_dev *wdev = padapter->rtw_wdev; + struct wiphy *wiphy = wdev->wiphy; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -317327,7 +317327,7 @@ index 0000000..ae3ea89 + DBG_871X("%s pbuf allocate failed !! \n",__FUNCTION__); + return bss; + } -+ ++ + //DBG_8192C("%s\n", __func__); + + bssinf_len = pnetwork->network.IELength+sizeof (struct rtw_ieee80211_hdr_3addr); @@ -317339,16 +317339,16 @@ index 0000000..ae3ea89 +#ifndef CONFIG_WAPI_SUPPORT + { + u16 wapi_len = 0; -+ ++ + if(rtw_get_wapi_ie(pnetwork->network.IEs, pnetwork->network.IELength, NULL, &wapi_len)>0) + { + if(wapi_len > 0) + { + DBG_871X("%s, no support wapi!\n",__FUNCTION__); + goto exit; -+ } -+ } -+ } ++ } ++ } ++ } +#endif //!CONFIG_WAPI_SUPPORT + + //To reduce PBC Overlap rate @@ -317360,15 +317360,15 @@ index 0000000..ae3ea89 + struct cfg80211_scan_request *request = adapter_wdev_data(padapter)->scan_request; + struct cfg80211_ssid *ssids = request->ssids; + u32 wpsielen=0; -+ u8 *wpsie=NULL; -+ ++ u8 *wpsie=NULL; ++ + wpsie = rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen); -+ ++ + if(wpsie && wpsielen>0) + psr = rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL); -+ ++ + if (sr != 0) -+ { ++ { + if(request->n_ssids == 1 && request->n_channels == 1) // it means under processing WPS + { + DBG_8192C("ssid=%s, len=%d\n", pssid->Ssid, pssid->SsidLength); @@ -317384,8 +317384,8 @@ index 0000000..ae3ea89 + { + if(psr !=NULL) + *psr = 0; //clear sr -+ -+#if 0 ++ ++#if 0 + WLAN_BSSID_EX *pselect_network = &pnetwork->network; + struct cfg80211_bss *pselect_bss = NULL; + struct ieee80211_channel *notify_channel = NULL; @@ -317397,7 +317397,7 @@ index 0000000..ae3ea89 + notify_channel = ieee80211_get_channel(wiphy, freq); + pselect_bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/, + pselect_network->MacAddress, pselect_network->Ssid.Ssid, -+ pselect_network->Ssid.SsidLength, 0/*WLAN_CAPABILITY_ESS*/, ++ pselect_network->Ssid.SsidLength, 0/*WLAN_CAPABILITY_ESS*/, + 0/*WLAN_CAPABILITY_ESS*/); + + if(pselect_bss) @@ -317410,17 +317410,17 @@ index 0000000..ae3ea89 +#else + cfg80211_put_bss(pselect_bss); +#endif -+ ++ + } -+ ++ + goto exit; -+#endif -+ } -+ } -+ } ++#endif ++ } ++ } ++ } + } + //_exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL); -+ ++ + + channel = pnetwork->network.Configuration.DSConfig; + freq = rtw_ch2freq(channel); @@ -317432,7 +317432,7 @@ index 0000000..ae3ea89 + notify_timestamp = rtw_get_systime_us(); + + notify_interval = le16_to_cpu(*(u16*)rtw_get_beacon_interval_from_ie(pnetwork->network.IEs)); -+ notify_capability = le16_to_cpu(*(u16*)rtw_get_capability_from_ie(pnetwork->network.IEs)); ++ notify_capability = le16_to_cpu(*(u16*)rtw_get_capability_from_ie(pnetwork->network.IEs)); + + notify_ie = pnetwork->network.IEs+_FIXED_IE_LENGTH_; + notify_ielen = pnetwork->network.IELength-_FIXED_IE_LENGTH_; @@ -317444,7 +317444,7 @@ index 0000000..ae3ea89 + } else { + notify_signal = 100*translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);//dbm + } -+ ++ + #if 0 + DBG_8192C("bssid: "MAC_FMT"\n", MAC_ARG(pnetwork->network.MacAddress)); + DBG_8192C("Channel: %d(%d)\n", channel, freq); @@ -317455,16 +317455,16 @@ index 0000000..ae3ea89 + #endif + + //pbuf = buf; -+ -+ pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf; ++ ++ pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf; + fctrl = &(pwlanhdr->frame_ctl); -+ *(fctrl) = 0; ++ *(fctrl) = 0; + + SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); + //pmlmeext->mgnt_seq++; + + if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON -+ _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); ++ _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); + SetFrameSubType(pbuf, WIFI_BEACON); + } else { + _rtw_memcpy(pwlanhdr->addr1, adapter_mac_addr(padapter), ETH_ALEN); @@ -317479,8 +317479,8 @@ index 0000000..ae3ea89 + len = sizeof (struct rtw_ieee80211_hdr_3addr); + _rtw_memcpy((pbuf+len), pnetwork->network.IEs, pnetwork->network.IELength); + *((u64*)(pbuf+len)) = cpu_to_le64(notify_timestamp); -+ -+ len += pnetwork->network.IELength; ++ ++ len += pnetwork->network.IELength; + + //#ifdef CONFIG_P2P + //if(rtw_get_p2p_ie(pnetwork->network.IEs+12, pnetwork->network.IELength-12, NULL, NULL)) @@ -317489,11 +317489,11 @@ index 0000000..ae3ea89 + //} + //#endif + -+#if 1 ++#if 1 + bss = cfg80211_inform_bss_frame(wiphy, notify_channel, (struct ieee80211_mgmt *)pbuf, + len, notify_signal, GFP_ATOMIC); -+#else -+ ++#else ++ + bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)pnetwork->network.MacAddress, + notify_timestamp, notify_capability, notify_interval, notify_ie, + notify_ielen, notify_signal, GFP_ATOMIC/*GFP_KERNEL*/); @@ -317508,29 +317508,29 @@ index 0000000..ae3ea89 +#ifndef COMPAT_KERNEL_RELEASE + //patch for cfg80211, update beacon ies to information_elements + if (pnetwork->network.Reserved[0] == 1) { // WIFI_BEACON -+ ++ + if(bss->len_information_elements != bss->len_beacon_ies) + { -+ bss->information_elements = bss->beacon_ies; ++ bss->information_elements = bss->beacon_ies; + bss->len_information_elements = bss->len_beacon_ies; -+ } ++ } + } +#endif //COMPAT_KERNEL_RELEASE +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) + -+/* ++/* + { -+ if( bss->information_elements == bss->proberesp_ies) ++ if( bss->information_elements == bss->proberesp_ies) + { + if( bss->len_information_elements != bss->len_proberesp_ies) + { + DBG_8192C("error!, len_information_elements != bss->len_proberesp_ies\n"); + } -+ ++ + } + else if(bss->len_information_elements < bss->len_beacon_ies) + { -+ bss->information_elements = bss->beacon_ies; ++ bss->information_elements = bss->beacon_ies; + bss->len_information_elements = bss->len_beacon_ies; + } + } @@ -317540,18 +317540,18 @@ index 0000000..ae3ea89 +#else + cfg80211_put_bss(bss); +#endif -+ ++ +exit: + if(pbuf) -+ rtw_mfree(pbuf, buf_size); ++ rtw_mfree(pbuf, buf_size); + return bss; -+ ++ +} + +/* + Check the given bss is valid by kernel API cfg80211_get_bss() + @padapter : the given adapter -+ ++ + return _TRUE if bss is valid, _FALSE for not found. +*/ +int rtw_cfg80211_check_bss(_adapter *padapter) @@ -317594,14 +317594,14 @@ index 0000000..ae3ea89 + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) + freq = rtw_ch2freq(cur_network->network.Configuration.DSConfig); + + if (0) + DBG_871X("chan: %d, freq: %d\n", cur_network->network.Configuration.DSConfig, freq); +#endif + -+ if (pwdev->iftype != NL80211_IFTYPE_ADHOC) ++ if (pwdev->iftype != NL80211_IFTYPE_ADHOC) + { + return; + } @@ -317612,7 +317612,7 @@ index 0000000..ae3ea89 + + if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==_TRUE) + { -+ ++ + _rtw_memcpy(&cur_network->network, pnetwork, sizeof(WLAN_BSSID_EX)); + if(cur_network) + { @@ -317630,7 +317630,7 @@ index 0000000..ae3ea89 + else + { + if(scanned == NULL) -+ rtw_warn_on(1); ++ return; + + if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE + && _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE @@ -317732,11 +317732,30 @@ index 0000000..ae3ea89 + u32 freq; + u16 channel = cur_network->network.Configuration.DSConfig; + ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) ++ struct cfg80211_roam_info roam_info ={}; ++ #endif ++ + freq = rtw_ch2freq(channel); + notify_channel = ieee80211_get_channel(wiphy, freq); + #endif + + DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); ++ ++ #if LINUX_VERSION_CODE>=KERNEL_VERSION(4,12,0) ++ roam_info.channel = notify_channel; ++ roam_info.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; ++ roam_info.resp_ie_len = ++ pmlmepriv->assoc_rsp_len+sizeof(struct rtw_ieee80211_hdr_3addr) - 6; ++ cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC); ++ #else ++ + cfg80211_roamed(padapter->pnetdev + #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) + , notify_channel @@ -317747,10 +317766,11 @@ index 0000000..ae3ea89 + , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 + , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 + , GFP_ATOMIC); ++ #endif + } + else + { -+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) ++ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) + DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state); + #endif + cfg80211_connect_result(padapter->pnetdev, cur_network->network.MacAddress @@ -317759,7 +317779,7 @@ index 0000000..ae3ea89 + , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 + , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 + , WLAN_STATUS_SUCCESS, GFP_ATOMIC); -+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) ++ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) + DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state); + #endif + } @@ -317775,7 +317795,7 @@ index 0000000..ae3ea89 + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + -+ if (pwdev->iftype != NL80211_IFTYPE_STATION ++ if (pwdev->iftype != NL80211_IFTYPE_STATION + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + && pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT + #endif @@ -317786,7 +317806,7 @@ index 0000000..ae3ea89 + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) + return; + -+#ifdef CONFIG_P2P ++#ifdef CONFIG_P2P + if( pwdinfo->driver_interface == DRIVER_CFG80211 ) + { + if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -317800,11 +317820,11 @@ index 0000000..ae3ea89 +#endif //CONFIG_P2P + + if (!padapter->mlmepriv.not_indic_disco || padapter->ndev_unregistering) { -+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) ++ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) + DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state); + + if(pwdev->sme_state==CFG80211_SME_CONNECTING) -+ cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0, ++ cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0, + WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC/*GFP_KERNEL*/); + else if(pwdev->sme_state==CFG80211_SME_CONNECTED) + cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, 0, GFP_ATOMIC); @@ -317814,22 +317834,22 @@ index 0000000..ae3ea89 + DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state); + #else + -+ if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) ++ if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) + cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, 0, GFP_ATOMIC); + else -+ cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0, ++ cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0, + WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC/*GFP_KERNEL*/); + #endif + } +} -+ ++ + +#ifdef CONFIG_AP_MODE +static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) +{ + int ret = 0; + u32 wep_key_idx, wep_key_len,wep_total_len; -+ struct sta_info *psta = NULL, *pbcmc_sta = NULL; ++ struct sta_info *psta = NULL, *pbcmc_sta = NULL; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv* psecuritypriv=&(padapter->securitypriv); @@ -317850,7 +317870,7 @@ index 0000000..ae3ea89 + + if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && + param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && -+ param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) ++ param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + { + if (param->u.crypt.idx >= WEP_KEYS +#ifdef CONFIG_IEEE80211W @@ -317860,17 +317880,17 @@ index 0000000..ae3ea89 + { + ret = -EINVAL; + goto exit; -+ } ++ } + } -+ else -+ { ++ else ++ { + psta = rtw_get_stainfo(pstapriv, param->sta_addr); + if(!psta) + { + //ret = -EINVAL; + DBG_8192C("rtw_set_encryption(), sta has already been removed or never been added\n"); + goto exit; -+ } ++ } + } + + if (strcmp(param->u.crypt.alg, "none") == 0 && (psta==NULL)) @@ -317878,18 +317898,18 @@ index 0000000..ae3ea89 + //todo:clear default encryption keys + + DBG_8192C("clear default encryption keys, keyid=%d\n", param->u.crypt.idx); -+ ++ + goto exit; + } + + + if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta==NULL)) -+ { ++ { + DBG_8192C("r871x_set_encryption, crypt.alg = WEP\n"); -+ ++ + wep_key_idx = param->u.crypt.idx; + wep_key_len = param->u.crypt.key_len; -+ ++ + DBG_8192C("r871x_set_encryption, wep_key_idx=%d, len=%d\n", wep_key_idx, wep_key_len); + + if((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0)) @@ -317897,12 +317917,12 @@ index 0000000..ae3ea89 + ret = -EINVAL; + goto exit; + } -+ -+ if (wep_key_len > 0) -+ { ++ ++ if (wep_key_len > 0) ++ { + wep_key_len = wep_key_len <= 5 ? 5 : 13; + } -+ ++ + if (psecuritypriv->bWepDefaultKeyIdxSet == 0) + { + //wep default key has not been set, so use this key index as default key. @@ -317911,7 +317931,7 @@ index 0000000..ae3ea89 + psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; + psecuritypriv->dot11PrivacyAlgrthm=_WEP40_; + psecuritypriv->dot118021XGrpPrivacy=_WEP40_; -+ ++ + if(wep_key_len == 13) + { + psecuritypriv->dot11PrivacyAlgrthm=_WEP104_; @@ -317920,18 +317940,18 @@ index 0000000..ae3ea89 + + psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; + } -+ ++ + _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len); -+ ++ + psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len; + + rtw_ap_set_wep_key(padapter, param->u.crypt.key, wep_key_len, wep_key_idx, 1); + + goto exit; -+ ++ + } + -+ ++ + if(!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) // //group key + { + if(param->u.crypt.set_tx == 0) //group key @@ -317939,36 +317959,36 @@ index 0000000..ae3ea89 + if(strcmp(param->u.crypt.alg, "WEP") == 0) + { + DBG_8192C("%s, set group_key, WEP\n", __FUNCTION__); -+ ++ + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); -+ ++ + psecuritypriv->dot118021XGrpPrivacy = _WEP40_; + if(param->u.crypt.key_len==13) -+ { ++ { + psecuritypriv->dot118021XGrpPrivacy = _WEP104_; + } -+ ++ + } + else if(strcmp(param->u.crypt.alg, "TKIP") == 0) -+ { ++ { + DBG_8192C("%s, set group_key, TKIP\n", __FUNCTION__); -+ ++ + psecuritypriv->dot118021XGrpPrivacy = _TKIP_; + + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); -+ ++ + //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); + //set mic key + _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8); + _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8); + + psecuritypriv->busetkipkey = _TRUE; -+ ++ + } + else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + { + DBG_8192C("%s, set group_key, CCMP\n", __FUNCTION__); -+ ++ + psecuritypriv->dot118021XGrpPrivacy = _AES_; + + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); @@ -317976,7 +317996,7 @@ index 0000000..ae3ea89 +#ifdef CONFIG_IEEE80211W + else if (strcmp(param->u.crypt.alg, "BIP") == 0) { + int no; -+ ++ + DBG_871X("BIP key_len=%d , index=%d\n", param->u.crypt.key_len, param->u.crypt.idx); + /* save the IGTK key, length 16 bytes */ + _rtw_memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16:param->u.crypt.key_len)); @@ -317993,7 +318013,7 @@ index 0000000..ae3ea89 + else + { + DBG_8192C("%s, set group_key, none\n", __FUNCTION__); -+ ++ + psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; + } + @@ -318002,100 +318022,100 @@ index 0000000..ae3ea89 + psecuritypriv->binstallGrpkey = _TRUE; + + psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!! -+ ++ + rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); -+ ++ + pbcmc_sta=rtw_get_bcmc_stainfo(padapter); + if(pbcmc_sta) + { + pbcmc_sta->ieee8021x_blocked = _FALSE; -+ pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy -+ } -+ ++ pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy ++ } ++ + } + + goto exit; -+ -+ } ++ ++ } + + if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) // psk/802_1x + { + if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) + { + if(param->u.crypt.set_tx ==1) //pairwise key -+ { ++ { + _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); -+ ++ + if(strcmp(param->u.crypt.alg, "WEP") == 0) + { + DBG_8192C("%s, set pairwise key, WEP\n", __FUNCTION__); -+ ++ + psta->dot118021XPrivacy = _WEP40_; + if(param->u.crypt.key_len==13) -+ { ++ { + psta->dot118021XPrivacy = _WEP104_; + } + } + else if(strcmp(param->u.crypt.alg, "TKIP") == 0) -+ { ++ { + DBG_8192C("%s, set pairwise key, TKIP\n", __FUNCTION__); -+ ++ + psta->dot118021XPrivacy = _TKIP_; -+ ++ + //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); + //set mic key + _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); + _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); + + psecuritypriv->busetkipkey = _TRUE; -+ ++ + } + else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + { + + DBG_8192C("%s, set pairwise key, CCMP\n", __FUNCTION__); -+ ++ + psta->dot118021XPrivacy = _AES_; + } + else + { + DBG_8192C("%s, set pairwise key, none\n", __FUNCTION__); -+ ++ + psta->dot118021XPrivacy = _NO_PRIVACY_; + } -+ ++ + rtw_ap_set_pairwise_key(padapter, psta); -+ ++ + psta->ieee8021x_blocked = _FALSE; -+ ++ + psta->bpairwise_key_installed = _TRUE; -+ -+ } ++ ++ } + else//group key??? -+ { ++ { + if(strcmp(param->u.crypt.alg, "WEP") == 0) + { + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); -+ ++ + psecuritypriv->dot118021XGrpPrivacy = _WEP40_; + if(param->u.crypt.key_len==13) -+ { ++ { + psecuritypriv->dot118021XGrpPrivacy = _WEP104_; + } + } + else if(strcmp(param->u.crypt.alg, "TKIP") == 0) -+ { ++ { + psecuritypriv->dot118021XGrpPrivacy = _TKIP_; + + _rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); -+ ++ + //DEBUG_ERR("set key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len); + //set mic key + _rtw_memcpy(psecuritypriv->dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8); + _rtw_memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8); + + psecuritypriv->busetkipkey = _TRUE; -+ ++ + } + else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + { @@ -318110,29 +318130,29 @@ index 0000000..ae3ea89 + + psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; + -+ psecuritypriv->binstallGrpkey = _TRUE; -+ ++ psecuritypriv->binstallGrpkey = _TRUE; ++ + psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;//!!! -+ ++ + rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); -+ ++ + pbcmc_sta=rtw_get_bcmc_stainfo(padapter); + if(pbcmc_sta) + { + pbcmc_sta->ieee8021x_blocked = _FALSE; -+ pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy -+ } ++ pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;//rx will use bmc_sta's dot118021XPrivacy ++ } + + } -+ ++ + } -+ ++ + } + +exit: + + return ret; -+ ++ +} +#endif + @@ -318141,7 +318161,7 @@ index 0000000..ae3ea89 + int ret = 0; + u32 wep_key_idx, wep_key_len,wep_total_len; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); -+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv; ++ struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; +#ifdef CONFIG_P2P + struct wifidirect_info* pwdinfo = &padapter->wdinfo; @@ -318156,17 +318176,17 @@ index 0000000..ae3ea89 + + if (param_len < (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) + { -+ ret = -EINVAL; ++ ret = -EINVAL; + goto exit; + } + + if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && + param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && -+ param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) ++ param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) + { + if (param->u.crypt.idx >= WEP_KEYS +#ifdef CONFIG_IEEE80211W -+ && param->u.crypt.idx > BIP_MAX_KEYID ++ || param->u.crypt.idx >= BIP_MAX_KEYID +#endif //CONFIG_IEEE80211W + ) + { @@ -318191,7 +318211,7 @@ index 0000000..ae3ea89 + wep_key_idx = param->u.crypt.idx; + wep_key_len = param->u.crypt.key_len; + -+ if ((wep_key_idx > WEP_KEYS) || (wep_key_len <= 0)) ++ if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) + { + ret = -EINVAL; + goto exit; @@ -318215,14 +318235,14 @@ index 0000000..ae3ea89 + + psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; + } -+ ++ + _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len); -+ ++ + psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len; -+ ++ + rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0, _TRUE); + -+ goto exit; ++ goto exit; + } + + if(padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) // 802_1x @@ -318234,7 +318254,7 @@ index 0000000..ae3ea89 + + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == _TRUE) //sta mode + { -+ psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); ++ psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); + if (psta == NULL) { + //DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n")); + DBG_8192C("%s, : Obtain Sta_info fail \n", __func__); @@ -318242,36 +318262,36 @@ index 0000000..ae3ea89 + else + { + //Jeff: don't disable ieee8021x_blocked while clearing key -+ if (strcmp(param->u.crypt.alg, "none") != 0) ++ if (strcmp(param->u.crypt.alg, "none") != 0) + psta->ieee8021x_blocked = _FALSE; + -+ ++ + if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| + (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) + { + psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; -+ } ++ } + + if(param->u.crypt.set_tx ==1)//pairwise key -+ { ++ { + + DBG_8192C("%s, : param->u.crypt.set_tx ==1 \n", __func__); -+ ++ + _rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); -+ ++ + if(strcmp(param->u.crypt.alg, "TKIP") == 0)//set mic key -+ { ++ { + //DEBUG_ERR(("\nset key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); + _rtw_memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); + _rtw_memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); + + padapter->securitypriv.busetkipkey=_FALSE; -+ //_set_timer(&padapter->securitypriv.tkip_timer, 50); ++ //_set_timer(&padapter->securitypriv.tkip_timer, 50); + } + psta->bpairwise_key_installed = _TRUE; + //DEBUG_ERR((" param->u.crypt.key_len=%d\n",param->u.crypt.key_len)); + DBG_871X(" ~~~~set sta key:unicastkey\n"); -+ ++ + rtw_setstakey_cmd(padapter, psta, UNICAST_KEY, _TRUE); + } + else//group key @@ -318281,10 +318301,10 @@ index 0000000..ae3ea89 + _rtw_memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); + _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; ++ padapter->securitypriv.binstallGrpkey = _TRUE; + //DEBUG_ERR((" param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); + DBG_871X(" ~~~~set sta key:groupkey\n"); -+ ++ + padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; + rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1, _TRUE); + } @@ -318304,7 +318324,7 @@ index 0000000..ae3ea89 + DBG_871X(" ~~~~set sta key:IGKT\n"); + } +#endif //CONFIG_IEEE80211W -+ ++ +#ifdef CONFIG_P2P + if(pwdinfo->driver_interface == DRIVER_CFG80211 ) + { @@ -318314,8 +318334,8 @@ index 0000000..ae3ea89 + } + } +#endif //CONFIG_P2P -+ -+ } ++ ++ } + } + + pbcmc_sta=rtw_get_bcmc_stainfo(padapter); @@ -318326,19 +318346,19 @@ index 0000000..ae3ea89 + else + { + //Jeff: don't disable ieee8021x_blocked while clearing key -+ if (strcmp(param->u.crypt.alg, "none") != 0) ++ if (strcmp(param->u.crypt.alg, "none") != 0) + pbcmc_sta->ieee8021x_blocked = _FALSE; -+ ++ + if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| + (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) -+ { ++ { + pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; -+ } -+ } ++ } ++ } + } + else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) //adhoc mode -+ { -+ } ++ { ++ } + } + +#ifdef CONFIG_WAPI_SUPPORT @@ -318411,10 +318431,10 @@ index 0000000..ae3ea89 +exit: + + DBG_8192C("%s, ret=%d\n", __func__, ret); -+ ++ + _func_exit_; -+ -+ return ret; ++ ++ return ret; +} + +static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, @@ -318427,7 +318447,7 @@ index 0000000..ae3ea89 +{ + char *alg_name; + u32 param_len; -+ struct ieee_param *param = NULL; ++ struct ieee_param *param = NULL; + int ret=0; + _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); + struct wireless_dev *rtw_wdev = padapter->rtw_wdev; @@ -318435,7 +318455,7 @@ index 0000000..ae3ea89 +#ifdef CONFIG_TDLS + struct sta_info *ptdls_sta; +#endif /* CONFIG_TDLS */ -+ ++ + DBG_871X(FUNC_NDEV_FMT" adding key for %pM\n", FUNC_NDEV_ARG(ndev), mac_addr); + DBG_871X("cipher=0x%x\n", params->cipher); + DBG_871X("key_len=0x%x\n", params->key_len); @@ -318449,7 +318469,7 @@ index 0000000..ae3ea89 + param = (struct ieee_param *)rtw_malloc(param_len); + if (param == NULL) + return -1; -+ ++ + _rtw_memset(param, 0, param_len); + + param->cmd = IEEE_CMD_SET_ENCRYPTION; @@ -318457,8 +318477,8 @@ index 0000000..ae3ea89 + + switch (params->cipher) { + case IW_AUTH_CIPHER_NONE: -+ //todo: remove key -+ //remove = 1; ++ //todo: remove key ++ //remove = 1; + alg_name = "none"; + break; + case WLAN_CIPHER_SUITE_WEP40: @@ -318492,13 +318512,13 @@ index 0000000..ae3ea89 + break; +#endif + -+ default: ++ default: + ret = -ENOTSUPP; + goto addkey_end; + } -+ ++ + strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN); -+ ++ + + if (!mac_addr || is_broadcast_ether_addr(mac_addr)) + { @@ -318506,21 +318526,21 @@ index 0000000..ae3ea89 + } else { + param->u.crypt.set_tx = 1; //for wpa/wpa2 pairwise key + } -+ -+ ++ ++ + //param->u.crypt.idx = key_index - 1; + param->u.crypt.idx = key_index; -+ -+ if (params->seq_len && params->seq) -+ { ++ ++ if (params->seq_len && params->seq) ++ { + _rtw_memcpy(param->u.crypt.seq, (u8 *)params->seq, params->seq_len); + } + + if(params->key_len && params->key) + { -+ param->u.crypt.key_len = params->key_len; ++ param->u.crypt.key_len = params->key_len; + _rtw_memcpy(param->u.crypt.key, (u8 *)params->key, params->key_len); -+ } ++ } + + if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) + { @@ -318535,14 +318555,14 @@ index 0000000..ae3ea89 + } +#endif /* CONFIG_TDLS */ + -+ ret = rtw_cfg80211_set_encryption(ndev, param, param_len); ++ ret = rtw_cfg80211_set_encryption(ndev, param, param_len); + } + else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) + { +#ifdef CONFIG_AP_MODE + if(mac_addr) + _rtw_memcpy(param->sta_addr, (void*)mac_addr, ETH_ALEN); -+ ++ + ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len); +#endif + } @@ -318555,7 +318575,7 @@ index 0000000..ae3ea89 + else + { + DBG_8192C("error! fw_state=0x%x, iftype=%d\n", pmlmepriv->fw_state, rtw_wdev->iftype); -+ ++ + } + +addkey_end: @@ -318608,7 +318628,7 @@ index 0000000..ae3ea89 + u8 key_index, const u8 *mac_addr) +#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) +{ -+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); ++ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); + struct security_priv *psecuritypriv = &padapter->securitypriv; + + DBG_871X(FUNC_NDEV_FMT" key_index=%d\n", FUNC_NDEV_ARG(ndev), key_index); @@ -318629,7 +318649,7 @@ index 0000000..ae3ea89 + #endif + ) +{ -+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); ++ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); + struct security_priv *psecuritypriv = &padapter->securitypriv; + +#define SET_DEF_KEY_PARAM_FMT " key_index=%d" @@ -318708,7 +318728,7 @@ index 0000000..ae3ea89 +static int cfg80211_rtw_get_station(struct wiphy *wiphy, + struct net_device *ndev, +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) -+ u8 *mac, ++ u8 *mac, +#else + const u8 *mac, +#endif @@ -318797,14 +318817,17 @@ index 0000000..ae3ea89 + NL80211_IFTYPE_MESH_POINT, + NL80211_IFTYPE_P2P_CLIENT, //8 + NL80211_IFTYPE_P2P_GO, //9 -+ //keep last ++ //keep last + NUM_NL80211_IFTYPES, + NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 +}; +*/ +static int cfg80211_rtw_change_iface(struct wiphy *wiphy, + struct net_device *ndev, -+ enum nl80211_iftype type, u32 *flags, ++ enum nl80211_iftype type, ++ #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) ++ u32 *flags, ++ #endif + struct vif_params *params) +{ + enum nl80211_iftype old_type; @@ -318824,8 +318847,8 @@ index 0000000..ae3ea89 + { + ret= -EPERM; + goto exit; -+ } -+ ++ } ++ +#ifdef CONFIG_CONCURRENT_MODE + if(padapter->adapter_type == SECONDARY_ADAPTER) + { @@ -318862,7 +318885,7 @@ index 0000000..ae3ea89 + change = _TRUE; + pmlmeext->action_public_rxseq = 0xffff; + pmlmeext->action_public_dialog_token = 0xff; -+ } ++ } + + /* initial default type */ + ndev->type = ARPHRD_ETHER; @@ -318919,7 +318942,7 @@ index 0000000..ae3ea89 + } + + rtw_wdev->iftype = type; -+ ++ + if (rtw_set_802_11_infrastructure_mode(padapter, networkType) ==_FALSE) + { + rtw_wdev->iftype = old_type; @@ -318928,7 +318951,7 @@ index 0000000..ae3ea89 + } + + rtw_setopmode_cmd(padapter, networkType, _TRUE); -+ ++ +exit: + + DBG_871X(FUNC_NDEV_FMT" ret:%d\n", FUNC_NDEV_ARG(ndev), ret); @@ -318979,12 +319002,12 @@ index 0000000..ae3ea89 + struct wiphy *wiphy = pwdev->wiphy; + struct cfg80211_bss *bss = NULL; + WLAN_BSSID_EX select_network = pnetwork->network; -+ ++ + bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/, + select_network.MacAddress, select_network.Ssid.Ssid, -+ select_network.Ssid.SsidLength, 0/*WLAN_CAPABILITY_ESS*/, ++ select_network.Ssid.SsidLength, 0/*WLAN_CAPABILITY_ESS*/, + 0/*WLAN_CAPABILITY_ESS*/); -+ ++ + if (bss) { + cfg80211_unlink_bss(wiphy, bss); + DBG_8192C("%s(): cfg80211_unlink %s!! () ",__func__,select_network.Ssid.Ssid ); @@ -319000,9 +319023,9 @@ index 0000000..ae3ea89 +void rtw_cfg80211_surveydone_event_callback(_adapter *padapter) +{ + _irqL irqL; -+ _list *plist, *phead; -+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); -+ _queue *queue = &(pmlmepriv->scanned_queue); ++ _list *plist, *phead; ++ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); ++ _queue *queue = &(pmlmepriv->scanned_queue); + struct wlan_network *pnetwork = NULL; + u32 cnt=0; + u32 wait_for_surveydone; @@ -319020,7 +319043,7 @@ index 0000000..ae3ea89 + + phead = get_list_head(queue); + plist = get_next(phead); -+ ++ + while(1) + { + if (rtw_end_of_queue_search(phead,plist)== _TRUE) @@ -319033,9 +319056,9 @@ index 0000000..ae3ea89 + && rtw_mlme_band_check(padapter, pnetwork->network.Configuration.DSConfig) == _TRUE + && _TRUE == rtw_validate_ssid(&(pnetwork->network.Ssid)) + ) -+ { ++ { + //ev=translate_scan(padapter, a, pnetwork, ev, stop); -+ rtw_cfg80211_inform_bss(padapter, pnetwork); ++ rtw_cfg80211_inform_bss(padapter, pnetwork); + } + /* //check ralink testbed RSN IE length + { @@ -319048,9 +319071,9 @@ index 0000000..ae3ea89 + } + }*/ + plist = get_next(plist); -+ ++ + } -+ ++ + _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); +} + @@ -319059,16 +319082,16 @@ index 0000000..ae3ea89 + int ret = 0; + uint wps_ielen = 0; + u8 *wps_ie; -+ u32 p2p_ielen = 0; ++ u32 p2p_ielen = 0; + u8 *p2p_ie; -+ u32 wfd_ielen = 0; ++ u32 wfd_ielen = 0; + u8 *wfd_ie; -+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); ++ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + +#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, ielen=%d\n", __func__, len); +#endif -+ ++ + if(len>0) + { + if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) @@ -319076,20 +319099,20 @@ index 0000000..ae3ea89 + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_req_wps_ielen=%d\n", wps_ielen); + #endif -+ ++ + if(pmlmepriv->wps_probe_req_ie) + { + u32 free_len = pmlmepriv->wps_probe_req_ie_len; + pmlmepriv->wps_probe_req_ie_len = 0; + rtw_mfree(pmlmepriv->wps_probe_req_ie, free_len); -+ pmlmepriv->wps_probe_req_ie = NULL; -+ } ++ pmlmepriv->wps_probe_req_ie = NULL; ++ } + + pmlmepriv->wps_probe_req_ie = rtw_malloc(wps_ielen); + if ( pmlmepriv->wps_probe_req_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } + _rtw_memcpy(pmlmepriv->wps_probe_req_ie, wps_ie, wps_ielen); + pmlmepriv->wps_probe_req_ie_len = wps_ielen; @@ -319099,7 +319122,7 @@ index 0000000..ae3ea89 + //len -= wps_ielen; + + #ifdef CONFIG_P2P -+ if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) ++ if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) + { + struct wifidirect_info *wdinfo = &padapter->wdinfo; + u32 attr_contentlen = 0; @@ -319108,20 +319131,20 @@ index 0000000..ae3ea89 + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_req_p2p_ielen=%d\n", p2p_ielen); + #endif -+ ++ + if(pmlmepriv->p2p_probe_req_ie) + { + u32 free_len = pmlmepriv->p2p_probe_req_ie_len; + pmlmepriv->p2p_probe_req_ie_len = 0; + rtw_mfree(pmlmepriv->p2p_probe_req_ie, free_len); + pmlmepriv->p2p_probe_req_ie = NULL; -+ } ++ } + + pmlmepriv->p2p_probe_req_ie = rtw_malloc(p2p_ielen); + if ( pmlmepriv->p2p_probe_req_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } + _rtw_memcpy(pmlmepriv->p2p_probe_req_ie, p2p_ie, p2p_ielen); + pmlmepriv->p2p_probe_req_ie_len = p2p_ielen; @@ -319138,39 +319161,39 @@ index 0000000..ae3ea89 + } + } + #endif //CONFIG_P2P -+ ++ + //buf += p2p_ielen; + //len -= p2p_ielen; + + #ifdef CONFIG_WFD -+ if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) ++ if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_req_wfd_ielen=%d\n", wfd_ielen); + #endif -+ ++ + if(pmlmepriv->wfd_probe_req_ie) + { + u32 free_len = pmlmepriv->wfd_probe_req_ie_len; + pmlmepriv->wfd_probe_req_ie_len = 0; + rtw_mfree(pmlmepriv->wfd_probe_req_ie, free_len); + pmlmepriv->wfd_probe_req_ie = NULL; -+ } ++ } + + pmlmepriv->wfd_probe_req_ie = rtw_malloc(wfd_ielen); + if ( pmlmepriv->wfd_probe_req_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } -+ rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len); ++ rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len); + } + #endif //CONFIG_WFD -+ ++ + } + + return ret; -+ ++ +} + +static int cfg80211_rtw_scan(struct wiphy *wiphy @@ -319184,12 +319207,12 @@ index 0000000..ae3ea89 +#endif + int i; + u8 _status = _FALSE; -+ int ret = 0; ++ int ret = 0; + NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT]; + struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT]; + _irqL irqL; + u8 *wps_ie=NULL; -+ uint wps_ielen=0; ++ uint wps_ielen=0; + u8 *p2p_ie=NULL; + uint p2p_ielen=0; + u8 survey_times=3; @@ -319205,7 +319228,7 @@ index 0000000..ae3ea89 +#ifdef CONFIG_P2P + struct wifidirect_info *pwdinfo; +#endif //CONFIG_P2P -+#ifdef CONFIG_CONCURRENT_MODE ++#ifdef CONFIG_CONCURRENT_MODE + PADAPTER pbuddy_adapter = NULL; + struct mlme_priv *pbuddy_mlmepriv = NULL; +#endif //CONFIG_CONCURRENT_MODE @@ -319219,7 +319242,7 @@ index 0000000..ae3ea89 + pwdev_priv = adapter_wdev_data(padapter); + pmlmepriv= &padapter->mlmepriv; +#ifdef CONFIG_P2P -+ pwdinfo= &(padapter->wdinfo); ++ pwdinfo= &(padapter->wdinfo); +#endif //CONFIG_P2P + +//#ifdef CONFIG_DEBUG_CFG80211 @@ -319229,14 +319252,14 @@ index 0000000..ae3ea89 +#ifdef CONFIG_CONCURRENT_MODE + if (padapter->pbuddy_adapter) { + pbuddy_adapter = padapter->pbuddy_adapter; -+ pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); ++ pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv); + } +#endif //CONFIG_CONCURRENT_MODE + +#ifdef CONFIG_MP_INCLUDED +if (padapter->registrypriv.mp_mode == 1) +{ -+ DBG_871X(FUNC_ADPT_FMT ": MP mode block Scan request\n", FUNC_ADPT_ARG(padapter)); ++ DBG_871X(FUNC_ADPT_FMT ": MP mode block Scan request\n", FUNC_ADPT_ARG(padapter)); + ret = -EPERM; + goto exit; +} @@ -319276,10 +319299,10 @@ index 0000000..ae3ea89 + { + DBG_8192C("AP mode process WPS \n"); + } -+ ++ + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; -+ } ++ } + } + + rtw_ps_deny(padapter, PS_DENY_SCAN); @@ -319310,7 +319333,7 @@ index 0000000..ae3ea89 + #endif + } + rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN); -+ ++ + if(request->n_channels == 3 && + request->channels[0]->hw_value == 1 && + request->channels[1]->hw_value == 6 && @@ -319362,7 +319385,7 @@ index 0000000..ae3ea89 + } + +#ifdef CONFIG_CONCURRENT_MODE -+ if(pbuddy_mlmepriv && (pbuddy_mlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE)) ++ if(pbuddy_mlmepriv && (pbuddy_mlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE)) + { +#if 1 // Miracast can't do AP scan + static u32 buddylastscantime = 0; @@ -319433,7 +319456,7 @@ index 0000000..ae3ea89 + DBG_8192C("ssid=%s, len=%d\n", ssids[i].ssid, ssids[i].ssid_len); + #endif + _rtw_memcpy(ssid[i].Ssid, ssids[i].ssid, ssids[i].ssid_len); -+ ssid[i].SsidLength = ssids[i].ssid_len; ++ ssid[i].SsidLength = ssids[i].ssid_len; + } + + /* parsing channels, n_channels */ @@ -319482,7 +319505,7 @@ index 0000000..ae3ea89 + +exit: + return ret; -+ ++ +} + +static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed) @@ -319523,23 +319546,23 @@ index 0000000..ae3ea89 + + +static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32 wpa_version) -+{ ++{ + DBG_8192C("%s, wpa_version=%d\n", __func__, wpa_version); -+ -+ if (!wpa_version) { -+ psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; ++ ++ if (!wpa_version) { ++ psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; + return 0; + } + + + if (wpa_version & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) -+ { -+ psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPAPSK; ++ { ++ psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPAPSK; + } + +/* + if (wpa_version & NL80211_WPA_VERSION_2) -+ { ++ { + psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK; + } +*/ @@ -319568,12 +319591,12 @@ index 0000000..ae3ea89 + + break; + case NL80211_AUTHTYPE_OPEN_SYSTEM: -+ ++ + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; + + if(psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA) + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; -+ ++ +#ifdef CONFIG_WAPI_SUPPORT + if(psecuritypriv->ndisauthtype == Ndis802_11AuthModeWAPI) + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI; @@ -319588,7 +319611,7 @@ index 0000000..ae3ea89 + + + break; -+ default: ++ default: + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; + //return -ENOTSUPP; + } @@ -319612,7 +319635,7 @@ index 0000000..ae3ea89 + psecuritypriv->ndisencryptstatus = ndisencryptstatus; + return 0; + } -+ ++ + switch (cipher) { + case IW_AUTH_CIPHER_NONE: + *profile_cipher = _NO_PRIVACY_; @@ -319654,10 +319677,10 @@ index 0000000..ae3ea89 + if(ucast) + { + psecuritypriv->ndisencryptstatus = ndisencryptstatus; -+ ++ + //if(psecuritypriv->dot11PrivacyAlgrthm >= _AES_) + // psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK; -+ } ++ } + + return 0; +} @@ -319692,8 +319715,8 @@ index 0000000..ae3ea89 + +static int rtw_cfg80211_set_wpa_ie(_adapter *padapter, u8 *pie, size_t ielen) +{ -+ u8 *buf=NULL, *pos=NULL; -+ u32 left; ++ u8 *buf=NULL, *pos=NULL; ++ u32 left; + int group_cipher = 0, pairwise_cipher = 0; + int ret = 0; + int wpa_ielen=0; @@ -319743,7 +319766,7 @@ index 0000000..ae3ea89 + padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; + padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPAPSK; + _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa[0], wpa_ielen+2); -+ ++ + DBG_8192C("got wpa_ie, wpa_ielen:%u\n", wpa_ielen); + } + } @@ -319754,7 +319777,7 @@ index 0000000..ae3ea89 + if(rtw_parse_wpa2_ie(pwpa2, wpa2_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + { + padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; -+ padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK; ++ padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK; + _rtw_memcpy(padapter->securitypriv.supplicant_ie, &pwpa2[0], wpa2_ielen+2); + + DBG_8192C("got wpa2_ie, wpa2_ielen:%u\n", wpa2_ielen); @@ -319769,7 +319792,7 @@ index 0000000..ae3ea89 + { + pairwise_cipher = WPA_CIPHER_NONE; + } -+ ++ + switch(group_cipher) + { + case WPA_CIPHER_NONE: @@ -319788,7 +319811,7 @@ index 0000000..ae3ea89 + padapter->securitypriv.dot118021XGrpPrivacy=_AES_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; + break; -+ case WPA_CIPHER_WEP104: ++ case WPA_CIPHER_WEP104: + padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; + break; @@ -319812,14 +319835,14 @@ index 0000000..ae3ea89 + padapter->securitypriv.dot11PrivacyAlgrthm=_AES_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; + break; -+ case WPA_CIPHER_WEP104: ++ case WPA_CIPHER_WEP104: + padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; + padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; + break; + } -+ ++ + {/* handle wps_ie */ -+ uint wps_ielen; ++ uint wps_ielen; + u8 *wps_ie; + + wps_ie = rtw_get_wps_ie(buf, ielen, NULL, &wps_ielen); @@ -319834,7 +319857,7 @@ index 0000000..ae3ea89 + } + + #ifdef CONFIG_P2P -+ {//check p2p_ie for assoc req; ++ {//check p2p_ie for assoc req; + uint p2p_ielen=0; + u8 *p2p_ie; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -319865,7 +319888,7 @@ index 0000000..ae3ea89 + #endif //CONFIG_P2P + + #ifdef CONFIG_WFD -+ {//check wfd_ie for assoc req; ++ {//check wfd_ie for assoc req; + uint wfd_ielen=0; + u8 *wfd_ie; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -319889,7 +319912,7 @@ index 0000000..ae3ea89 + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + goto exit; + } -+ rtw_get_wfd_ie(buf, ielen, pmlmepriv->wfd_assoc_req_ie, &pmlmepriv->wfd_assoc_req_ie_len); ++ rtw_get_wfd_ie(buf, ielen, pmlmepriv->wfd_assoc_req_ie, &pmlmepriv->wfd_assoc_req_ie_len); + } + } + #endif //CONFIG_WFD @@ -319931,12 +319954,12 @@ index 0000000..ae3ea89 + int ret=0; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) -+ pch_def = (struct cfg80211_chan_def *)(¶ms->chandef); ++ pch_def = (struct cfg80211_chan_def *)(¶ms->chandef); + pch = (struct ieee80211_channel *) pch_def->chan; +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) -+ pch = (struct ieee80211_channel *)(params->channel); ++ pch = (struct ieee80211_channel *)(params->channel); +#endif -+ ++ + if(_FAIL == rtw_pwr_wakeup(padapter)) { + ret= -EPERM; + goto exit; @@ -319957,7 +319980,7 @@ index 0000000..ae3ea89 + rtw_scan_abort(padapter->pbuddy_adapter); + } +#endif //CONFIG_CONCURRENT_MODE -+ ++ + if (!params->ssid || !params->ssid_len) + { + ret = -EINVAL; @@ -319969,31 +319992,31 @@ index 0000000..ae3ea89 + ret= -E2BIG; + goto exit; + } -+ -+ _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); ++ ++ _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); + ndis_ssid.SsidLength = params->ssid_len; + _rtw_memcpy(ndis_ssid.Ssid, (u8 *)params->ssid, params->ssid_len); + + //DBG_8192C("ssid=%s, len=%zu\n", ndis_ssid.Ssid, params->ssid_len); -+ ++ + psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled; + psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; + psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system + psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; -+ ++ + ret = rtw_cfg80211_set_auth_type(psecuritypriv, NL80211_AUTHTYPE_OPEN_SYSTEM); + rtw_set_802_11_authentication_mode(padapter, psecuritypriv->ndisauthtype); + + DBG_871X("%s: center_freq = %d\n", __func__, pch->center_freq); + pmlmeext->cur_channel = rtw_freq2ch(pch->center_freq); -+ -+ if (rtw_set_802_11_ssid(padapter, &ndis_ssid) == _FALSE) ++ ++ if (rtw_set_802_11_ssid(padapter, &ndis_ssid) == _FALSE) + { + ret = -1; + goto exit; -+ } -+ ++ } ++ +exit: + return ret; +} @@ -320008,25 +320031,25 @@ index 0000000..ae3ea89 + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + padapter->mlmepriv.not_indic_disco = _TRUE; -+ ++ + old_type = rtw_wdev->iftype; -+ ++ + rtw_set_to_roam(padapter, 0); + -+ if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) ++ if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) + { + rtw_scan_abort(padapter); + LeaveAllPowerSaveMode(padapter); -+ ++ + rtw_wdev->iftype = NL80211_IFTYPE_STATION; -+ ++ + if (rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure) ==_FALSE) + { + rtw_wdev->iftype = old_type; + ret = -EPERM; + goto leave_ibss; + } -+ rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure,_TRUE); ++ rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure,_TRUE); + } + +leave_ibss: @@ -320039,23 +320062,23 @@ index 0000000..ae3ea89 + struct cfg80211_connect_params *sme) +{ + int ret=0; -+ _irqL irqL; -+ _list *phead; ++ _irqL irqL; ++ _list *phead; + struct wlan_network *pnetwork = NULL; -+ NDIS_802_11_AUTHENTICATION_MODE authmode; -+ NDIS_802_11_SSID ndis_ssid; ++ NDIS_802_11_AUTHENTICATION_MODE authmode; ++ NDIS_802_11_SSID ndis_ssid; + u8 *dst_ssid, *src_ssid; + u8 *dst_bssid, *src_bssid; + //u8 matched_by_bssid=_FALSE; + //u8 matched_by_ssid=_FALSE; + u8 matched=_FALSE; + _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); -+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv; ++ struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; -+ _queue *queue = &pmlmepriv->scanned_queue; ++ _queue *queue = &pmlmepriv->scanned_queue; + + padapter->mlmepriv.not_indic_disco = _TRUE; -+ ++ + DBG_871X("=>"FUNC_NDEV_FMT" - Start to Connection\n", FUNC_NDEV_ARG(ndev)); + DBG_871X("privacy=%d, key=%p, key_len=%d, key_idx=%d\n", + sme->privacy, sme->key, sme->key_len, sme->key_idx); @@ -320073,14 +320096,14 @@ index 0000000..ae3ea89 + if(adapter_wdev_data(padapter)->bandroid_scan == _FALSE) + { +#ifdef CONFIG_P2P -+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo); ++ struct wifidirect_info *pwdinfo= &(padapter->wdinfo); + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) +#endif //CONFIG_P2P + { + ret = -EBUSY; + printk("Android hasn't attached yet!\n"); + goto exit; -+ } ++ } + } +#endif + @@ -320117,13 +320140,13 @@ index 0000000..ae3ea89 + ret= -E2BIG; + goto exit; + } -+ -+ _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); ++ ++ _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); + ndis_ssid.SsidLength = sme->ssid_len; + _rtw_memcpy(ndis_ssid.Ssid, (u8 *)sme->ssid, sme->ssid_len); + + DBG_8192C("ssid=%s, len=%zu\n", ndis_ssid.Ssid, sme->ssid_len); -+ ++ + + if (sme->bssid) + DBG_8192C("bssid="MAC_FMT"\n", MAC_ARG(sme->bssid)); @@ -320132,7 +320155,7 @@ index 0000000..ae3ea89 + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) { + ret = -EBUSY; + DBG_8192C("%s, fw_state=0x%x, goto exit\n", __FUNCTION__, pmlmepriv->fw_state); -+ goto exit; ++ goto exit; + } + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { + rtw_scan_abort(padapter); @@ -320173,12 +320196,12 @@ index 0000000..ae3ea89 + goto exit; + + DBG_8192C("%s, ie_len=%zu\n", __func__, sme->ie_len); -+ ++ + ret = rtw_cfg80211_set_wpa_ie(padapter, (u8 *)sme->ie, sme->ie_len); + if (ret < 0) + goto exit; + -+ if (sme->crypto.n_ciphers_pairwise) { ++ if (sme->crypto.n_ciphers_pairwise) { + ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.ciphers_pairwise[0], _TRUE); + if (ret < 0) + goto exit; @@ -320201,7 +320224,7 @@ index 0000000..ae3ea89 + goto exit; + } + -+ if (wep_key_len > 0) ++ if (wep_key_len > 0) + { + wep_key_len = wep_key_len <= 5 ? 5 : 13; + wep_total_len = wep_key_len + FIELD_OFFSET(NDIS_802_11_WEP, KeyMaterial); @@ -320223,7 +320246,7 @@ index 0000000..ae3ea89 + padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; + } + } -+ else { ++ else { + ret = -EINVAL; + goto exit; + } @@ -320239,7 +320262,7 @@ index 0000000..ae3ea89 + } + + if (pwep) { -+ rtw_mfree((u8 *)pwep,wep_total_len); ++ rtw_mfree((u8 *)pwep,wep_total_len); + } + + if(ret < 0) @@ -320276,7 +320299,7 @@ index 0000000..ae3ea89 + } + + DBG_8192C("set ssid:dot11AuthAlgrthm=%d, dot11PrivacyAlgrthm=%d, dot118021XGrpPrivacy=%d\n", psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm, psecuritypriv->dot118021XGrpPrivacy); -+ ++ +exit: + + rtw_ps_deny_cancel(padapter, PS_DENY_JOIN); @@ -320304,13 +320327,13 @@ index 0000000..ae3ea89 + rtw_scan_abort(padapter); + LeaveAllPowerSaveMode(padapter); + rtw_disassoc_cmd(padapter, 500, _FALSE); -+ ++ + DBG_871X("%s...call rtw_indicate_disconnect\n", __FUNCTION__); -+ ++ + rtw_indicate_disconnect(padapter); -+ ++ + rtw_free_assoc_resources(padapter, 1); -+ rtw_pwr_wakeup(padapter); ++ rtw_pwr_wakeup(padapter); + } + + padapter->mlmepriv.not_indic_disco = _FALSE; @@ -320368,7 +320391,7 @@ index 0000000..ae3ea89 + DBG_8192C("%s\n", __func__); + + *dbm = (12); -+ ++ + return 0; +} + @@ -320384,7 +320407,7 @@ index 0000000..ae3ea89 +{ + _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); + struct rtw_wdev_priv *rtw_wdev_priv = adapter_wdev_data(padapter); -+ ++ + DBG_871X(FUNC_NDEV_FMT" enabled:%u, timeout:%d\n", FUNC_NDEV_ARG(ndev), + enabled, timeout); + @@ -320422,7 +320445,7 @@ index 0000000..ae3ea89 + } + + blInserted = _FALSE; -+ ++ + //overwrite PMKID + for(index=0 ; indexPMKIDIndex = index+1; + blInserted = _TRUE; + break; -+ } ++ } + } + + if(!blInserted) @@ -320452,8 +320475,8 @@ index 0000000..ae3ea89 + if(psecuritypriv->PMKIDIndex==16) + { + psecuritypriv->PMKIDIndex =0; -+ } -+ } ++ } ++ } + + return 0; +} @@ -320472,14 +320495,14 @@ index 0000000..ae3ea89 + for(index=0 ; indexPMKIDList[index].Bssid, (u8 *)pmksa->bssid, ETH_ALEN) ==_TRUE ) -+ { // BSSID is matched, the same AP => Remove this PMKID information and reset it. ++ { // BSSID is matched, the same AP => Remove this PMKID information and reset it. + _rtw_memset(psecuritypriv->PMKIDList[index].Bssid, 0x00, ETH_ALEN ); + _rtw_memset(psecuritypriv->PMKIDList[index].PMKID, 0x00, WLAN_PMKID_LEN ); + psecuritypriv->PMKIDList[index].bUsed = _FALSE; + bMatched = _TRUE; -+ DBG_871X(FUNC_NDEV_FMT" clear id:%hhu\n", FUNC_NDEV_ARG(ndev), index); ++ DBG_871X(FUNC_NDEV_FMT" clear id:%hhu\n", FUNC_NDEV_ARG(ndev), index); + break; -+ } ++ } + } + + if(_FALSE == bMatched) @@ -320512,7 +320535,7 @@ index 0000000..ae3ea89 + s32 freq; + int channel; + struct wireless_dev *pwdev = padapter->rtw_wdev; -+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); ++ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct net_device *ndev = padapter->pnetdev; + + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); @@ -320525,7 +320548,7 @@ index 0000000..ae3ea89 + ie_offset = _ASOCREQ_IE_OFFSET_; + else // WIFI_REASSOCREQ + ie_offset = _REASOCREQ_IE_OFFSET_; -+ ++ + sinfo.filled = 0; +// cf commit 319090bf6c75e3ad42a8c +// sinfo.filled = STATION_INFO_ASSOC_REQ_IES; @@ -320565,12 +320588,12 @@ index 0000000..ae3ea89 + u8 *pmgmt_frame; + uint frame_len; + struct rtw_ieee80211_hdr *pwlanhdr; -+ unsigned short *fctrl; ++ unsigned short *fctrl; + u8 mgmt_buf[128] = {0}; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct net_device *ndev = padapter->pnetdev; -+ ++ + DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); + +#if defined(RTW_USE_CFG80211_STA_EVENT) || defined(COMPAT_KERNEL_RELEASE) @@ -320579,14 +320602,14 @@ index 0000000..ae3ea89 + channel = pmlmeext->cur_channel; + freq = rtw_ch2freq(channel); + -+ pmgmt_frame = mgmt_buf; ++ pmgmt_frame = mgmt_buf; + pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame; + + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; + + _rtw_memcpy(pwlanhdr->addr1, adapter_mac_addr(padapter), ETH_ALEN); -+ _rtw_memcpy(pwlanhdr->addr2, da, ETH_ALEN); ++ _rtw_memcpy(pwlanhdr->addr2, da, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + + SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); @@ -320604,7 +320627,7 @@ index 0000000..ae3ea89 + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER) + rtw_cfg80211_rx_mgmt(padapter, freq, 0, mgmt_buf, frame_len, GFP_ATOMIC); + #else //COMPAT_KERNEL_RELEASE -+ cfg80211_send_disassoc(padapter->pnetdev, mgmt_buf, frame_len); ++ cfg80211_send_disassoc(padapter->pnetdev, mgmt_buf, frame_len); + //cfg80211_rx_action(padapter->pnetdev, freq, mgmt_buf, frame_len, GFP_ATOMIC); + #endif //COMPAT_KERNEL_RELEASE +#endif /* defined(RTW_USE_CFG80211_STA_EVENT) */ @@ -320615,7 +320638,7 @@ index 0000000..ae3ea89 + int ret = 0; + + DBG_8192C("%s\n", __func__); -+ ++ + return ret; +} + @@ -320624,12 +320647,12 @@ index 0000000..ae3ea89 + int ret = 0; + + DBG_8192C("%s\n", __func__); -+ ++ + return ret; +} + +static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_device *ndev) -+{ ++{ + int ret = 0; + int rtap_len; + int qos_len = 0; @@ -320642,11 +320665,13 @@ index 0000000..ae3ea89 + struct ieee80211_hdr *dot11_hdr; + struct ieee80211_radiotap_header *rtap_hdr; + _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); -+ ++ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + -+ if (skb) -+ rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); ++ if (!skb) ++ goto fail; ++ ++ rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); + + if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) + goto fail; @@ -320663,7 +320688,7 @@ index 0000000..ae3ea89 + { + DBG_8192C("radiotap len (should be 14): %d\n", rtap_len); + goto fail; -+ } ++ } + + /* Skip the ratio tap header */ + skb_pull(skb, rtap_len); @@ -320701,15 +320726,15 @@ index 0000000..ae3ea89 + } + else if ((frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE)) + == (RTW_IEEE80211_FTYPE_MGMT|RTW_IEEE80211_STYPE_ACTION) -+ ) ++ ) + { + //only for action frames + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; -+ unsigned char *pframe; ++ unsigned char *pframe; + //u8 category, action, OUI_Subtype, dialogToken=0; + //unsigned char *frame_body; -+ struct rtw_ieee80211_hdr *pwlanhdr; ++ struct rtw_ieee80211_hdr *pwlanhdr; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + u8 *buf = skb->data; @@ -320722,7 +320747,7 @@ index 0000000..ae3ea89 + le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)buf)->frame_ctl)); + goto fail; + } -+ ++ + DBG_8192C("RTW_Tx:da="MAC_FMT" via "FUNC_NDEV_FMT"\n", + MAC_ARG(GetAddr1Ptr(buf)), FUNC_NDEV_ARG(ndev)); + #ifdef CONFIG_P2P @@ -320737,7 +320762,7 @@ index 0000000..ae3ea89 +dump: + //starting alloc mgmt frame to dump it + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) -+ { ++ { + goto fail; + } + @@ -320755,41 +320780,41 @@ index 0000000..ae3ea89 + if (type >= 0) + { + struct wifi_display_info *pwfd_info; -+ ++ + pwfd_info = padapter->wdinfo.wfd_info; -+ ++ + if ( _TRUE == pwfd_info->wfd_enable ) + { + rtw_append_wfd_ie( padapter, pframe, &len ); + } + } + #endif // CONFIG_WFD -+ pattrib->pktlen = len; -+ ++ pattrib->pktlen = len; ++ + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + //update seq number + pmlmeext->mgnt_seq = GetSequence(pwlanhdr); + pattrib->seqnum = pmlmeext->mgnt_seq; + pmlmeext->mgnt_seq++; + -+ ++ + pattrib->last_txcmdsz = pattrib->pktlen; -+ ++ + dump_mgntframe(padapter, pmgntframe); -+ ++ + } + else + { + DBG_8192C("frame_ctl=0x%x\n", frame_ctl & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE)); + } + -+ ++ +fail: -+ ++ + rtw_skb_free(skb); + + return 0; -+ ++ +} + +static void rtw_cfg80211_monitor_if_set_multicast_list(struct net_device *ndev) @@ -320800,9 +320825,9 @@ index 0000000..ae3ea89 +static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void *addr) +{ + int ret = 0; -+ ++ + DBG_8192C("%s\n", __func__); -+ ++ + return ret; +} + @@ -320814,7 +320839,7 @@ index 0000000..ae3ea89 + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) + .ndo_set_multicast_list = rtw_cfg80211_monitor_if_set_multicast_list, + #endif -+ .ndo_set_mac_address = rtw_cfg80211_monitor_if_set_mac_address, ++ .ndo_set_mac_address = rtw_cfg80211_monitor_if_set_mac_address, +}; +#endif + @@ -320825,7 +320850,7 @@ index 0000000..ae3ea89 + struct wireless_dev* mon_wdev = NULL; + struct rtw_netdev_priv_indicator *pnpi; + struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter); -+ ++ + if (!name) { + DBG_871X(FUNC_ADPT_FMT" without specific name\n", FUNC_ADPT_ARG(padapter)); + ret = -EINVAL; @@ -320849,8 +320874,13 @@ index 0000000..ae3ea89 + mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; + strncpy(mon_ndev->name, name, IFNAMSIZ); + mon_ndev->name[IFNAMSIZ - 1] = 0; -+ mon_ndev->destructor = rtw_ndev_destructor; -+ ++ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,9)) ++ mon_ndev->needs_free_netdev = false; ++ mon_ndev->priv_destructor = rtw_ndev_destructor; ++ #else ++ mon_ndev->destructor = rtw_ndev_destructor; ++ #endif ++ +#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) + mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops; +#else @@ -320916,7 +320946,11 @@ index 0000000..ae3ea89 + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)) + unsigned char name_assign_type, + #endif -+ enum nl80211_iftype type, u32 *flags, struct vif_params *params) ++ enum nl80211_iftype type, ++ #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) ++ u32 *flags, ++ #endif ++ struct vif_params *params) +{ + int ret = 0; + struct net_device* ndev = NULL; @@ -321005,35 +321039,35 @@ index 0000000..ae3ea89 +{ + int ret=0; + u8 *pbuf = NULL; -+ uint len, wps_ielen=0; ++ uint len, wps_ielen=0; + uint p2p_ielen=0; + u8 *p2p_ie; + u8 got_p2p_ie = _FALSE; + struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); + //struct sta_priv *pstapriv = &padapter->stapriv; -+ ++ + + DBG_8192C("%s beacon_head_len=%zu, beacon_tail_len=%zu\n", __FUNCTION__, head_len, tail_len); + -+ ++ + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) + return -EINVAL; + + if(head_len<24) + return -EINVAL; -+ ++ + + pbuf = rtw_zmalloc(head_len+tail_len); + if(!pbuf) + return -ENOMEM; -+ ++ + + //_rtw_memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); + + //if((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0)) + // pstapriv->max_num_sta = NUM_STA; + -+ ++ + _rtw_memcpy(pbuf, (void *)head+24, head_len-24);// 24=beacon header len. + _rtw_memcpy(pbuf+head_len-24, (void *)tail, tail_len); + @@ -321048,20 +321082,20 @@ index 0000000..ae3ea89 + { + //check p2p if enable + if(rtw_get_p2p_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &p2p_ielen)) -+ { ++ { + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + struct wifidirect_info *pwdinfo= &(adapter->wdinfo); + + DBG_8192C("got p2p_ie, len=%d\n", p2p_ielen); -+ -+ got_p2p_ie = _TRUE; -+ ++ ++ got_p2p_ie = _TRUE; ++ + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) -+ { ++ { + DBG_8192C("Enable P2P function for the first time\n"); + rtw_p2p_enable(adapter, P2P_ROLE_GO); + adapter_wdev_data(adapter)->p2p_enabled = _TRUE; -+ ++ + adapter->stapriv.expire_to = 3; // 3x2 = 6 sec in p2p mode + } + else @@ -321070,7 +321104,7 @@ index 0000000..ae3ea89 + + rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); + rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK); -+ pwdinfo->intent = 15; ++ pwdinfo->intent = 15; + } + } + } @@ -321080,28 +321114,28 @@ index 0000000..ae3ea89 + rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, P2P_OUI, 4); + rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, WFD_OUI, 4); + -+ if (rtw_check_beacon_data(adapter, pbuf, len) == _SUCCESS) ++ if (rtw_check_beacon_data(adapter, pbuf, len) == _SUCCESS) + { -+#ifdef CONFIG_P2P ++#ifdef CONFIG_P2P + //check p2p if enable + if(got_p2p_ie == _TRUE) + { + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + struct wifidirect_info *pwdinfo= &(adapter->wdinfo); -+ pwdinfo->operating_channel = pmlmeext->cur_channel; ++ pwdinfo->operating_channel = pmlmeext->cur_channel; + } +#endif //CONFIG_P2P + ret = 0; -+ } ++ } + else + { + ret = -EINVAL; -+ } -+ ++ } + -+ rtw_mfree(pbuf, head_len+tail_len); -+ -+ return ret; ++ ++ rtw_mfree(pbuf, head_len+tail_len); ++ ++ return ret; +} + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE) @@ -321122,20 +321156,20 @@ index 0000000..ae3ea89 +{ + _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev); + struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); -+ ++ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + pmlmeext->bstart_bss = _TRUE; + + cfg80211_rtw_add_beacon(wiphy, ndev, info); -+ ++ + return 0; +} + +static int cfg80211_rtw_del_beacon(struct wiphy *wiphy, struct net_device *ndev) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); -+ ++ + return 0; +} +#else @@ -321144,7 +321178,7 @@ index 0000000..ae3ea89 +{ + int ret = 0; + _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev); -+ ++ + DBG_871X(FUNC_NDEV_FMT" hidden_ssid:%d, auth_type:%d\n", FUNC_NDEV_ARG(ndev), + settings->hidden_ssid, settings->auth_type); + @@ -321152,7 +321186,7 @@ index 0000000..ae3ea89 + settings->beacon.tail, settings->beacon.tail_len); + + adapter->mlmeextpriv.mlmext_info.hidden_ssid_mode = settings->hidden_ssid; -+ ++ + if (settings->ssid && settings->ssid_len) { + WLAN_BSSID_EX *pbss_network = &adapter->mlmepriv.cur_network.network; + WLAN_BSSID_EX *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network; @@ -321199,7 +321233,7 @@ index 0000000..ae3ea89 + +static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev, +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) -+ u8 *mac, ++ u8 *mac, +#else + const u8 *mac, +#endif @@ -321212,7 +321246,7 @@ index 0000000..ae3ea89 + struct sta_info *psta; +#endif /* CONFIG_TDLS */ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); -+ ++ +#ifdef CONFIG_TDLS + psta = rtw_get_stainfo(pstapriv, mac); + if (psta == NULL) { @@ -321239,7 +321273,7 @@ index 0000000..ae3ea89 +#endif + ) +{ -+ int ret=0; ++ int ret=0; + _irqL irqL; + _list *phead, *plist; + u8 updated = _FALSE; @@ -321258,10 +321292,10 @@ index 0000000..ae3ea89 + target_mac = params->mac; +#endif + -+ if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) ++ if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE) + { + DBG_8192C("%s, fw_state != FW_LINKED|WIFI_AP_STATE\n", __func__); -+ return -EINVAL; ++ return -EINVAL; + } + + @@ -321272,34 +321306,34 @@ index 0000000..ae3ea89 + flush_all_cam_entry(padapter); //clear CAM + + ret = rtw_sta_flush(padapter, _TRUE); -+ ++ + return ret; -+ } ++ } + + + DBG_8192C("free sta macaddr =" MAC_FMT "\n", MAC_ARG(target_mac)); + + if (target_mac[0] == 0xff && target_mac[1] == 0xff && + target_mac[2] == 0xff && target_mac[3] == 0xff && -+ target_mac[4] == 0xff && target_mac[5] == 0xff) ++ target_mac[4] == 0xff && target_mac[5] == 0xff) + { -+ return -EINVAL; ++ return -EINVAL; + } + + + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); -+ ++ + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + //check asoc_queue -+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) ++ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); -+ -+ plist = get_next(plist); -+ -+ if(_rtw_memcmp((u8 *)target_mac, psta->hwaddr, ETH_ALEN)) ++ ++ plist = get_next(plist); ++ ++ if(_rtw_memcmp((u8 *)target_mac, psta->hwaddr, ETH_ALEN)) + { + if(psta->dot8021xalg == 1 && psta->bpairwise_key_installed == _FALSE) + { @@ -321322,10 +321356,10 @@ index 0000000..ae3ea89 + psta = NULL; + + break; -+ } -+ ++ } ++ + } -+ ++ + } + + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); @@ -321333,21 +321367,21 @@ index 0000000..ae3ea89 + associated_clients_update(padapter, updated, STA_INFO_UPDATE_ALL); + + DBG_871X("-"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); -+ -+ return ret; ++ ++ return ret; + +} + +static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev, +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) -+ u8 *mac, ++ u8 *mac, +#else + const u8 *mac, +#endif + struct station_parameters *params) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); -+ ++ + return 0; +} + @@ -321357,15 +321391,15 @@ index 0000000..ae3ea89 + _list *phead, *plist; + struct sta_info *psta = NULL; + int i = 0; -+ ++ + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + //check asoc_queue -+ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) ++ while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + if(idx == i) psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); -+ plist = get_next(plist); ++ plist = get_next(plist); + i++; + } + return psta; @@ -321395,7 +321429,7 @@ index 0000000..ae3ea89 + sinfo->filled = 0; + sinfo->filled |= NL80211_STA_INFO_SIGNAL; + sinfo->signal = psta->rssi; -+ ++ +exit: + return ret; +} @@ -321414,13 +321448,13 @@ index 0000000..ae3ea89 + + DBG_8192C("basic_rates_len=%d\n", params->basic_rates_len); + for(i=0; ibasic_rates_len; i++) -+ { ++ { + DBG_8192C("basic_rates=%d\n", params->basic_rates[i]); -+ -+ } -+*/ ++ ++ } ++*/ + return 0; -+ ++ +} + +static int cfg80211_rtw_set_channel(struct wiphy *wiphy @@ -321467,7 +321501,7 @@ index 0000000..ae3ea89 + struct cfg80211_auth_request *req) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); -+ ++ + return 0; +} + @@ -321475,7 +321509,7 @@ index 0000000..ae3ea89 + struct cfg80211_assoc_request *req) +{ + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); -+ ++ + return 0; +} +#endif //CONFIG_AP_MODE @@ -321484,7 +321518,7 @@ index 0000000..ae3ea89 +{ + s32 freq; + int channel; -+ struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); ++ struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); + struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter); + u8 category, action; + @@ -321544,7 +321578,7 @@ index 0000000..ae3ea89 + case P2P_GO_NEGO_CONF: + case P2P_PROVISION_DISC_RESP: + case P2P_INVIT_RESP: -+ rtw_set_scan_deny(padapter, 2000); ++ rtw_set_scan_deny(padapter, 2000); + rtw_clear_scan_deny(padapter); + } + goto indicate; @@ -321567,7 +321601,7 @@ index 0000000..ae3ea89 +{ + s32 freq; + int channel; -+ struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); ++ struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); + struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter); + u8 category, action; + @@ -321611,17 +321645,17 @@ index 0000000..ae3ea89 + u8 devinfo_content[64] = { 0x00 }; + u16 capability = 0; + uint capability_len = 0; -+ ++ + unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; + u8 action = P2P_PUB_ACTION_ACTION; + u8 dialogToken = 1; + u32 p2poui = cpu_to_be32(P2POUI); -+ u8 oui_subtype = P2P_PROVISION_DISC_REQ; ++ u8 oui_subtype = P2P_PROVISION_DISC_REQ; + u32 p2pielen = 0; +#ifdef CONFIG_WFD + u32 wfdielen = 0; -+#endif //CONFIG_WFD -+ ++#endif //CONFIG_WFD ++ + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + unsigned char *pframe; @@ -321630,7 +321664,7 @@ index 0000000..ae3ea89 + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); -+ ++ + struct wifidirect_info *pwdinfo = &(padapter->wdinfo); + u8 *frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr)); + size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr); @@ -321638,17 +321672,17 @@ index 0000000..ae3ea89 + + DBG_871X( "[%s] In\n", __FUNCTION__ ); + -+ //prepare for building provision_request frame ++ //prepare for building provision_request frame + _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerIFAddr, GetAddr1Ptr(buf), ETH_ALEN); + _rtw_memcpy(pwdinfo->tx_prov_disc_info.peerDevAddr, GetAddr1Ptr(buf), ETH_ALEN); -+ ++ + pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON; -+ ++ + rtw_get_wps_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, wpsie, &wpsielen); + rtw_get_wps_attr_content( wpsie, wpsielen, WPS_ATTR_DEVICE_PWID, (u8*) &wps_devicepassword_id, &wps_devicepassword_id_len); + wps_devicepassword_id = be16_to_cpu( wps_devicepassword_id ); + -+ switch(wps_devicepassword_id) ++ switch(wps_devicepassword_id) + { + case WPS_DPID_PIN: + pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_LABEL; @@ -321672,25 +321706,25 @@ index 0000000..ae3ea89 + + + if ( rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, p2p_ie, &p2p_ielen ) ) -+ { ++ { + -+ rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, devinfo_content, &devinfo_contentlen); ++ rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, devinfo_content, &devinfo_contentlen); + rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&capability, &capability_len); -+ ++ + } + + -+ //start to build provision_request frame ++ //start to build provision_request frame + _rtw_memset(wpsie, 0, sizeof(wpsie)); + _rtw_memset(p2p_ie, 0, sizeof(p2p_ie)); -+ p2p_ielen = 0; -+ ++ p2p_ielen = 0; ++ + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + { + return; + } + -+ ++ + //update attribute + pattrib = &pmgntframe->attrib; + update_mgntframe_attrib(padapter, pattrib); @@ -321717,11 +321751,11 @@ index 0000000..ae3ea89 + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *) &(p2poui), &(pattrib->pktlen)); -+ pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); -+ pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); ++ pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); ++ pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); + + -+ //build_prov_disc_request_p2p_ie ++ //build_prov_disc_request_p2p_ie + // P2P OUI + p2pielen = 0; + p2p_ie[ p2pielen++ ] = 0x50; @@ -321736,7 +321770,7 @@ index 0000000..ae3ea89 + // 3. Group ID ( When joining an operating P2P Group ) + + // P2P Capability ATTR -+ // Type: ++ // Type: + p2p_ie[ p2pielen++ ] = P2P_ATTR_CAPABILITY; + + // Length: @@ -321749,14 +321783,14 @@ index 0000000..ae3ea89 + // Group Capability Bitmap, 1 byte + _rtw_memcpy(p2p_ie + p2pielen, &capability, 2); + p2pielen += 2; -+ ++ + + // Device Info ATTR + // Type: + p2p_ie[ p2pielen++ ] = P2P_ATTR_DEVICE_INFO; + + // Length: -+ // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) ++ // 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) + // + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) + //*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); + RTW_PUT_LE16(p2p_ie + p2pielen, devinfo_contentlen); @@ -321767,7 +321801,7 @@ index 0000000..ae3ea89 + p2pielen += devinfo_contentlen; + + -+ pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2p_ie, &p2p_ielen); ++ pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2p_ie, &p2p_ielen); + //p2pielen = build_prov_disc_request_p2p_ie( pwdinfo, pframe, NULL, 0, pwdinfo->tx_prov_disc_info.peerDevAddr); + //pframe += p2pielen; + pattrib->pktlen += p2p_ielen; @@ -321821,7 +321855,7 @@ index 0000000..ae3ea89 + //{ + // DBG_8192C("waiting for p2p peer key-in PIN CODE\n"); + // rtw_msleep_os(15000); // 15 sec for key in PIN CODE, workaround for GS2 before issuing Nego Req. -+ //} ++ //} + +} + @@ -321869,12 +321903,12 @@ index 0000000..ae3ea89 + #endif + + *cookie = ATOMIC_INC_RETURN(&pcfg80211_wdinfo->ro_ch_cookie_gen); -+ ++ + DBG_871X(FUNC_ADPT_FMT" ch:%u duration:%d, cookie:0x%llx\n", FUNC_ADPT_ARG(padapter), remain_ch, duration, *cookie); + +#ifdef CONFIG_MP_INCLUDED + if (padapter->registrypriv.mp_mode == 1) { -+ DBG_871X(FUNC_ADPT_FMT ": MP mode block remain_on_channel request\n", FUNC_ADPT_ARG(padapter)); ++ DBG_871X(FUNC_ADPT_FMT ": MP mode block remain_on_channel request\n", FUNC_ADPT_ARG(padapter)); + err = -EFAULT; + goto exit; + } @@ -321914,9 +321948,9 @@ index 0000000..ae3ea89 + pcfg80211_wdinfo->remain_on_ch_cookie= *cookie; + + rtw_scan_abort(padapter); -+#ifdef CONFIG_CONCURRENT_MODE ++#ifdef CONFIG_CONCURRENT_MODE + if ((rtw_buddy_adapter_up(padapter)) && is_p2p_find) //don't scan_abort during p2p_listen. -+ rtw_scan_abort(padapter->pbuddy_adapter); ++ rtw_scan_abort(padapter->pbuddy_adapter); +#endif //CONFIG_CONCURRENT_MODE + + if (check_fwstate(&padapter->mlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS) == _TRUE) @@ -321942,7 +321976,7 @@ index 0000000..ae3ea89 + padapter->wdinfo.listen_channel = remain_ch; + } else { + rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); -+#ifdef CONFIG_DEBUG_CFG80211 ++#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); +#endif + } @@ -321972,11 +322006,11 @@ index 0000000..ae3ea89 +#ifdef CONFIG_CONCURRENT_MODE + if ( check_buddy_fwstate(padapter, _FW_LINKED) ) + { -+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter; -+ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; ++ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter; ++ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; + + if((remain_ch != pbuddy_mlmeext->cur_channel) && !check_fwstate(&padapter->mlmepriv, _FW_LINKED)) -+ { ++ { + if(ATOMIC_READ(&pwdev_priv->switch_ch_to)==1 || + (remain_ch != pmlmeext->cur_channel)) + { @@ -321991,27 +322025,27 @@ index 0000000..ae3ea89 + DBG_8192C("%s, set switch ch timer, duration=%d\n", __func__, duration-pwdinfo->ext_listen_interval); + _set_timer(&pwdinfo->ap_p2p_switch_timer, duration-pwdinfo->ext_listen_interval); + #endif -+ } ++ } + } -+ ++ + ready_on_channel = _TRUE; -+ //pmlmeext->cur_channel = remain_ch; ++ //pmlmeext->cur_channel = remain_ch; + //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20); -+ }else ++ }else +#endif //CONFIG_CONCURRENT_MODE + if(remain_ch != rtw_get_oper_ch(padapter) ) + { + ready_on_channel = _TRUE; -+ //pmlmeext->cur_channel = remain_ch; ++ //pmlmeext->cur_channel = remain_ch; + //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20); + } + } else { + DBG_871X("%s remain_ch:%u not in channel plan!!!!\n", __FUNCTION__, remain_ch); + } -+ ++ + + //call this after other things have been done -+#ifdef CONFIG_CONCURRENT_MODE ++#ifdef CONFIG_CONCURRENT_MODE + if(ATOMIC_READ(&pwdev_priv->ro_ch_to)==1 || + (remain_ch != rtw_get_oper_ch(padapter))) + { @@ -322020,11 +322054,11 @@ index 0000000..ae3ea89 +#endif + + if(ready_on_channel == _TRUE) -+ { ++ { + if ( !check_fwstate(&padapter->mlmepriv, _FW_LINKED ) ) + { + pmlmeext->cur_channel = remain_ch; -+ ++ +#ifdef CONFIG_CONCURRENT_MODE + co_channel = rtw_get_oper_ch(padapter); + @@ -322106,7 +322140,7 @@ index 0000000..ae3ea89 + #endif + { + rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); -+#ifdef CONFIG_DEBUG_CFG80211 ++#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); +#endif + } @@ -322130,7 +322164,7 @@ index 0000000..ae3ea89 + struct rtw_ieee80211_hdr *pwlanhdr; + struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter); + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); -+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); ++ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); +#ifdef CONFIG_P2P + struct wifidirect_info *pwdinfo = &padapter->wdinfo; @@ -322140,8 +322174,8 @@ index 0000000..ae3ea89 + rtw_set_scan_deny(padapter, 1000); + + rtw_scan_abort(padapter); -+ #ifdef CONFIG_CONCURRENT_MODE -+ if(rtw_buddy_adapter_up(padapter)) ++ #ifdef CONFIG_CONCURRENT_MODE ++ if(rtw_buddy_adapter_up(padapter)) + rtw_scan_abort(padapter->pbuddy_adapter); + #endif /* CONFIG_CONCURRENT_MODE */ +#ifdef CONFIG_P2P @@ -322149,27 +322183,27 @@ index 0000000..ae3ea89 + //DBG_8192C("%s, cancel ro ch timer\n", __func__); + //_cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); + //padapter->cfg80211_wdinfo.is_ro_ch = _FALSE; -+ #ifdef CONFIG_CONCURRENT_MODE ++ #ifdef CONFIG_CONCURRENT_MODE + if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED )) + { + DBG_8192C("%s, extend ro ch time\n", __func__); + _set_timer( &padapter->cfg80211_wdinfo.remain_on_ch_timer, pwdinfo->ext_listen_period); -+ } -+ #endif //CONFIG_CONCURRENT_MODE ++ } ++ #endif //CONFIG_CONCURRENT_MODE + } +#endif //CONFIG_P2P +#ifdef CONFIG_CONCURRENT_MODE + if (check_buddy_fwstate(padapter, _FW_LINKED )) { + u8 co_channel=0xff; -+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter; -+ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; ++ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter; ++ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv; + + co_channel = rtw_get_oper_ch(padapter); + + if (tx_ch != pbuddy_mlmeext->cur_channel) { + + u16 ext_listen_period; -+ ++ + if (ATOMIC_READ(&pwdev_priv->switch_ch_to)==1) { + if (check_buddy_fwstate(padapter, WIFI_FW_STATION_STATE)) { + DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__); @@ -322185,15 +322219,15 @@ index 0000000..ae3ea89 + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED )) + { + ext_listen_period = 500;// 500ms -+ } ++ } + else -+ { ++ { + ext_listen_period = pwdinfo->ext_listen_period; + } + + DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, ext_listen_period); -+ _set_timer(&pwdinfo->ap_p2p_switch_timer, ext_listen_period); -+ ++ _set_timer(&pwdinfo->ap_p2p_switch_timer, ext_listen_period); ++ + } + + if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED )) @@ -322201,7 +322235,7 @@ index 0000000..ae3ea89 + + if (tx_ch != co_channel) + set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20); -+ }else ++ }else +#endif //CONFIG_CONCURRENT_MODE + //if (tx_ch != pmlmeext->cur_channel) { + if(tx_ch != rtw_get_oper_ch(padapter)) { @@ -322228,8 +322262,8 @@ index 0000000..ae3ea89 + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; + + _rtw_memcpy(pframe, (void*)buf, len); -+ pattrib->pktlen = len; -+ ++ pattrib->pktlen = len; ++ + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + //update seq number + pmlmeext->mgnt_seq = GetSequence(pwlanhdr); @@ -322239,16 +322273,16 @@ index 0000000..ae3ea89 +#ifdef CONFIG_WFD + { + struct wifi_display_info *pwfd_info; -+ ++ + pwfd_info = padapter->wdinfo.wfd_info; -+ ++ + if ( _TRUE == pwfd_info->wfd_enable ) + { + rtw_append_wfd_ie( padapter, pframe, &pattrib->pktlen ); + } + } +#endif // CONFIG_WFD -+ ++ + pattrib->last_txcmdsz = pattrib->pktlen; + + if (wait_ack) { @@ -322278,9 +322312,9 @@ index 0000000..ae3ea89 + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, ret=%d\n", __func__, ret); + #endif -+ -+ return ret; -+ ++ ++ return ret; ++ +} + +static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, @@ -322358,7 +322392,7 @@ index 0000000..ae3ea89 + DBG_871X(FUNC_ADPT_FMT" len=%zu, ch=%d" + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) + ", ch_type=%d" -+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + ", channel_type_valid=%d" + #endif + #endif @@ -322366,7 +322400,7 @@ index 0000000..ae3ea89 + len, tx_ch + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) + , channel_type -+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + , channel_type_valid + #endif + #endif @@ -322447,7 +322481,7 @@ index 0000000..ae3ea89 + break; + case P2P_INVIT_RESP: + if (pwdev_priv->invit_info.flags & BIT(0) -+ && pwdev_priv->invit_info.status == 0) ++ && pwdev_priv->invit_info.status == 0) + { + DBG_871X(FUNC_ADPT_FMT" agree with invitation of persistent group\n", + FUNC_ADPT_ARG(padapter)); @@ -322456,7 +322490,7 @@ index 0000000..ae3ea89 + rtw_clear_scan_deny(padapter); + } + break; -+ } ++ } + +cancel_ps_deny: + rtw_ps_deny_cancel(padapter, PS_DENY_MGNT_TX); @@ -322546,7 +322580,7 @@ index 0000000..ae3ea89 +#if 1 + DBG_871X("%s %d\n", __FUNCTION__, __LINE__); + DBG_871X("peer:"MAC_FMT", action code:%d, dialog:%d, status code:%d\n", -+ MAC_ARG(txmgmt.peer), txmgmt.action_code, ++ MAC_ARG(txmgmt.peer), txmgmt.action_code, + txmgmt.dialog_token, txmgmt.status_code); + if (txmgmt.len > 0) { + int i=0; @@ -322709,47 +322743,47 @@ index 0000000..ae3ea89 +#endif /* CONFIG_PNO_SUPPORT */ + +static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, int len) -+{ ++{ + int ret = 0; + uint wps_ielen = 0; + u8 *wps_ie; + u32 p2p_ielen = 0; -+ u8 wps_oui[8]={0x0,0x50,0xf2,0x04}; ++ u8 wps_oui[8]={0x0,0x50,0xf2,0x04}; + u8 *p2p_ie; -+ u32 wfd_ielen = 0; ++ u32 wfd_ielen = 0; + u8 *wfd_ie; + _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + + DBG_871X(FUNC_NDEV_FMT" ielen=%d\n", FUNC_NDEV_ARG(ndev), len); -+ ++ + if(len>0) + { + if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) -+ { ++ { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("bcn_wps_ielen=%d\n", wps_ielen); + #endif -+ ++ + if(pmlmepriv->wps_beacon_ie) + { + u32 free_len = pmlmepriv->wps_beacon_ie_len; + pmlmepriv->wps_beacon_ie_len = 0; + rtw_mfree(pmlmepriv->wps_beacon_ie, free_len); -+ pmlmepriv->wps_beacon_ie = NULL; -+ } ++ pmlmepriv->wps_beacon_ie = NULL; ++ } + + pmlmepriv->wps_beacon_ie = rtw_malloc(wps_ielen); + if ( pmlmepriv->wps_beacon_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } -+ ++ + _rtw_memcpy(pmlmepriv->wps_beacon_ie, wps_ie, wps_ielen); + pmlmepriv->wps_beacon_ie_len = wps_ielen; -+ ++ + update_beacon(padapter, _VENDOR_SPECIFIC_IE_, wps_oui, _TRUE); + + } @@ -322763,62 +322797,62 @@ index 0000000..ae3ea89 + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("bcn_p2p_ielen=%d\n", p2p_ielen); + #endif -+ ++ + if(pmlmepriv->p2p_beacon_ie) + { + u32 free_len = pmlmepriv->p2p_beacon_ie_len; + pmlmepriv->p2p_beacon_ie_len = 0; + rtw_mfree(pmlmepriv->p2p_beacon_ie, free_len); -+ pmlmepriv->p2p_beacon_ie = NULL; -+ } ++ pmlmepriv->p2p_beacon_ie = NULL; ++ } + + pmlmepriv->p2p_beacon_ie = rtw_malloc(p2p_ielen); + if ( pmlmepriv->p2p_beacon_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } -+ ++ + _rtw_memcpy(pmlmepriv->p2p_beacon_ie, p2p_ie, p2p_ielen); + pmlmepriv->p2p_beacon_ie_len = p2p_ielen; -+ ++ + } + #endif //CONFIG_P2P -+ ++ + //buf += p2p_ielen; + //len -= p2p_ielen; + + #ifdef CONFIG_WFD -+ if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) ++ if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("bcn_wfd_ielen=%d\n", wfd_ielen); + #endif -+ ++ + if(pmlmepriv->wfd_beacon_ie) + { + u32 free_len = pmlmepriv->wfd_beacon_ie_len; + pmlmepriv->wfd_beacon_ie_len = 0; + rtw_mfree(pmlmepriv->wfd_beacon_ie, free_len); + pmlmepriv->wfd_beacon_ie = NULL; -+ } ++ } + + pmlmepriv->wfd_beacon_ie = rtw_malloc(wfd_ielen); + if ( pmlmepriv->wfd_beacon_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } -+ rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len); ++ rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len); + } + #endif //CONFIG_WFD -+ ++ + pmlmeext->bstart_bss = _TRUE; -+ ++ + } + + return ret; -+ ++ +} + +static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *buf, int len) @@ -322826,28 +322860,28 @@ index 0000000..ae3ea89 + int ret = 0; + uint wps_ielen = 0; + u8 *wps_ie; -+ u32 p2p_ielen = 0; ++ u32 p2p_ielen = 0; + u8 *p2p_ie; -+ u32 wfd_ielen = 0; ++ u32 wfd_ielen = 0; + u8 *wfd_ie; + _adapter *padapter = (_adapter *)rtw_netdev_priv(net); -+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); ++ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + +#ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("%s, ielen=%d\n", __func__, len); +#endif -+ ++ + if(len>0) + { + if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) -+ { ++ { + uint attr_contentlen = 0; + u16 uconfig_method, *puconfig_method = NULL; + -+ #ifdef CONFIG_DEBUG_CFG80211 ++ #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_resp_wps_ielen=%d\n", wps_ielen); + #endif -+ ++ + if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) + { + u8 sr = 0; @@ -322856,69 +322890,69 @@ index 0000000..ae3ea89 + if (sr != 0) + { + DBG_871X("%s, got sr\n", __func__); -+ } ++ } + else -+ { ++ { + DBG_8192C("GO mode process WPS under site-survey, sr no set\n"); + return ret; -+ } -+ } -+ ++ } ++ } ++ + if(pmlmepriv->wps_probe_resp_ie) + { + u32 free_len = pmlmepriv->wps_probe_resp_ie_len; + pmlmepriv->wps_probe_resp_ie_len = 0; + rtw_mfree(pmlmepriv->wps_probe_resp_ie, free_len); -+ pmlmepriv->wps_probe_resp_ie = NULL; -+ } ++ pmlmepriv->wps_probe_resp_ie = NULL; ++ } + + pmlmepriv->wps_probe_resp_ie = rtw_malloc(wps_ielen); + if ( pmlmepriv->wps_probe_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } -+ -+ //add PUSH_BUTTON config_method by driver self in wpsie of probe_resp at GO Mode ++ ++ //add PUSH_BUTTON config_method by driver self in wpsie of probe_resp at GO Mode + if ( (puconfig_method = (u16*)rtw_get_wps_attr_content( wps_ie, wps_ielen, WPS_ATTR_CONF_METHOD , NULL, &attr_contentlen)) != NULL ) + { + //struct registry_priv *pregistrypriv = &padapter->registrypriv; + struct wireless_dev *wdev = padapter->rtw_wdev; -+ -+ #ifdef CONFIG_DEBUG_CFG80211 ++ ++ #ifdef CONFIG_DEBUG_CFG80211 + //printk("config_method in wpsie of probe_resp = 0x%x\n", be16_to_cpu(*puconfig_method)); + #endif -+ ++ + //if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + if(wdev->iftype != NL80211_IFTYPE_P2P_GO) //for WIFI-DIRECT LOGO 4.2.2, AUTO GO can't set PUSH_BUTTON flags + { + uconfig_method = WPS_CM_PUSH_BUTTON; + uconfig_method = cpu_to_be16( uconfig_method ); -+ -+ *puconfig_method |= uconfig_method; -+ } ++ ++ *puconfig_method |= uconfig_method; ++ } + #endif + } -+ ++ + _rtw_memcpy(pmlmepriv->wps_probe_resp_ie, wps_ie, wps_ielen); + pmlmepriv->wps_probe_resp_ie_len = wps_ielen; -+ ++ + } + + //buf += wps_ielen; + //len -= wps_ielen; + + #ifdef CONFIG_P2P -+ if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) ++ if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) + { -+ u8 is_GO = _FALSE; ++ u8 is_GO = _FALSE; + u32 attr_contentlen = 0; + u16 cap_attr=0; + + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_resp_p2p_ielen=%d\n", p2p_ielen); -+ #endif ++ #endif + + //Check P2P Capability ATTR + if( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&cap_attr, (uint*) &attr_contentlen) ) @@ -322927,7 +322961,7 @@ index 0000000..ae3ea89 + //DBG_8192C( "[%s] Got P2P Capability Attr!!\n", __FUNCTION__ ); + cap_attr = le16_to_cpu(cap_attr); + grp_cap = (u8)((cap_attr >> 8)&0xff); -+ ++ + is_GO = (grp_cap&BIT(0)) ? _TRUE:_FALSE; + + if(is_GO) @@ -322942,18 +322976,18 @@ index 0000000..ae3ea89 + u32 free_len = pmlmepriv->p2p_probe_resp_ie_len; + pmlmepriv->p2p_probe_resp_ie_len = 0; + rtw_mfree(pmlmepriv->p2p_probe_resp_ie, free_len); -+ pmlmepriv->p2p_probe_resp_ie = NULL; -+ } ++ pmlmepriv->p2p_probe_resp_ie = NULL; ++ } + + pmlmepriv->p2p_probe_resp_ie = rtw_malloc(p2p_ielen); + if ( pmlmepriv->p2p_probe_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } + _rtw_memcpy(pmlmepriv->p2p_probe_resp_ie, p2p_ie, p2p_ielen); + pmlmepriv->p2p_probe_resp_ie_len = p2p_ielen; -+ } ++ } + else + { + if(pmlmepriv->p2p_go_probe_resp_ie) @@ -322961,54 +322995,54 @@ index 0000000..ae3ea89 + u32 free_len = pmlmepriv->p2p_go_probe_resp_ie_len; + pmlmepriv->p2p_go_probe_resp_ie_len = 0; + rtw_mfree(pmlmepriv->p2p_go_probe_resp_ie, free_len); -+ pmlmepriv->p2p_go_probe_resp_ie = NULL; -+ } ++ pmlmepriv->p2p_go_probe_resp_ie = NULL; ++ } + + pmlmepriv->p2p_go_probe_resp_ie = rtw_malloc(p2p_ielen); + if ( pmlmepriv->p2p_go_probe_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } + _rtw_memcpy(pmlmepriv->p2p_go_probe_resp_ie, p2p_ie, p2p_ielen); + pmlmepriv->p2p_go_probe_resp_ie_len = p2p_ielen; + } -+ ++ + } + #endif //CONFIG_P2P -+ ++ + //buf += p2p_ielen; + //len -= p2p_ielen; + + #ifdef CONFIG_WFD -+ if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) ++ if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) + { + #ifdef CONFIG_DEBUG_CFG80211 + DBG_8192C("probe_resp_wfd_ielen=%d\n", wfd_ielen); + #endif -+ ++ + if(pmlmepriv->wfd_probe_resp_ie) + { + u32 free_len = pmlmepriv->wfd_probe_resp_ie_len; + pmlmepriv->wfd_probe_resp_ie_len = 0; + rtw_mfree(pmlmepriv->wfd_probe_resp_ie, free_len); + pmlmepriv->wfd_probe_resp_ie = NULL; -+ } ++ } + + pmlmepriv->wfd_probe_resp_ie = rtw_malloc(wfd_ielen); + if ( pmlmepriv->wfd_probe_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } -+ rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len); ++ rtw_get_wfd_ie(buf, len, pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len); + } + #endif //CONFIG_WFD -+ ++ + } + + return ret; -+ ++ +} + +static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, char *buf, int len) @@ -323018,7 +323052,7 @@ index 0000000..ae3ea89 + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + + DBG_8192C("%s, ielen=%d\n", __func__, len); -+ ++ + if(len>0) + { + if(pmlmepriv->wps_assoc_resp_ie) @@ -323027,20 +323061,20 @@ index 0000000..ae3ea89 + pmlmepriv->wps_assoc_resp_ie_len = 0; + rtw_mfree(pmlmepriv->wps_assoc_resp_ie, free_len); + pmlmepriv->wps_assoc_resp_ie = NULL; -+ } ++ } + + pmlmepriv->wps_assoc_resp_ie = rtw_malloc(len); + if ( pmlmepriv->wps_assoc_resp_ie == NULL) { + DBG_8192C("%s()-%d: rtw_malloc() ERROR!\n", __FUNCTION__, __LINE__); + return -EINVAL; -+ ++ + } + _rtw_memcpy(pmlmepriv->wps_assoc_resp_ie, buf, len); + pmlmepriv->wps_assoc_resp_ie_len = len; + } + + return ret; -+ ++ +} + +int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, @@ -323058,11 +323092,11 @@ index 0000000..ae3ea89 + #ifdef CONFIG_P2P + || (rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen) && (p2p_ielen>0)) + #endif -+ ) -+ { -+ if (net != NULL) ++ ) ++ { ++ if (net != NULL) + { -+ switch (type) ++ switch (type) + { + case 0x1: //BEACON + ret = rtw_cfg80211_set_beacon_wpsp2pie(net, buf, len); @@ -323073,12 +323107,12 @@ index 0000000..ae3ea89 + case 0x4: //ASSOC_RESP + ret = rtw_cfg80211_set_assoc_resp_wpsp2pie(net, buf, len); + break; -+ } ++ } + } -+ } ++ } + + return ret; -+ ++ +} + +static void rtw_cfg80211_init_ht_capab_ex(_adapter *padapter, struct ieee80211_sta_ht_cap *ht_cap, enum ieee80211_band band, u8 rf_type) @@ -323181,8 +323215,8 @@ index 0000000..ae3ea89 + } else { + rtw_warn_on(1); + DBG_8192C("%s, error rf_type=%d\n", __func__, rf_type); -+ } -+ ++ } ++ +} + +void rtw_cfg80211_init_wiphy(_adapter *padapter) @@ -323191,18 +323225,18 @@ index 0000000..ae3ea89 + struct ieee80211_supported_band *bands; + struct wireless_dev *pwdev = padapter->rtw_wdev; + struct wiphy *wiphy = pwdev->wiphy; -+ ++ + rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + + DBG_8192C("%s:rf_type=%d\n", __func__, rf_type); + -+ if (IsSupported24G(padapter->registrypriv.wireless_mode)) { ++ if (IsSupported24G(padapter->registrypriv.wireless_mode)) { + bands = wiphy->bands[IEEE80211_BAND_2GHZ]; + if(bands) + rtw_cfg80211_init_ht_capab(padapter, &bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type); + } +#ifdef CONFIG_IEEE80211_BAND_5GHZ -+ if (IsSupported5G(padapter->registrypriv.wireless_mode)) { ++ if (IsSupported5G(padapter->registrypriv.wireless_mode)) { + bands = wiphy->bands[IEEE80211_BAND_5GHZ]; + if(bands) + rtw_cfg80211_init_ht_capab(padapter, &bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type); @@ -323251,13 +323285,13 @@ index 0000000..ae3ea89 + wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; + + wiphy->max_scan_ssids = RTW_SSID_SCAN_AMOUNT; -+ wiphy->max_scan_ie_len = RTW_SCAN_IE_LEN_MAX; ++ wiphy->max_scan_ie_len = RTW_SCAN_IE_LEN_MAX; + wiphy->max_num_pmkids = RTW_MAX_NUM_PMKIDS; + -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + wiphy->max_remain_on_channel_duration = RTW_MAX_REMAIN_ON_CHANNEL_DURATION; +#endif -+ ++ + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) + | BIT(NL80211_IFTYPE_ADHOC) +#ifdef CONFIG_AP_MODE @@ -323272,11 +323306,11 @@ index 0000000..ae3ea89 +#endif + ; + -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) +#ifdef CONFIG_AP_MODE + wiphy->mgmt_stypes = rtw_cfg80211_default_mgmt_stypes; -+#endif //CONFIG_AP_MODE -+#endif ++#endif //CONFIG_AP_MODE ++#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)) + #ifdef CONFIG_WIFI_MONITOR @@ -323310,7 +323344,11 @@ index 0000000..ae3ea89 +#endif + +#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) -+ wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0) ++ wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; ++#else //kernel >=4.12 ++ wiphy->max_sched_scan_reqs = 1; ++#endif +#ifdef CONFIG_PNO_SUPPORT + wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; +#endif @@ -323364,7 +323402,7 @@ index 0000000..ae3ea89 + .set_pmksa = cfg80211_rtw_set_pmksa, + .del_pmksa = cfg80211_rtw_del_pmksa, + .flush_pmksa = cfg80211_rtw_flush_pmksa, -+ ++ +#ifdef CONFIG_AP_MODE + .add_virtual_intf = cfg80211_rtw_add_virtual_intf, + .del_virtual_intf = cfg80211_rtw_del_virtual_intf, @@ -323378,7 +323416,7 @@ index 0000000..ae3ea89 + .change_beacon = cfg80211_rtw_change_beacon, + .stop_ap = cfg80211_rtw_stop_ap, + #endif -+ ++ + .add_station = cfg80211_rtw_add_station, + .del_station = cfg80211_rtw_del_station, + .change_station = cfg80211_rtw_change_station, @@ -323388,7 +323426,7 @@ index 0000000..ae3ea89 + .set_channel = cfg80211_rtw_set_channel, + #endif + //.auth = cfg80211_rtw_auth, -+ //.assoc = cfg80211_rtw_assoc, ++ //.assoc = cfg80211_rtw_assoc, +#endif //CONFIG_AP_MODE + +#ifdef CONFIG_P2P @@ -323396,7 +323434,7 @@ index 0000000..ae3ea89 + .cancel_remain_on_channel = cfg80211_rtw_cancel_remain_on_channel, +#endif + -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + .mgmt_tx = cfg80211_rtw_mgmt_tx, + .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, +#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35)) @@ -323483,7 +323521,7 @@ index 0000000..ae3ea89 + struct net_device *pnetdev = padapter->pnetdev; + struct wireless_dev *wdev; + struct rtw_wdev_priv *pwdev_priv; -+ ++ + DBG_8192C("%s(padapter=%p)\n", __func__, padapter); + + /* wdev */ @@ -323497,7 +323535,7 @@ index 0000000..ae3ea89 + wdev->netdev = pnetdev; + + wdev->iftype = NL80211_IFTYPE_STATION; // will be init in rtw_hal_init() -+ // Must sync with _rtw_init_mlme_priv() ++ // Must sync with _rtw_init_mlme_priv() + // pmlmepriv->fw_state = WIFI_STATION_STATE + //wdev->iftype = NL80211_IFTYPE_MONITOR; // for rtw_setopmode_cmd() in cfg80211_rtw_change_iface() + padapter->rtw_wdev = wdev; @@ -323511,22 +323549,22 @@ index 0000000..ae3ea89 + pwdev_priv->padapter = padapter; + pwdev_priv->scan_request = NULL; + _rtw_spinlock_init(&pwdev_priv->scan_req_lock); -+ ++ + pwdev_priv->p2p_enabled = _FALSE; + pwdev_priv->provdisc_req_issued = _FALSE; + rtw_wdev_invit_info_init(&pwdev_priv->invit_info); + rtw_wdev_nego_info_init(&pwdev_priv->nego_info); -+ ++ + pwdev_priv->bandroid_scan = _FALSE; + + if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) + pwdev_priv->power_mgmt = _TRUE; + else + pwdev_priv->power_mgmt = _FALSE; -+ ++ +#ifdef CONFIG_CONCURRENT_MODE -+ ATOMIC_SET(&pwdev_priv->switch_ch_to, 1); -+ ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); ++ ATOMIC_SET(&pwdev_priv->switch_ch_to, 1); ++ ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); +#endif + +exit: diff --git a/patch/kernel/sunxi-next/90-03-add_rtl8189es-experimental-adjustements.patch b/patch/kernel/sunxi-next/90-03-add_rtl8189es-experimental-adjustements.patch deleted file mode 100644 index 36443e670e..0000000000 --- a/patch/kernel/sunxi-next/90-03-add_rtl8189es-experimental-adjustements.patch +++ /dev/null @@ -1,135 +0,0 @@ -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 ae3ea89..f16ad19 ---- a/drivers/net/wireless/rtl8189es/os_dep/linux/ioctl_cfg80211.c -+++ b/drivers/net/wireless/rtl8189es/os_dep/linux/ioctl_cfg80211.c -@@ -694,7 +694,7 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter) - else - { - if(scanned == NULL) -- rtw_warn_on(1); -+ return; - - if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE - && _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE -@@ -796,11 +796,30 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter) - u32 freq; - u16 channel = cur_network->network.Configuration.DSConfig; - -+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) -+ struct cfg80211_roam_info roam_info ={}; -+ #endif -+ - freq = rtw_ch2freq(channel); - notify_channel = ieee80211_get_channel(wiphy, freq); - #endif - - DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); -+ -+ #if LINUX_VERSION_CODE>=KERNEL_VERSION(4,12,0) -+ roam_info.channel = notify_channel; -+ roam_info.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; -+ roam_info.resp_ie_len = -+ pmlmepriv->assoc_rsp_len+sizeof(struct rtw_ieee80211_hdr_3addr) - 6; -+ cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC); -+ #else -+ - cfg80211_roamed(padapter->pnetdev - #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) - , notify_channel -@@ -811,6 +830,7 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter) - , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 - , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 - , GFP_ATOMIC); -+ #endif - } - else - { -@@ -1230,7 +1250,7 @@ _func_enter_; - { - if (param->u.crypt.idx >= WEP_KEYS - #ifdef CONFIG_IEEE80211W -- && param->u.crypt.idx > BIP_MAX_KEYID -+ || param->u.crypt.idx >= BIP_MAX_KEYID - #endif //CONFIG_IEEE80211W - ) - { -@@ -1255,7 +1275,7 @@ _func_enter_; - wep_key_idx = param->u.crypt.idx; - wep_key_len = param->u.crypt.key_len; - -- if ((wep_key_idx > WEP_KEYS) || (wep_key_len <= 0)) -+ if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) - { - ret = -EINVAL; - goto exit; -@@ -1868,7 +1888,10 @@ enum nl80211_iftype { - */ - static int cfg80211_rtw_change_iface(struct wiphy *wiphy, - struct net_device *ndev, -- enum nl80211_iftype type, u32 *flags, -+ enum nl80211_iftype type, -+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) -+ u32 *flags, -+ #endif - struct vif_params *params) - { - enum nl80211_iftype old_type; -@@ -3709,8 +3732,10 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de - - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - -- if (skb) -- rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); -+ if (!skb) -+ goto fail; -+ -+ rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); - - if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) - goto fail; -@@ -3913,7 +3938,12 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct ne - mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; - strncpy(mon_ndev->name, name, IFNAMSIZ); - mon_ndev->name[IFNAMSIZ - 1] = 0; -- mon_ndev->destructor = rtw_ndev_destructor; -+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,9)) -+ mon_ndev->needs_free_netdev = false; -+ mon_ndev->priv_destructor = rtw_ndev_destructor; -+ #else -+ mon_ndev->destructor = rtw_ndev_destructor; -+ #endif - - #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) - mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops; -@@ -3980,7 +4010,11 @@ static int - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)) - unsigned char name_assign_type, - #endif -- enum nl80211_iftype type, u32 *flags, struct vif_params *params) -+ enum nl80211_iftype type, -+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) -+ u32 *flags, -+ #endif -+ struct vif_params *params) - { - int ret = 0; - struct net_device* ndev = NULL; -@@ -6374,7 +6408,11 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) - #endif - - #if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) -- wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0) -+ wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; -+#else //kernel >=4.12 -+ wiphy->max_sched_scan_reqs = 1; -+#endif - #ifdef CONFIG_PNO_SUPPORT - wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; - #endif