diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 5a70488..c0df148 100755 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -74,12 +74,10 @@ #endif /* CONFIG_WAPI_SUPPORT */ -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 11, 12)) #ifdef CONFIG_RTW_80211R #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 #endif -#endif /* * In the current design of Wi-Fi driver, it will return success to the system (e.g. supplicant) @@ -197,138 +195,7 @@ static struct ieee80211_channel rtw_5ghz_a_channels[MAX_CHANNEL_NUM_5G] = { CHAN5G(165, 0), CHAN5G(169, 0), CHAN5G(173, 0), CHAN5G(177, 0), }; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) -static u8 rtw_chbw_to_cfg80211_chan_def(struct wiphy *wiphy, struct cfg80211_chan_def *chdef, u8 ch, u8 bw, u8 offset, u8 ht) -{ - int freq, cfreq; - struct ieee80211_channel *chan; - u8 ret = _FAIL; - - freq = rtw_ch2freq(ch); - if (!freq) - goto exit; - - cfreq = rtw_get_center_ch(ch, bw, offset); - if (!cfreq) - goto exit; - cfreq = rtw_ch2freq(cfreq); - if (!cfreq) - goto exit; - - chan = ieee80211_get_channel(wiphy, freq); - if (!chan) - goto exit; - - if (bw == CHANNEL_WIDTH_20) - chdef->width = ht ? NL80211_CHAN_WIDTH_20 : NL80211_CHAN_WIDTH_20_NOHT; - else if (bw == CHANNEL_WIDTH_40) - chdef->width = NL80211_CHAN_WIDTH_40; - else if (bw == CHANNEL_WIDTH_80) - chdef->width = NL80211_CHAN_WIDTH_80; - else if (bw == CHANNEL_WIDTH_160) - chdef->width = NL80211_CHAN_WIDTH_160; - else { - rtw_warn_on(1); - goto exit; - } - - chdef->chan = chan; - chdef->center_freq1 = cfreq; - chdef->center_freq2 = 0; - - ret = _SUCCESS; - -exit: - return ret; -} - -#ifdef CONFIG_RTW_MESH -static const char *nl80211_chan_width_str(enum nl80211_chan_width cwidth) -{ - switch (cwidth) { - case NL80211_CHAN_WIDTH_20_NOHT: - return "20_NOHT"; - case NL80211_CHAN_WIDTH_20: - return "20"; - case NL80211_CHAN_WIDTH_40: - return "40"; - case NL80211_CHAN_WIDTH_80: - return "80"; - case NL80211_CHAN_WIDTH_80P80: - return "80+80"; - case NL80211_CHAN_WIDTH_160: - return "160"; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) - case NL80211_CHAN_WIDTH_5: - return "5"; - case NL80211_CHAN_WIDTH_10: - return "10"; -#endif - default: - return "INVALID"; - }; -} - -static void rtw_get_chbw_from_cfg80211_chan_def(struct cfg80211_chan_def *chdef, u8 *ht, u8 *ch, u8 *bw, u8 *offset) -{ - int pri_freq; - struct ieee80211_channel *chan = chdef->chan; - - pri_freq = rtw_ch2freq(chan->hw_value); - if (!pri_freq) { - RTW_INFO("invalid channel:%d\n", chan->hw_value); - rtw_warn_on(1); - *ch = 0; - return; - } - - switch (chdef->width) { - case NL80211_CHAN_WIDTH_20_NOHT: - *ht = 0; - *bw = CHANNEL_WIDTH_20; - *offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - *ch = chan->hw_value; - break; - case NL80211_CHAN_WIDTH_20: - *ht = 1; - *bw = CHANNEL_WIDTH_20; - *offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - *ch = chan->hw_value; - break; - case NL80211_CHAN_WIDTH_40: - *ht = 1; - *bw = CHANNEL_WIDTH_40; - *offset = pri_freq > chdef->center_freq1 ? HAL_PRIME_CHNL_OFFSET_UPPER : HAL_PRIME_CHNL_OFFSET_LOWER; - if (rtw_get_offset_by_chbw(chan->hw_value, *bw, offset)) - *ch = chan->hw_value; - break; - case NL80211_CHAN_WIDTH_80: - *ht = 1; - *bw = CHANNEL_WIDTH_80; - if (rtw_get_offset_by_chbw(chan->hw_value, *bw, offset)) - *ch = chan->hw_value; - break; - case NL80211_CHAN_WIDTH_160: - *ht = 1; - *bw = CHANNEL_WIDTH_160; - if (rtw_get_offset_by_chbw(chan->hw_value, *bw, offset)) - *ch = chan->hw_value; - break; - case NL80211_CHAN_WIDTH_80P80: - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) - case NL80211_CHAN_WIDTH_5: - case NL80211_CHAN_WIDTH_10: - #endif - default: - *ht = 0; - *bw = CHANNEL_WIDTH_20; - *offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - RTW_INFO("unsupported cwidth:%s\n", nl80211_chan_width_str(chdef->width)); - rtw_warn_on(1); - }; -} -#endif /* CONFIG_RTW_MESH */ -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) static const char *nl80211_channel_type_str(enum nl80211_channel_type ctype) { switch (ctype) { @@ -406,24 +273,138 @@ static void rtw_get_chbw_from_nl80211_channel_type(struct ieee80211_channel *cha } #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) -bool rtw_cfg80211_allow_ch_switch_notify(_adapter *adapter) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +static const char *nl80211_chan_width_str(enum nl80211_chan_width cwidth) { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)) - if ((!MLME_IS_AP(adapter)) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)) - && (!MLME_IS_ADHOC(adapter)) - && (!MLME_IS_ADHOC_MASTER(adapter)) - && (!MLME_IS_MESH(adapter)) -#elif defined(CONFIG_RTW_MESH) - && (!MLME_IS_MESH(adapter)) + switch (cwidth) { + case NL80211_CHAN_WIDTH_20_NOHT: + return "20_NOHT"; + case NL80211_CHAN_WIDTH_20: + return "20"; + case NL80211_CHAN_WIDTH_40: + return "40"; + case NL80211_CHAN_WIDTH_80: + return "80"; + case NL80211_CHAN_WIDTH_80P80: + return "80+80"; + case NL80211_CHAN_WIDTH_160: + return "160"; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) + case NL80211_CHAN_WIDTH_5: + return "5"; + case NL80211_CHAN_WIDTH_10: + return "10"; #endif - ) - return 0; -#endif - return 1; + default: + return "INVALID"; + }; } +static u8 rtw_chbw_to_cfg80211_chan_def(struct wiphy *wiphy, struct cfg80211_chan_def *chdef, u8 ch, u8 bw, u8 offset, u8 ht) +{ + int freq, cfreq; + struct ieee80211_channel *chan; + u8 ret = _FAIL; + + freq = rtw_ch2freq(ch); + if (!freq) + goto exit; + + cfreq = rtw_get_center_ch(ch, bw, offset); + if (!cfreq) + goto exit; + cfreq = rtw_ch2freq(cfreq); + if (!cfreq) + goto exit; + + chan = ieee80211_get_channel(wiphy, freq); + if (!chan) + goto exit; + + if (bw == CHANNEL_WIDTH_20) + chdef->width = ht ? NL80211_CHAN_WIDTH_20 : NL80211_CHAN_WIDTH_20_NOHT; + else if (bw == CHANNEL_WIDTH_40) + chdef->width = NL80211_CHAN_WIDTH_40; + else if (bw == CHANNEL_WIDTH_80) + chdef->width = NL80211_CHAN_WIDTH_80; + else if (bw == CHANNEL_WIDTH_160) + chdef->width = NL80211_CHAN_WIDTH_160; + else { + rtw_warn_on(1); + goto exit; + } + + chdef->chan = chan; + chdef->center_freq1 = cfreq; + chdef->center_freq2 = 0; + + ret = _SUCCESS; + +exit: + return ret; +} + +static void rtw_get_chbw_from_cfg80211_chan_def(struct cfg80211_chan_def *chdef, u8 *ht, u8 *ch, u8 *bw, u8 *offset) +{ + int pri_freq; + struct ieee80211_channel *chan = chdef->chan; + + pri_freq = rtw_ch2freq(chan->hw_value); + if (!pri_freq) { + RTW_INFO("invalid channel:%d\n", chan->hw_value); + rtw_warn_on(1); + *ch = 0; + return; + } + + switch (chdef->width) { + case NL80211_CHAN_WIDTH_20_NOHT: + *ht = 0; + *bw = CHANNEL_WIDTH_20; + *offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + *ch = chan->hw_value; + break; + case NL80211_CHAN_WIDTH_20: + *ht = 1; + *bw = CHANNEL_WIDTH_20; + *offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + *ch = chan->hw_value; + break; + case NL80211_CHAN_WIDTH_40: + *ht = 1; + *bw = CHANNEL_WIDTH_40; + *offset = pri_freq > chdef->center_freq1 ? HAL_PRIME_CHNL_OFFSET_UPPER : HAL_PRIME_CHNL_OFFSET_LOWER; + if (rtw_get_offset_by_chbw(chan->hw_value, *bw, offset)) + *ch = chan->hw_value; + break; + case NL80211_CHAN_WIDTH_80: + *ht = 1; + *bw = CHANNEL_WIDTH_80; + if (rtw_get_offset_by_chbw(chan->hw_value, *bw, offset)) + *ch = chan->hw_value; + break; + case NL80211_CHAN_WIDTH_160: + *ht = 1; + *bw = CHANNEL_WIDTH_160; + if (rtw_get_offset_by_chbw(chan->hw_value, *bw, offset)) + *ch = chan->hw_value; + break; + case NL80211_CHAN_WIDTH_80P80: + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) + case NL80211_CHAN_WIDTH_5: + case NL80211_CHAN_WIDTH_10: + #endif + default: + *ht = 0; + *bw = CHANNEL_WIDTH_20; + *offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + RTW_INFO("unsupported cwidth:%s\n", nl80211_chan_width_str(chdef->width)); + rtw_warn_on(1); + }; +} +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) */ + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht) { struct wiphy *wiphy = adapter_to_wiphy(adapter); @@ -432,9 +413,6 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) struct cfg80211_chan_def chdef; - if (!rtw_cfg80211_allow_ch_switch_notify(adapter)) - goto exit; - ret = rtw_chbw_to_cfg80211_chan_def(wiphy, &chdef, ch, bw, offset, ht); if (ret != _SUCCESS) goto exit; @@ -445,9 +423,6 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 int freq = rtw_ch2freq(ch); enum nl80211_channel_type ctype; - if (!rtw_cfg80211_allow_ch_switch_notify(adapter)) - goto exit; - if (!freq) { ret = _FAIL; goto exit; @@ -560,7 +535,6 @@ static const struct ieee80211_txrx_stypes [NL80211_IFTYPE_STATION] = { .tx = 0xffff, .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | BIT(IEEE80211_STYPE_PROBE_REQ >> 4) }, [NL80211_IFTYPE_AP] = { @@ -698,7 +672,7 @@ static int rtw_cfg80211_sync_iftype(_adapter *adapter) return _FAIL; } - rtw_set_802_11_infrastructure_mode(adapter, network_type, 0); + rtw_set_802_11_infrastructure_mode(adapter, network_type); rtw_setopmode_cmd(adapter, network_type, RTW_CMDF_WAIT_ACK); } else { rtw_warn_on(1); @@ -712,16 +686,11 @@ static int rtw_cfg80211_sync_iftype(_adapter *adapter) static u64 rtw_get_systime_us(void) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) - return ktime_to_us(ktime_get_boottime()); -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) - struct timespec ts; - get_monotonic_boottime(&ts); - return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) - struct timespec64 ts; +// Fix build error for Linux >= 4.19 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) + struct timespec64 ts; getboottime64(&ts); - return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; + return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; #else struct timeval tv; do_gettimeofday(&tv); @@ -1173,7 +1142,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally struct wifidirect_info *pwdinfo = &(padapter->wdinfo); #endif - RTW_INFO(FUNC_ADPT_FMT" ,reason = %d\n", FUNC_ADPT_ARG(padapter), reason); + RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); /*always replace privated definitions with wifi reserved value 0*/ if (WLAN_REASON_IS_PRIVATE(reason)) @@ -1213,24 +1182,22 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state); if (pwdev->sme_state == CFG80211_SME_CONNECTING) { - RTW_INFO(FUNC_ADPT_FMT" call cfg80211_connect_result, reason:%d\n", FUNC_ADPT_ARG(padapter), reason); + RTW_INFO(FUNC_ADPT_FMT" call cfg80211_connect_result\n", FUNC_ADPT_ARG(padapter)); rtw_cfg80211_connect_result(pwdev, NULL, NULL, 0, NULL, 0, - reason?reason:WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_ATOMIC); + reason, GFP_ATOMIC); } else if (pwdev->sme_state == CFG80211_SME_CONNECTED) { - RTW_INFO(FUNC_ADPT_FMT" call cfg80211_disconnected, reason:%d\n", FUNC_ADPT_ARG(padapter), reason); + RTW_INFO(FUNC_ADPT_FMT" call cfg80211_disconnected\n", FUNC_ADPT_ARG(padapter)); rtw_cfg80211_disconnected(pwdev, reason, NULL, 0, locally_generated, GFP_ATOMIC); } RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state); #else if (pwdev_priv->connect_req) { - RTW_INFO(FUNC_ADPT_FMT" call cfg80211_connect_result, reason:%d\n", FUNC_ADPT_ARG(padapter), reason); + RTW_INFO(FUNC_ADPT_FMT" call cfg80211_connect_result\n", FUNC_ADPT_ARG(padapter)); rtw_cfg80211_connect_result(pwdev, NULL, NULL, 0, NULL, 0, - reason?reason:WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_ATOMIC); + reason, GFP_ATOMIC); } else { - RTW_INFO(FUNC_ADPT_FMT" call cfg80211_disconnected, reason:%d\n", FUNC_ADPT_ARG(padapter), reason); + RTW_INFO(FUNC_ADPT_FMT" call cfg80211_disconnected\n", FUNC_ADPT_ARG(padapter)); rtw_cfg80211_disconnected(pwdev, reason, NULL, 0, locally_generated, GFP_ATOMIC); } #endif @@ -1434,16 +1401,9 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa psta->dot11txpn.val = RTW_GET_LE64(param->u.crypt.seq); psta->dot11rxpn.val = RTW_GET_LE64(param->u.crypt.seq); psta->ieee8021x_blocked = _FALSE; - - if (psta->dot118021XPrivacy != _NO_PRIVACY_) { - psta->bpairwise_key_installed = _TRUE; - - /* WPA2 key-handshake has completed */ - if (psecuritypriv->ndisauthtype == Ndis802_11AuthModeWPA2PSK) - psta->state &= (~WIFI_UNDER_KEY_HANDSHAKE); - } - + psta->bpairwise_key_installed = _TRUE; rtw_ap_set_pairwise_key(padapter, psta); + } else { /* peer's group key, RX only */ #ifdef CONFIG_RTW_MESH @@ -1643,9 +1603,6 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param } #endif /* CONFIG_P2P */ - /* WPA/WPA2 key-handshake has completed */ - clr_fwstate(pmlmepriv, WIFI_UNDER_KEY_HANDSHAKE); - } } @@ -1886,7 +1843,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev if (sta) pn = &sta->dot11txpn.val; #ifdef CONFIG_IEEE80211W - } else if (keyid <= BIP_MAX_KEYID) { + } else if (keyid < BIP_MAX_KEYID) { if (SEC_IS_BIP_KEY_INSTALLED(sec) != _TRUE) goto exit; cipher = _BIP_; @@ -1913,7 +1870,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev cipher = sta->group_privacy; key = &sta->gtk; #ifdef CONFIG_IEEE80211W - } else if (keyid <= BIP_MAX_KEYID && !pairwise) { + } else if (keyid < BIP_MAX_KEYID && !pairwise) { if (!(sta->igtk_bmp & BIT(keyid))) goto exit; cipher = _BIP_; @@ -2230,16 +2187,16 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, psta = rtw_get_stainfo(pstapriv, mac); #ifdef CONFIG_RTW_MESH if (MLME_IS_MESH(padapter)) { - if (psta) - plink = psta->plink; - if (!plink) + if (!psta) plink = rtw_mesh_plink_get(padapter, mac); + else + plink = psta->plink; } #endif /* CONFIG_RTW_MESH */ - if ((!MLME_IS_MESH(padapter) && !psta) + if (!psta #ifdef CONFIG_RTW_MESH - || (MLME_IS_MESH(padapter) && !plink) + && !plink #endif ) { RTW_INFO(FUNC_NDEV_FMT" no sta info for mac="MAC_FMT"\n" @@ -2331,9 +2288,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &(padapter->wdinfo); -#endif -#ifdef CONFIG_MONITOR_MODE_XMIT - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + u8 is_p2p = _FALSE; #endif int ret = 0; u8 change = _FALSE; @@ -2390,13 +2345,20 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, networkType = Ndis802_11IBSS; break; + #if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) + case NL80211_IFTYPE_P2P_CLIENT: + is_p2p = _TRUE; + #endif case NL80211_IFTYPE_STATION: networkType = Ndis802_11Infrastructure; + #ifdef CONFIG_P2P if (change && pwdinfo->driver_interface == DRIVER_CFG80211) { + if (is_p2p == _TRUE) + rtw_p2p_enable(padapter, P2P_ROLE_CLIENT); #if !RTW_P2P_GROUP_INTERFACE - if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) - || rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) + else if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) + || rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) ) { /* it means remove GC/GO and change mode from GC/GO to station(P2P DEVICE) */ rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE); @@ -2404,44 +2366,31 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, #endif } #endif /* CONFIG_P2P */ + break; + #if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) + case NL80211_IFTYPE_P2P_GO: + is_p2p = _TRUE; + #endif case NL80211_IFTYPE_AP: networkType = Ndis802_11APMode; + #ifdef CONFIG_P2P if (change && pwdinfo->driver_interface == DRIVER_CFG80211) { + if (is_p2p == _TRUE) + rtw_p2p_enable(padapter, P2P_ROLE_GO); #if !RTW_P2P_GROUP_INTERFACE - if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { + else if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { /* it means P2P Group created, we will be GO and change mode from P2P DEVICE to AP(GO) */ rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); } #endif } #endif /* CONFIG_P2P */ - break; -#if defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) - case NL80211_IFTYPE_P2P_CLIENT: - networkType = Ndis802_11Infrastructure; - if (change && pwdinfo->driver_interface == DRIVER_CFG80211) { - if (!rtw_p2p_enable(padapter, P2P_ROLE_CLIENT)) { - ret = -EOPNOTSUPP; - goto exit; - } - } break; - case NL80211_IFTYPE_P2P_GO: - networkType = Ndis802_11APMode; - if (change && pwdinfo->driver_interface == DRIVER_CFG80211) { - if (!rtw_p2p_enable(padapter, P2P_ROLE_GO)) { - ret = -EOPNOTSUPP; - goto exit; - } - } - break; -#endif /* defined(CONFIG_P2P) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)) */ - #ifdef CONFIG_RTW_MESH case NL80211_IFTYPE_MESH_POINT: networkType = Ndis802_11_mesh; @@ -2462,17 +2411,14 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, rtw_wdev->iftype = type; - if (rtw_set_802_11_infrastructure_mode(padapter, networkType, 0) == _FALSE) { + if (rtw_set_802_11_infrastructure_mode(padapter, networkType) == _FALSE) { rtw_wdev->iftype = old_type; ret = -EPERM; goto exit; } rtw_setopmode_cmd(padapter, networkType, RTW_CMDF_WAIT_ACK); -#ifdef CONFIG_MONITOR_MODE_XMIT - if (check_fwstate(pmlmepriv, WIFI_MONITOR_STATE) == _TRUE) - rtw_indicate_connect(padapter); -#endif + exit: RTW_INFO(FUNC_NDEV_FMT" ret:%d\n", FUNC_NDEV_ARG(ndev), ret); @@ -2598,8 +2544,6 @@ exit: static void _rtw_cfg80211_surveydone_event_callback(_adapter *padapter, struct cfg80211_scan_request *scan_req) { - struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter); - RT_CHANNEL_INFO *chset = rfctl->channel_set; _irqL irqL; _list *plist, *phead; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -2608,7 +2552,6 @@ static void _rtw_cfg80211_surveydone_event_callback(_adapter *padapter, struct c struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter); struct cfg80211_ssid target_ssid; u8 target_wps_scan = 0; - u8 ch; #ifdef CONFIG_DEBUG_CFG80211 RTW_INFO("%s\n", __func__); @@ -2633,15 +2576,11 @@ static void _rtw_cfg80211_surveydone_event_callback(_adapter *padapter, struct c break; pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); - ch = pnetwork->network.Configuration.DSConfig; /* report network only if the current channel set contains the channel to which this network belongs */ - if (rtw_chset_search_ch(chset, ch) >= 0 - && rtw_mlme_band_check(padapter, ch) == _TRUE + if (rtw_chset_search_ch(adapter_to_chset(padapter), pnetwork->network.Configuration.DSConfig) >= 0 + && rtw_mlme_band_check(padapter, pnetwork->network.Configuration.DSConfig) == _TRUE && _TRUE == rtw_validate_ssid(&(pnetwork->network.Ssid)) - && (!IS_DFS_SLAVE_WITH_RD(rfctl) - || rtw_odm_dfs_domain_unknown(rfctl_to_dvobj(rfctl)) - || !rtw_chset_is_ch_non_ocp(chset, ch)) ) { if (target_wps_scan) rtw_cfg80211_clear_wps_sr_of_non_target_bss(padapter, pnetwork, &target_ssid); @@ -2822,6 +2761,7 @@ exit: void rtw_cfg80211_indicate_scan_done_for_buddy(_adapter *padapter, bool bscan_aborted) { int i; + u8 ret = 0; _adapter *iface = NULL; _irqL irqL; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); @@ -2880,7 +2820,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy _adapter *padapter; struct wireless_dev *wdev; struct rtw_wdev_priv *pwdev_priv; - struct mlme_priv *pmlmepriv = NULL; + struct mlme_priv *pmlmepriv; #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo; #endif /* CONFIG_P2P */ @@ -2921,22 +2861,16 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy if (ssc_chk == SS_DENY_MP_MODE) goto bypass_p2p_chk; -#ifdef DBG_LA_MODE - if (ssc_chk == SS_DENY_LA_MODE) - goto bypass_p2p_chk; -#endif + #ifdef CONFIG_P2P if (pwdinfo->driver_interface == DRIVER_CFG80211) { - if (request->n_ssids && ssids - && _rtw_memcmp(ssids[0].ssid, "DIRECT-", 7) + if (ssids->ssid != NULL + && _rtw_memcmp(ssids->ssid, "DIRECT-", 7) && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL) ) { - if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { - if (!rtw_p2p_enable(padapter, P2P_ROLE_DEVICE)) { - ret = -EOPNOTSUPP; - goto exit; - } - } else { + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + rtw_p2p_enable(padapter, P2P_ROLE_DEVICE); + else { rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); #ifdef CONFIG_DEBUG_CFG80211 RTW_INFO("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); @@ -2966,11 +2900,7 @@ bypass_p2p_chk: case SS_DENY_MP_MODE: ret = -EPERM; goto exit; - #ifdef DBG_LA_MODE - case SS_DENY_LA_MODE: - ret = -EPERM; - goto exit; - #endif + #ifdef CONFIG_RTW_REPEATER_SON case SS_DENY_RSON_SCANING : #endif @@ -3038,8 +2968,8 @@ bypass_p2p_chk: #ifdef CONFIG_P2P if (pwdinfo->driver_interface == DRIVER_CFG80211) { - if (request->n_ssids && ssids - && _rtw_memcmp(ssids[0].ssid, "DIRECT-", 7) + if (ssids->ssid != NULL + && _rtw_memcmp(ssids->ssid, "DIRECT-", 7) && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL) ) { if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -3162,7 +3092,7 @@ bypass_p2p_chk: rtw_init_sitesurvey_parm(padapter, &parm); /* parsing request ssids, n_ssids */ - for (i = 0; i < request->n_ssids && ssids && i < RTW_SSID_SCAN_AMOUNT; i++) { + for (i = 0; i < request->n_ssids && i < RTW_SSID_SCAN_AMOUNT; i++) { #ifdef CONFIG_DEBUG_CFG80211 RTW_INFO("ssid=%s, len=%d\n", ssids[i].ssid, ssids[i].ssid_len); #endif @@ -3171,10 +3101,6 @@ bypass_p2p_chk: } parm.ssid_num = i; - /* no ssid entry, set the scan type as passvie */ - if (request->n_ssids == 0) - parm.scan_mode = SCAN_PASSIVE; - /* parsing channels, n_channels */ for (i = 0; i < request->n_channels && i < RTW_CHANNEL_SCAN_AMOUNT; i++) { #ifdef CONFIG_DEBUG_CFG80211 @@ -3223,14 +3149,13 @@ check_need_indicate_scan_done: #endif } +cancel_ps_deny: if (ps_denied == _TRUE) rtw_ps_deny_cancel(padapter, PS_DENY_SCAN); exit: - if (pmlmepriv) - pmlmepriv->lastscantime = rtw_get_current_time(); - return ret; + } static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed) @@ -3302,7 +3227,6 @@ static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv, { RTW_INFO("%s, nl80211_auth_type=%d\n", __func__, sme_auth_type); - psecuritypriv->auth_type = sme_auth_type; switch (sme_auth_type) { case NL80211_AUTHTYPE_AUTOMATIC: @@ -3330,9 +3254,6 @@ static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv, psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - case NL80211_AUTHTYPE_SAE: - psecuritypriv->auth_alg = WLAN_AUTH_SAE; break; default: psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; @@ -3737,7 +3658,7 @@ static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) rtw_wdev->iftype = NL80211_IFTYPE_STATION; - if (rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure, 0) == _FALSE) { + if (rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure) == _FALSE) { rtw_wdev->iftype = old_type; ret = -EPERM; goto leave_ibss; @@ -3782,7 +3703,7 @@ static int _rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev) #endif RTW_INFO("%s...call rtw_indicate_disconnect\n", __func__); - rtw_free_assoc_resources_cmd(padapter, _TRUE, RTW_CMDF_WAIT_ACK); + rtw_free_assoc_resources_cmd(padapter, _TRUE); /* indicate locally_generated = 0 when suspend */ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)) @@ -3801,38 +3722,6 @@ static int _rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev) return 0; } -#if (KERNEL_VERSION(4, 17, 0) > LINUX_VERSION_CODE) -static bool rtw_check_connect_sae_compat(struct cfg80211_connect_params *sme) -{ - struct rtw_ieee802_11_elems elems; - struct rsne_info info; - u8 AKM_SUITE_SAE[] = { 0x00, 0x0f, 0xac, 8 }; - int i; - - if (sme->auth_type != 1) - return false; - - if (rtw_ieee802_11_parse_elems((u8 *)sme->ie, sme->ie_len, &elems, 0) - == ParseFailed) - return false; - - if (!elems.rsn_ie) - return false; - - if (rtw_rsne_info_parse(elems.rsn_ie - 2, elems.rsn_ie_len + 2, &info) == _FAIL) - return false; - - for (i = 0; i < info.akm_cnt; i++) - if (memcmp(info.akm_list + i * RSN_SELECTOR_LEN, - AKM_SUITE_SAE, RSN_SELECTOR_LEN) == 0) - return true; - - return false; -} -#else -#define rtw_check_connect_sae_compat(sme) false -#endif - static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_connect_params *sme) { @@ -3855,11 +3744,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, RTW_INFO("privacy=%d, key=%p, key_len=%d, key_idx=%d, auth_type=%d\n", sme->privacy, sme->key, sme->key_len, sme->key_idx, sme->auth_type); - if (rtw_check_connect_sae_compat(sme)) { - sme->auth_type = NL80211_AUTHTYPE_SAE; - RTW_INFO("%s set sme->auth_type=4 for SAE compat\n", __FUNCTION__); - } - if (pwdev_priv->block == _TRUE) { ret = -EBUSY; RTW_INFO("%s wdev_priv.block is set\n", __FUNCTION__); @@ -3930,8 +3814,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; /* open system */ psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; - psecuritypriv->auth_alg = WLAN_AUTH_OPEN; - psecuritypriv->extauth_status = WLAN_STATUS_UNSPECIFIED_FAILURE; #ifdef CONFIG_WAPI_SUPPORT padapter->wapiInfo.bWapiEnable = false; @@ -4098,7 +3980,7 @@ static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev, RTW_INFO(FUNC_NDEV_FMT" - Start to Disconnect\n", FUNC_NDEV_ARG(ndev)); #if (RTW_CFG80211_BLOCK_STA_DISCON_EVENT & RTW_CFG80211_BLOCK_DISCON_WHEN_DISCONNECT) - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)) if (!wiphy->dev.power.is_prepared) #endif rtw_wdev_set_not_indic_disco(adapter_wdev_data(padapter), 1); @@ -4192,48 +4074,12 @@ static int cfg80211_rtw_set_power_mgmt(struct wiphy *wiphy, #ifdef CONFIG_LPS if (!enabled) - rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE_CFG80211_PWRMGMT, 0); + rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE_CFG80211_PWRMGMT, 1); #endif return 0; } -static void _rtw_set_pmksa(struct net_device *ndev, - u8 *bssid, u8 *pmkid) -{ - _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); - struct security_priv *psecuritypriv = &padapter->securitypriv; - u8 index, blInserted = _FALSE; - - /* overwrite PMKID */ - for (index = 0 ; index < NUM_PMKID_CACHE; index++) { - if (_rtw_memcmp(psecuritypriv->PMKIDList[index].Bssid, bssid, ETH_ALEN) == _TRUE) { - /* BSSID is matched, the same AP => rewrite with new PMKID. */ - RTW_INFO("BSSID("MAC_FMT") exists in the PMKList.\n", MAC_ARG(bssid)); - - _rtw_memcpy(psecuritypriv->PMKIDList[index].PMKID, pmkid, WLAN_PMKID_LEN); - psecuritypriv->PMKIDList[index].bUsed = _TRUE; - psecuritypriv->PMKIDIndex = index + 1; - blInserted = _TRUE; - break; - } - } - - if (!blInserted) { - /* Find a new entry */ - RTW_INFO("Use the new entry index = %d for this PMKID.\n", - psecuritypriv->PMKIDIndex); - - _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, bssid, ETH_ALEN); - _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pmkid, WLAN_PMKID_LEN); - - psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = _TRUE; - psecuritypriv->PMKIDIndex++ ; - if (psecuritypriv->PMKIDIndex == 16) - psecuritypriv->PMKIDIndex = 0; - } -} - static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_pmksa *pmksa) @@ -4243,7 +4089,6 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, struct mlme_priv *mlme = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; u8 strZeroMacAddress[ETH_ALEN] = { 0x00 }; - bool sae_auth = rtw_sec_chk_auth_type(padapter, NL80211_AUTHTYPE_SAE); RTW_INFO(FUNC_NDEV_FMT" "MAC_FMT" "KEY_FMT"\n", FUNC_NDEV_ARG(ndev) , MAC_ARG(pmksa->bssid), KEY_ARG(pmksa->pmkid)); @@ -4251,17 +4096,39 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, if (_rtw_memcmp((u8 *)pmksa->bssid, strZeroMacAddress, ETH_ALEN) == _TRUE) return -EINVAL; - if (check_fwstate(mlme, _FW_LINKED) == _FALSE && !sae_auth) { + if (check_fwstate(mlme, _FW_LINKED) == _FALSE) { RTW_INFO(FUNC_NDEV_FMT" not set pmksa cause not in linked state\n", FUNC_NDEV_ARG(ndev)); return -EINVAL; } - _rtw_set_pmksa(ndev, (u8 *)pmksa->bssid, (u8 *)pmksa->pmkid); + blInserted = _FALSE; - if (sae_auth && - (psecuritypriv->extauth_status == WLAN_STATUS_SUCCESS)) { - RTW_PRINT("SAE: auth success, start assoc\n"); - start_clnt_assoc(padapter); + /* overwrite PMKID */ + for (index = 0 ; index < NUM_PMKID_CACHE; index++) { + if (_rtw_memcmp(psecuritypriv->PMKIDList[index].Bssid, (u8 *)pmksa->bssid, ETH_ALEN) == _TRUE) { + /* BSSID is matched, the same AP => rewrite with new PMKID. */ + RTW_INFO(FUNC_NDEV_FMT" BSSID exists in the PMKList.\n", FUNC_NDEV_ARG(ndev)); + + _rtw_memcpy(psecuritypriv->PMKIDList[index].PMKID, (u8 *)pmksa->pmkid, WLAN_PMKID_LEN); + psecuritypriv->PMKIDList[index].bUsed = _TRUE; + psecuritypriv->PMKIDIndex = index + 1; + blInserted = _TRUE; + break; + } + } + + if (!blInserted) { + /* Find a new entry */ + RTW_INFO(FUNC_NDEV_FMT" Use the new entry index = %d for this PMKID.\n", + FUNC_NDEV_ARG(ndev), psecuritypriv->PMKIDIndex); + + _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, (u8 *)pmksa->bssid, ETH_ALEN); + _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, (u8 *)pmksa->pmkid, WLAN_PMKID_LEN); + + psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = _TRUE; + psecuritypriv->PMKIDIndex++ ; + if (psecuritypriv->PMKIDIndex == 16) + psecuritypriv->PMKIDIndex = 0; } return 0; @@ -4459,7 +4326,8 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); + if (skb) + rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); if (IS_CH_WAITING(rfctl)) { #ifdef CONFIG_DFS_MASTER @@ -4551,9 +4419,8 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de RTW_INFO("RTW_Tx:%s\n", action_public_str(action)); else RTW_INFO("RTW_Tx:category(%u), action(%u)\n", category, action); -#ifdef CONFIG_P2P + dump: -#endif /* starting alloc mgmt frame to dump it */ pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (pmgntframe == NULL) @@ -4599,12 +4466,11 @@ fail: } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) static void rtw_cfg80211_monitor_if_set_multicast_list(struct net_device *ndev) { RTW_INFO("%s\n", __func__); } -#endif + static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void *addr) { int ret = 0; @@ -4766,17 +4632,6 @@ static int ret = -ENODEV; break; } - - #if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_P2P) - #if defined(CONFIG_P2P) && ((KERNEL_VERSION(2, 6, 37) <= LINUX_VERSION_CODE) || defined(COMPAT_KERNEL_RELEASE)) - if ((type == NL80211_IFTYPE_P2P_CLIENT || type == NL80211_IFTYPE_P2P_GO) && (padapter->iface_id != padapter->registrypriv.sel_p2p_iface)) { - RTW_ERR("%s, iface_id:%d is not P2P interface!\n", __func__, padapter->iface_id); - ret = -EOPNOTSUPP; - break; - } - #endif - #endif - if (rtw_os_ndev_init(padapter, name) != _SUCCESS) { RTW_WARN("ndev init fail!\n"); ret = -ENODEV; @@ -4901,10 +4756,8 @@ static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, co #endif /*CONFIG_FW_HANDLE_TXBCN*/ pbuf = rtw_zmalloc(head_len + tail_len); - if (!pbuf) { - ret = -ENOMEM; - goto exit; - } + if (!pbuf) + return -ENOMEM; /* _rtw_memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); */ @@ -4933,14 +4786,10 @@ static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, co got_p2p_ie = _TRUE; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { + RTW_INFO("Enable P2P function for the first time\n"); + rtw_p2p_enable(adapter, P2P_ROLE_GO); - if (rtw_p2p_enable(adapter, P2P_ROLE_GO)) { - RTW_INFO("Enable P2P function for the first time\n"); - adapter->stapriv.expire_to = 3; /* 3x2 = 6 sec in p2p mode */ - } else { - ret = -EOPNOTSUPP; - goto exit; - } + adapter->stapriv.expire_to = 3; /* 3x2 = 6 sec in p2p mode */ } else { RTW_INFO("enter GO Mode, p2p_ielen=%d\n", p2p_ielen); @@ -4969,9 +4818,8 @@ static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, co } else ret = -EINVAL; -exit: - if (pbuf) - rtw_mfree(pbuf, head_len + tail_len); + + rtw_mfree(pbuf, head_len + tail_len); return ret; } @@ -5018,7 +4866,9 @@ static int cfg80211_rtw_del_beacon(struct wiphy *wiphy, struct net_device *ndev) RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - rtw_stop_ap_cmd(adapter, RTW_CMDF_WAIT_ACK); + rtw_set_802_11_infrastructure_mode(adapter, Ndis802_11Infrastructure); + rtw_setopmode_cmd(adapter, Ndis802_11Infrastructure, RTW_CMDF_WAIT_ACK); + return 0; } #else @@ -5035,14 +4885,6 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev, ret = -ENOTSUPP; goto exit; } - - /* - Kernel < v5.1, the auth_type set as NL80211_AUTHTYPE_AUTOMATIC. - if the AKM SAE in the RSN IE, we have to update the auth_type for SAE - in rtw_check_beacon_data(). - */ - rtw_cfg80211_set_auth_type(&adapter->securitypriv, settings->auth_type); - rtw_mi_scan_abort(adapter, _TRUE); rtw_mi_buddy_set_scan_deny(adapter, 300); ret = rtw_add_beacon(adapter, settings->beacon.head, settings->beacon.head_len, @@ -5093,7 +4935,9 @@ static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - rtw_stop_ap_cmd(adapter, RTW_CMDF_WAIT_ACK); + rtw_set_802_11_infrastructure_mode(adapter, Ndis802_11Infrastructure); + rtw_setopmode_cmd(adapter, Ndis802_11Infrastructure, RTW_CMDF_WAIT_ACK); + return 0; } #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) */ @@ -5224,7 +5068,7 @@ void dump_station_parameters(void *sel, struct wiphy *wiphy, const struct statio for (i = 1; i <= NL80211_STA_FLAG_MAX; i++) { if (params->sta_flags_mask & BIT(i)) { cnt += snprintf(sta_flags_buf + cnt, STA_FLAGS_BUF_LEN - cnt -1, "%s=%u " - , nl80211_sta_flags_str(i), (params->sta_flags_set & BIT(i)) ? 1 : 0); + , nl80211_sta_flags_str(i), (params->sta_flags_set & BIT(i)) >> i); if (cnt >= STA_FLAGS_BUF_LEN - 1) break; } @@ -5348,7 +5192,6 @@ static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev struct mesh_plink_pool *plink_ctl = &minfo->plink_ctl; struct mesh_plink_ent *plink = NULL; struct wlan_network *scanned = NULL; - bool acnode = 0; u8 add_new_sta = 0, probe_req = 0; _irqL irqL; @@ -5378,6 +5221,14 @@ static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev } #endif + /* wpa_supplicant's auto peer will initiate peering when candidate peer is reported without max_peer_links consideration */ + if (plink_ctl->num >= mcfg->max_peer_links) { + RTW_INFO(FUNC_NDEV_FMT" exceed max_peer_links:%u\n" + , FUNC_NDEV_ARG(ndev), mcfg->max_peer_links); + ret = -EINVAL; + goto release_plink_ctl; + } + scanned = rtw_find_network(&padapter->mlmepriv.scanned_queue, mac); if (!scanned || rtw_get_passing_time_ms(scanned->last_scanned) >= mcfg->peer_sel_policy.scanr_exp_ms @@ -5394,20 +5245,7 @@ static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev goto release_plink_ctl; } - #if CONFIG_RTW_MESH_ACNODE_PREVENT - if (plink_ctl->acnode_rsvd) - acnode = rtw_mesh_scanned_is_acnode_confirmed(padapter, scanned); - #endif - - /* wpa_supplicant's auto peer will initiate peering when candidate peer is reported without max_peer_links consideration */ - if (plink_ctl->num >= mcfg->max_peer_links + acnode ? 1 : 0) { - RTW_INFO(FUNC_NDEV_FMT" exceed max_peer_links:%u%s\n" - , FUNC_NDEV_ARG(ndev), mcfg->max_peer_links, acnode ? " acn" : ""); - ret = -EINVAL; - goto release_plink_ctl; - } - - if (!rtw_bss_is_candidate_mesh_peer(&padapter->mlmepriv.cur_network.network, &scanned->network, 1, 1)) { + if (!rtw_bss_is_candidate_mesh_peer(&padapter->mlmepriv.cur_network.network, &scanned->network, 1, 1)){ RTW_WARN(FUNC_NDEV_FMT" corresponding network is not candidate with same ch\n" , FUNC_NDEV_ARG(ndev)); ret = -EINVAL; @@ -5429,13 +5267,6 @@ static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev plink->aid = params->aid; plink->scanned = scanned; - #if CONFIG_RTW_MESH_ACNODE_PREVENT - if (acnode) { - RTW_INFO(FUNC_ADPT_FMT" acnode "MAC_FMT"\n" - , FUNC_ADPT_ARG(padapter), MAC_ARG(scanned->network.MacAddress)); - } - #endif - add_new_sta = 1; } else { RTW_WARN(FUNC_NDEV_FMT" rtw_mesh_plink_add not success\n" @@ -5613,7 +5444,6 @@ static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *n struct mesh_plink_pool *plink_ctl = &minfo->plink_ctl; struct mesh_plink_ent *plink = NULL; _irqL irqL2; - struct sta_info *del_sta = NULL; ret = cfg80211_check_station_change(wiphy, params, sta_type); if (ret) { @@ -5631,32 +5461,6 @@ static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *n plink->plink_state = nl80211_plink_state_to_rtw_plink_state(params->plink_state); - #if CONFIG_RTW_MESH_ACNODE_PREVENT - if (params->plink_state == NL80211_PLINK_OPN_SNT - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) - && (params->sta_modify_mask & STATION_PARAM_APPLY_PLINK_STATE) - #endif - ) { - if (rtw_mesh_scanned_is_acnode_confirmed(adapter, plink->scanned) - && rtw_mesh_acnode_prevent_allow_sacrifice(adapter) - ) { - struct sta_info *sac = rtw_mesh_acnode_prevent_pick_sacrifice(adapter); - - if (sac) { - del_sta = sac; - _enter_critical_bh(&stapriv->asoc_list_lock, &irqL); - if (!rtw_is_list_empty(&del_sta->asoc_list)) { - rtw_list_delete(&del_sta->asoc_list); - stapriv->asoc_list_cnt--; - STA_SET_MESH_PLINK(del_sta, NULL); - } - _exit_critical_bh(&stapriv->asoc_list_lock, &irqL); - RTW_INFO(FUNC_ADPT_FMT" sacrifice "MAC_FMT" for acnode\n" - , FUNC_ADPT_ARG(adapter), MAC_ARG(del_sta->cmn.mac_addr)); - } - } - } else - #endif if ((params->plink_state == NL80211_PLINK_OPN_RCVD || params->plink_state == NL80211_PLINK_CNF_RCVD || params->plink_state == NL80211_PLINK_ESTAB) @@ -5684,37 +5488,29 @@ static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *n && (params->sta_modify_mask & STATION_PARAM_APPLY_PLINK_STATE) #endif ) { - del_sta = rtw_get_stainfo(stapriv, mac); - if (!del_sta) + u8 updated = _FALSE; + + sta = rtw_get_stainfo(stapriv, mac); + if (!sta) goto release_plink_ctl; _enter_critical_bh(&stapriv->asoc_list_lock, &irqL); - if (!rtw_is_list_empty(&del_sta->asoc_list)) { - rtw_list_delete(&del_sta->asoc_list); + if (!rtw_is_list_empty(&sta->asoc_list)) { + rtw_list_delete(&sta->asoc_list); stapriv->asoc_list_cnt--; - STA_SET_MESH_PLINK(del_sta, NULL); + STA_SET_MESH_PLINK(sta, NULL); } _exit_critical_bh(&stapriv->asoc_list_lock, &irqL); + updated = ap_free_sta(adapter, sta, 0, 0, 1); + associated_clients_update(adapter, updated, STA_INFO_UPDATE_ALL); } release_plink_ctl: _exit_critical_bh(&(plink_ctl->lock), &irqL2); - - if (del_sta) { - u8 sta_addr[ETH_ALEN]; - u8 updated = _FALSE; - - _rtw_memcpy(sta_addr, del_sta->cmn.mac_addr, ETH_ALEN); - updated = ap_free_sta(adapter, del_sta, 0, 0, 1); - rtw_mesh_expire_peer(stapriv->padapter, sta_addr); - - associated_clients_update(adapter, updated, STA_INFO_UPDATE_ALL); - } } - -exit: #endif /* CONFIG_RTW_MESH */ +exit: return ret; } @@ -5765,16 +5561,16 @@ static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *nde #ifdef CONFIG_RTW_MESH if (MLME_IS_MESH(padapter)) { - if (psta) - plink = psta->plink; - if (!plink) + if (!psta) plink = rtw_mesh_plink_get_no_estab_by_idx(padapter, idx - asoc_list_num); + else + plink = psta->plink; } #endif /* CONFIG_RTW_MESH */ - if ((!MLME_IS_MESH(padapter) && !psta) + if (!psta #ifdef CONFIG_RTW_MESH - || (MLME_IS_MESH(padapter) && !plink) + && !plink #endif ) { if (DBG_DUMP_STATION) @@ -5826,96 +5622,6 @@ static int cfg80211_rtw_change_bss(struct wiphy *wiphy, struct net_device *ndev, } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) -static int cfg80211_rtw_set_txq_params(struct wiphy *wiphy -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) - , struct net_device *ndev -#endif - , struct ieee80211_txq_params *params) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) - _adapter *padapter = rtw_netdev_priv(ndev); -#else - _adapter *padapter = wiphy_to_adapter(wiphy); -#endif - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 ac, AIFS, ECWMin, ECWMax, aSifsTime; - u16 TXOP; - u8 shift_count = 0; - u32 acParm; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) - ac = params->ac; -#else - ac = params->queue; -#endif - - switch (ac) { - case NL80211_TXQ_Q_VO: - ac = XMIT_VO_QUEUE; - break; - - case NL80211_TXQ_Q_VI: - ac = XMIT_VI_QUEUE; - break; - - case NL80211_TXQ_Q_BE: - ac = XMIT_BE_QUEUE; - break; - - case NL80211_TXQ_Q_BK: - ac = XMIT_BK_QUEUE; - break; - - default: - break; - } - -#if 0 - RTW_INFO("ac=%d\n", ac); - RTW_INFO("txop=%u\n", params->txop); - RTW_INFO("cwmin=%u\n", params->cwmin); - RTW_INFO("cwmax=%u\n", params->cwmax); - RTW_INFO("aifs=%u\n", params->aifs); -#endif - - if (is_supported_5g(pmlmeext->cur_wireless_mode) || - (pmlmeext->cur_wireless_mode & WIRELESS_11_24N)) - aSifsTime = 16; - else - aSifsTime = 10; - - AIFS = params->aifs * pmlmeinfo->slotTime + aSifsTime; - - while ((params->cwmin + 1) >> shift_count != 1) { - shift_count++; - if (shift_count == 15) - break; - } - - ECWMin = shift_count; - - shift_count = 0; - while ((params->cwmax + 1) >> shift_count != 1) { - shift_count++; - if (shift_count == 15) - break; - } - - ECWMax = shift_count; - - TXOP = le16_to_cpu(params->txop); - - acParm = AIFS | (ECWMin << 8) | (ECWMax << 12) | (TXOP << 16); - - set_txq_params_cmd(padapter, acParm, ac); - - return 0; -} -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) */ - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) static int cfg80211_rtw_set_channel(struct wiphy *wiphy #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) , struct net_device *ndev @@ -5962,7 +5668,6 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy return 0; } -#endif /*#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))*/ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) @@ -6062,7 +5767,7 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy return 0; } -/* + static int cfg80211_rtw_auth(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_auth_request *req) { @@ -6078,57 +5783,8 @@ static int cfg80211_rtw_assoc(struct wiphy *wiphy, struct net_device *ndev, return 0; } -*/ #endif /* CONFIG_AP_MODE */ -void rtw_cfg80211_external_auth_request(_adapter *padapter, union recv_frame *rframe) -{ - struct rtw_external_auth_params params; - struct wireless_dev *wdev = padapter->rtw_wdev; - struct net_device *netdev = wdev_to_ndev(wdev); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - u8 frame[256] = { 0 }; - uint frame_len = 24; - s32 freq = 0; - - /* rframe, in this case is null point */ - - freq = rtw_ch2freq(pmlmeext->cur_channel); - -#ifdef CONFIG_DEBUG_CFG80211 - RTW_INFO(FUNC_ADPT_FMT": freq(%d, %d)\n", FUNC_ADPT_ARG(padapter), freq); -#endif - -#if (KERNEL_VERSION(4, 17, 0) <= LINUX_VERSION_CODE) - params.action = EXTERNAL_AUTH_START; - _rtw_memcpy(params.bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN); - params.ssid.ssid_len = pmlmeinfo->network.Ssid.SsidLength; - _rtw_memcpy(params.ssid.ssid, pmlmeinfo->network.Ssid.Ssid, - pmlmeinfo->network.Ssid.SsidLength); - params.key_mgmt_suite = 0x8ac0f00; - - cfg80211_external_auth_request(netdev, - (struct cfg80211_external_auth_params *)¶ms, GFP_ATOMIC); -#elif (KERNEL_VERSION(2, 6, 37) <= LINUX_VERSION_CODE) - set_frame_sub_type(frame, WIFI_AUTH); - - _rtw_memcpy(frame + 4, get_my_bssid(&pmlmeinfo->network), ETH_ALEN); - _rtw_memcpy(frame + 10, adapter_mac_addr(padapter), ETH_ALEN); - _rtw_memcpy(frame + 16, get_my_bssid(&pmlmeinfo->network), ETH_ALEN); - RTW_PUT_LE32((frame + 18), 0x8ac0f00); - - if (pmlmeinfo->network.Ssid.SsidLength) { - *(frame + 23) = pmlmeinfo->network.Ssid.SsidLength; - _rtw_memcpy(frame + 24, pmlmeinfo->network.Ssid.Ssid, - pmlmeinfo->network.Ssid.SsidLength); - frame_len = 24 + pmlmeinfo->network.Ssid.SsidLength; - } - rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC); -#endif -} - void rtw_cfg80211_rx_probe_request(_adapter *adapter, union recv_frame *rframe) { struct wireless_dev *wdev = adapter->rtw_wdev; @@ -6174,9 +5830,9 @@ void rtw_cfg80211_rx_action_p2p(_adapter *adapter, union recv_frame *rframe) #endif rtw_action_frame_parse(frame, frame_len, &category, &action); RTW_INFO("RTW_Rx:category(%u), action(%u)\n", category, action); -#ifdef CONFIG_P2P + indicate: -#endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC); #else @@ -6228,7 +5884,6 @@ void rtw_cfg80211_rx_p2p_action_public(_adapter *adapter, union recv_frame *rfra break; case P2P_PROVISION_DISC_RESP: case P2P_INVIT_RESP: - rtw_clear_scan_deny(adapter); #if !RTW_P2P_GROUP_INTERFACE rtw_mi_buddy_set_scan_deny(adapter, 2000); #endif @@ -6239,9 +5894,8 @@ void rtw_cfg80211_rx_p2p_action_public(_adapter *adapter, union recv_frame *rfra #endif rtw_action_frame_parse(frame, frame_len, &category, &action); RTW_INFO("RTW_Rx:category(%u), action(%u)\n", category, action); -#ifdef CONFIG_P2P + indicate: -#endif #if defined(RTW_DEDICATED_P2P_DEVICE) if (rtw_cfg80211_redirect_pd_wdev(dvobj_to_wiphy(dvobj), get_ra(frame), &wdev)) if (0) @@ -6285,10 +5939,8 @@ void rtw_cfg80211_rx_action(_adapter *adapter, union recv_frame *rframe, const c rtw_mi_scan_abort(adapter, _FALSE); /*rtw_scan_abort_no_wait*/ } } -#ifdef CONFIG_RTW_MESH -indicate: -#endif +indicate: #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC); #else @@ -6343,7 +5995,10 @@ void rtw_cfg80211_rx_mframe(_adapter *adapter, union recv_frame *rframe, const c #endif RTW_INFO("RTW_Rx:ch=%d(%d), ta="MAC_FMT"\n", ch, sch, MAC_ARG(get_addr2_ptr(frame))); - if (!rtw_sae_preprocess(adapter, frame, frame_len, _FALSE)) { + #ifdef CONFIG_RTW_MESH + if (!rtw_sae_check_frames(adapter, frame, frame_len, _FALSE)) + #endif + { if (msg) RTW_INFO("RTW_Rx:%s\n", msg); else @@ -6734,11 +6389,7 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, } /* if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) */ - if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) - #if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_P2P) - && ((padapter->iface_id == padapter->registrypriv.sel_p2p_iface)) - #endif - ) { + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { rtw_p2p_enable(padapter, P2P_ROLE_DEVICE); padapter->wdinfo.listen_channel = remain_ch; RTW_INFO(FUNC_ADPT_FMT" init listen_channel %u\n" @@ -6885,11 +6536,10 @@ inline int rtw_cfg80211_is_p2p_scan(_adapter *adapter) _enter_critical_bh(&wdev_data->scan_req_lock, &irqL); if (wdev_data->scan_request - && wdev_data->scan_request->n_ssids && wdev_data->scan_request->ssids && wdev_data->scan_request->ie ) { - if (_rtw_memcmp(wdev_data->scan_request->ssids[0].ssid, "DIRECT-", 7) + if (_rtw_memcmp(wdev_data->scan_request->ssids->ssid, "DIRECT-", 7) && rtw_get_p2p_ie((u8 *)wdev_data->scan_request->ie, wdev_data->scan_request->ie_len, NULL, NULL)) is_p2p_scan = 1; } @@ -7110,9 +6760,8 @@ static int _cfg80211_rtw_mgmt_tx(_adapter *padapter, u8 tx_ch, u8 no_cck, const if (tx_ch != rtw_get_oper_ch(padapter)) set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20); -#ifdef CONFIG_MCC_MODE + issue_mgmt_frame: -#endif /* starting alloc mgmt frame to dump it */ pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (pmgntframe == NULL) { @@ -7367,19 +7016,15 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, wait_ack = 0; goto dump; } +#ifdef CONFIG_RTW_MESH else if (frame_styp == RTW_IEEE80211_STYPE_AUTH) { - int retval = 0; - RTW_INFO("RTW_Tx:tx_ch=%d, no_cck=%u, da="MAC_FMT"\n", tx_ch, no_cck, MAC_ARG(GetAddr1Ptr(buf))); - - retval = rtw_sae_preprocess(padapter, buf, len, _TRUE); - if (retval == 2) - goto exit; - if (retval == 0) + if (!rtw_sae_check_frames(padapter, buf, len, _TRUE)) RTW_INFO("RTW_Tx:AUTH\n"); dump_limit = 1; goto dump; } +#endif if (rtw_action_frame_parse(buf, len, &category, &action) == _FALSE) { RTW_INFO(FUNC_ADPT_FMT" frame_control:0x%02x\n", FUNC_ADPT_ARG(padapter), @@ -7477,7 +7122,6 @@ dump: if (pwdev_priv->invit_info.flags & BIT(0) && pwdev_priv->invit_info.status == 0 ) { - rtw_clear_scan_deny(padapter); RTW_INFO(FUNC_ADPT_FMT" agree with invitation of persistent group\n", FUNC_ADPT_ARG(padapter)); #if !RTW_P2P_GROUP_INTERFACE @@ -7525,27 +7169,16 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, frame_type, reg); #endif + /* Wait QC Verify */ + return; + switch (frame_type) { - case IEEE80211_STYPE_AUTH: /* 0x00B0 */ - if (reg > 0) - SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_AUTH, reg); - else - CLR_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_AUTH, reg); - break; -#ifdef not_yet case IEEE80211_STYPE_PROBE_REQ: /* 0x0040 */ - if (reg > 0) - SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_PROBE_REQ, reg); - else - CLR_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_PROBE_REQ, reg); + SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_PROBE_REQ, reg); break; case IEEE80211_STYPE_ACTION: /* 0x00D0 */ - if (reg > 0) - SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_ACTION, reg); - else - CLR_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_ACTION, reg); + SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_ACTION, reg); break; -#endif default: break; } @@ -7678,7 +7311,7 @@ static int cfg80211_rtw_tdls_oper(struct wiphy *wiphy, } #ifdef CONFIG_LPS - rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 0); + rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1); #endif /* CONFIG_LPS */ _rtw_memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt)); @@ -8391,13 +8024,7 @@ static int cfg80211_rtw_update_mesh_config(struct wiphy *wiphy, struct net_devic RTW_INFO(FUNC_ADPT_FMT" mask:0x%08x\n", FUNC_ADPT_ARG(adapter), mask); rtw_cfg80211_mesh_cfg_set(adapter, nconf, mask); - update_beacon(adapter, WLAN_EID_MESH_CONFIG, NULL, _TRUE, 0); -#if CONFIG_RTW_MESH_CTO_MGATE_CARRIER - if (rtw_mesh_cto_mgate_required(adapter)) - rtw_netif_carrier_off(adapter->pnetdev); - else - rtw_netif_carrier_on(adapter->pnetdev); -#endif + update_beacon(adapter, WLAN_EID_MESH_CONFIG, NULL, _TRUE); need_work = rtw_ieee80211_mesh_root_setup(adapter); rtw_mbss_info_change_notify(adapter, minfo_changed, need_work); @@ -8474,7 +8101,7 @@ static int cfg80211_rtw_leave_mesh(struct wiphy *wiphy, struct net_device *dev) rtw_mesh_deinit_mesh_info(adapter); - rtw_set_802_11_infrastructure_mode(adapter, Ndis802_11Infrastructure, 0); + rtw_set_802_11_infrastructure_mode(adapter, Ndis802_11Infrastructure); rtw_setopmode_cmd(adapter, Ndis802_11Infrastructure, RTW_CMDF_WAIT_ACK); return ret; @@ -8893,7 +8520,7 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, _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, RTW_CMDF_WAIT_ACK); + update_beacon(padapter, _VENDOR_SPECIFIC_IE_, wps_oui, _TRUE); } @@ -9264,6 +8891,7 @@ static void rtw_cfg80211_init_ht_capab(_adapter *padapter , struct ieee80211_sta_ht_cap *ht_cap, BAND_TYPE band, u8 rf_type) { struct registry_priv *regsty = &padapter->registrypriv; + struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter); u8 rx_nss = 0; if (!regsty->ht_enable || !is_supported_ht(regsty->wireless_mode)) @@ -9287,7 +8915,7 @@ static void rtw_cfg80211_init_ht_capab(_adapter *padapter ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - rx_nss = GET_HAL_RX_NSS(padapter); + rx_nss = rtw_min(rf_type_to_rf_rx_cnt(rf_type), hal_spec->rx_nss_num); switch (rx_nss) { case 1: ht_cap->mcs.rx_mask[0] = 0xFF; @@ -9309,11 +8937,12 @@ static void rtw_cfg80211_init_ht_capab(_adapter *padapter break; default: rtw_warn_on(1); - RTW_INFO("%s, error rf_type=%d, rx_nss=%d\n", __func__, rf_type, rx_nss); + RTW_INFO("%s, error rf_type=%d\n", __func__, rf_type); }; ht_cap->mcs.rx_highest = cpu_to_le16( - rtw_ht_mcs_rate(hal_is_bw_support(padapter, CHANNEL_WIDTH_40) + rtw_mcs_rate(rf_type + , hal_is_bw_support(padapter, CHANNEL_WIDTH_40) , hal_is_bw_support(padapter, CHANNEL_WIDTH_40) ? ht_cap->cap & IEEE80211_HT_CAP_SGI_40 : ht_cap->cap & IEEE80211_HT_CAP_SGI_20 , ht_cap->mcs.rx_mask) / 10); } @@ -9355,7 +8984,8 @@ void rtw_cfg80211_init_wiphy(_adapter *padapter) struct wireless_dev *pwdev = padapter->rtw_wdev; struct wiphy *wiphy = pwdev->wiphy; - rf_type = GET_HAL_RFPATH(padapter); + rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + RTW_INFO("%s:rf_type=%d\n", __func__, rf_type); if (IsSupported24G(padapter->registrypriv.wireless_mode)) { @@ -9470,13 +9100,6 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) #endif ; -#if !defined(RTW_SINGLE_WIPHY) && defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_P2P) - if (adapter->iface_id != adapter->registrypriv.sel_p2p_iface) { - wiphy->interface_modes &= ~(BIT(NL80211_IFTYPE_P2P_GO) | BIT(NL80211_IFTYPE_P2P_CLIENT)); - RTW_INFO("%s iface_id:%d- don't set p2p capability\n", __func__, adapter->iface_id); - } -#endif - #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; @@ -9570,10 +9193,6 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) ; #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) */ #endif /* CONFIG_RTW_MESH */ - -#if (KERNEL_VERSION(3, 8, 0) <= LINUX_VERSION_CODE) - wiphy->features |= NL80211_FEATURE_SAE; -#endif } #ifdef CONFIG_RFKILL_POLL @@ -9747,94 +9366,6 @@ int rtw_hostapd_acs_dump_survey(struct wiphy *wiphy, struct net_device *netdev, } #endif /* defined(CONFIG_RTW_HOSTAPD_ACS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) */ -#if (KERNEL_VERSION(4, 17, 0) <= LINUX_VERSION_CODE) -int cfg80211_rtw_external_auth(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_external_auth_params *params) -{ - PADAPTER padapter = (_adapter *)rtw_netdev_priv(dev); - - RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(dev)); - - rtw_cfg80211_external_auth_status(wiphy, dev, - (struct rtw_external_auth_params *)params); - - return 0; -} -#endif - -void rtw_cfg80211_external_auth_status(struct wiphy *wiphy, struct net_device *dev, - struct rtw_external_auth_params *params) -{ - PADAPTER padapter = (_adapter *)rtw_netdev_priv(dev); - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta = NULL; - u8 *buf = NULL; - u32 len = 0; - _irqL irqL; - - RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(dev)); - - RTW_INFO("SAE: action: %u, status: %u\n", params->action, params->status); - if (params->status == WLAN_STATUS_SUCCESS) { - RTW_INFO("bssid: "MAC_FMT"\n", MAC_ARG(params->bssid)); - RTW_INFO("SSID: [%s]\n", - ((params->ssid.ssid_len == 0) ? "" : (char *)params->ssid.ssid)); - RTW_INFO("suite: 0x%08x\n", params->key_mgmt_suite); - } - - psta = rtw_get_stainfo(pstapriv, params->bssid); - if (psta && (params->status == WLAN_STATUS_SUCCESS)) { - /* AP mode */ - RTW_INFO("station match\n"); - - psta->state &= ~WIFI_FW_AUTH_NULL; - psta->state |= WIFI_FW_AUTH_SUCCESS; - psta->expire_to = padapter->stapriv.assoc_to; - - /* ToDo: Kernel v5.1 pmkid is pointer */ - /* RTW_INFO_DUMP("PMKID:", params->pmkid, PMKID_LEN); */ - _rtw_set_pmksa(dev, params->bssid, params->pmkid); - - _enter_critical_bh(&psta->lock, &irqL); - if ((psta->auth_len != 0) && (psta->pauth_frame != NULL)) { - buf = rtw_zmalloc(psta->auth_len); - if (buf) { - _rtw_memcpy(buf, psta->pauth_frame, psta->auth_len); - len = psta->auth_len; - } - - rtw_mfree(psta->pauth_frame, psta->auth_len); - psta->pauth_frame = NULL; - psta->auth_len = 0; - } - _exit_critical_bh(&psta->lock, &irqL); - - if (buf) { - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - /* send the SAE auth Confirm */ - - rtw_ps_deny(padapter, PS_DENY_MGNT_TX); - if (_SUCCESS == rtw_pwr_wakeup(padapter)) { - rtw_mi_set_scan_deny(padapter, 1000); - rtw_mi_scan_abort(padapter, _TRUE); - - RTW_INFO("SAE: Tx auth Confirm\n"); - rtw_mgnt_tx_cmd(padapter, pmlmeext->cur_channel, 1, buf, len, 0, RTW_CMDF_DIRECTLY); - - } - rtw_ps_deny_cancel(padapter, PS_DENY_MGNT_TX); - - rtw_mfree(buf, len); - buf = NULL; - len = 0; - } - } else { - /* STA mode */ - psecuritypriv->extauth_status = params->status; - } -} - static struct cfg80211_ops rtw_cfg80211_ops = { .change_virtual_intf = cfg80211_rtw_change_iface, .add_key = cfg80211_rtw_add_key, @@ -9884,9 +9415,6 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .change_station = cfg80211_rtw_change_station, .dump_station = cfg80211_rtw_dump_station, .change_bss = cfg80211_rtw_change_bss, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) - .set_txq_params = cfg80211_rtw_set_txq_params, -#endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) .set_channel = cfg80211_rtw_set_channel, #endif @@ -9951,9 +9479,6 @@ static struct cfg80211_ops rtw_cfg80211_ops = { #if defined(CONFIG_RTW_HOSTAPD_ACS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) .dump_survey = rtw_hostapd_acs_dump_survey, #endif -#if (KERNEL_VERSION(4, 17, 0) <= LINUX_VERSION_CODE) - .external_auth = cfg80211_rtw_external_auth, -#endif }; struct wiphy *rtw_wiphy_alloc(_adapter *padapter, struct device *dev) @@ -10227,12 +9752,14 @@ int rtw_cfg80211_dev_res_alloc(struct dvobj_priv *dvobj) wiphy = rtw_wiphy_alloc(dvobj_get_primary_adapter(dvobj), dev); if (wiphy == NULL) - return ret; + goto exit; dvobj->wiphy = wiphy; #endif ret = _SUCCESS; + +exit: return ret; } @@ -10250,7 +9777,7 @@ int rtw_cfg80211_dev_res_register(struct dvobj_priv *dvobj) #if defined(RTW_SINGLE_WIPHY) if (rtw_wiphy_register(dvobj_to_wiphy(dvobj)) != 0) - return ret; + goto exit; #ifdef CONFIG_RFKILL_POLL rtw_cfg80211_init_rfkill(dvobj_to_wiphy(dvobj)); @@ -10259,6 +9786,7 @@ int rtw_cfg80211_dev_res_register(struct dvobj_priv *dvobj) ret = _SUCCESS; +exit: return ret; } diff --git a/os_dep/linux/rtw_proc.c b/os_dep/linux/rtw_proc.c index 6560355..370bd5a 100755 --- a/os_dep/linux/rtw_proc.c +++ b/os_dep/linux/rtw_proc.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright(c) 2007 - 2019 Realtek Corporation. + * Copyright(c) 2007 - 2017 Realtek Corporation. * * 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 @@ -45,25 +45,6 @@ inline struct proc_dir_entry *get_rtw_drv_proc(void) #define get_proc_net init_net.proc_net #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)) -int single_open_size(struct file *file, int (*show)(struct seq_file *, void *), - void *data, size_t size) -{ - char *buf = kmalloc(size, GFP_KERNEL); - int ret; - if (!buf) - return -ENOMEM; - ret = single_open(file, show, data); - if (ret) { - kfree(buf); - return ret; - } - ((struct seq_file *)file->private_data)->buf = buf; - ((struct seq_file *)file->private_data)->size = size; - return 0; -} -#endif - inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_dir_entry *parent, void *data) { struct proc_dir_entry *entry; @@ -81,8 +62,7 @@ inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_ } inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent, - /*const struct file_operations *fops, void * data)*/ - const rtw_proc_op_t *fops, void * data) + const rtw_proc_op_t *fops, void * data) { struct proc_dir_entry *entry; @@ -180,12 +160,6 @@ static int proc_get_chplan_test(struct seq_file *m, void *v) return 0; } -static int proc_get_chplan_ver(struct seq_file *m, void *v) -{ - dump_chplan_ver(m); - return 0; -} - #ifdef RTW_HALMAC extern void rtw_halmac_get_version(char *str, u32 len); @@ -215,7 +189,6 @@ const struct rtw_proc_hdl drv_proc_hdls[] = { RTW_PROC_HDL_SSEQ("country_chplan_map", proc_get_country_chplan_map, NULL), RTW_PROC_HDL_SSEQ("chplan_id_list", proc_get_chplan_id_list, NULL), RTW_PROC_HDL_SSEQ("chplan_test", proc_get_chplan_test, NULL), - RTW_PROC_HDL_SSEQ("chplan_ver", proc_get_chplan_ver, NULL), #ifdef RTW_HALMAC RTW_PROC_HDL_SSEQ("halmac_info", proc_get_halmac_info, NULL), #endif /* RTW_HALMAC */ @@ -241,10 +214,6 @@ static int rtw_drv_proc_open(struct inode *inode, struct file *file) int (*show)(struct seq_file *, void *) = hdl->u.show ? hdl->u.show : proc_get_dummy; return single_open(file, show, private); - } else if (hdl->type == RTW_PROC_HDL_TYPE_SZSEQ) { - int (*show)(struct seq_file *, void *) = hdl->u.sz.show ? hdl->u.sz.show : proc_get_dummy; - - return single_open_size(file, show, private, hdl->u.sz.size); } else { return -EROFS; } @@ -262,14 +231,13 @@ static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer, return -EROFS; } -/* static const struct file_operations rtw_drv_proc_seq_fops = { */ static const rtw_proc_op_t rtw_drv_proc_seq_fops = { #ifdef HAVE_PROC_OPS_STRUCT - .proc_open = rtw_drv_proc_open, - .proc_read = seq_read, - .proc_lseek = seq_lseek, - .proc_release = seq_release, - .proc_write = rtw_drv_proc_write, + .proc_open = rtw_drv_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = seq_release, + .proc_write = rtw_drv_proc_write, #else .owner = THIS_MODULE, .open = rtw_drv_proc_open, @@ -280,7 +248,6 @@ static const rtw_proc_op_t rtw_drv_proc_seq_fops = { #endif }; -/* static const struct file_operations rtw_drv_proc_sseq_fops = { */ static const rtw_proc_op_t rtw_drv_proc_sseq_fops = { #ifdef HAVE_PROC_OPS_STRUCT .proc_open = rtw_drv_proc_open, @@ -319,8 +286,7 @@ int rtw_drv_proc_init(void) for (i = 0; i < drv_proc_hdls_num; i++) { if (drv_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SEQ) entry = rtw_proc_create_entry(drv_proc_hdls[i].name, rtw_proc, &rtw_drv_proc_seq_fops, (void *)i); - else if (drv_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ || - drv_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SZSEQ) + else if (drv_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ) entry = rtw_proc_create_entry(drv_proc_hdls[i].name, rtw_proc, &rtw_drv_proc_sseq_fops, (void *)i); else entry = NULL; @@ -442,134 +408,6 @@ static int proc_get_sdio_card_info(struct seq_file *m, void *v) return 0; } - -#ifdef DBG_SDIO -static int proc_get_sdio_dbg(struct seq_file *m, void *v) -{ - struct net_device *dev; - struct _ADAPTER *a; - struct dvobj_priv *d; - struct sdio_data *sdio; - - - dev = m->private; - a = (struct _ADAPTER *)rtw_netdev_priv(dev); - d = adapter_to_dvobj(a); - sdio = &d->intf_data; - - dump_sdio_card_info(m, d); - - RTW_PRINT_SEL(m, "CMD52 error cnt: %d\n", sdio->cmd52_err_cnt); - RTW_PRINT_SEL(m, "CMD53 error cnt: %d\n", sdio->cmd53_err_cnt); - -#if (DBG_SDIO >= 3) - RTW_PRINT_SEL(m, "dbg: %s\n", sdio->dbg_enable?"enable":"disable"); - RTW_PRINT_SEL(m, "err_stop: %s\n", sdio->err_stop?"enable":"disable"); - RTW_PRINT_SEL(m, "err_test: %s\n", sdio->err_test?"enable":"disable"); - RTW_PRINT_SEL(m, "err_test_triggered: %s\n", - sdio->err_test_triggered?"yes":"no"); -#endif /* DBG_SDIO >= 3 */ - -#if (DBG_SDIO >= 2) - RTW_PRINT_SEL(m, "I/O error dump mark: %d\n", sdio->reg_dump_mark); - if (sdio->reg_dump_mark) { - if (sdio->dbg_msg) - RTW_PRINT_SEL(m, "debug messages: %s\n", sdio->dbg_msg); - if (sdio->reg_mac) - RTW_BUF_DUMP_SEL(_DRV_ALWAYS_, m, "MAC register:", - _TRUE, sdio->reg_mac, 0x800); - if (sdio->reg_mac_ext) - RTW_BUF_DUMP_SEL(_DRV_ALWAYS_, m, "MAC EXT register:", - _TRUE, sdio->reg_mac_ext, 0x800); - if (sdio->reg_local) - RTW_BUF_DUMP_SEL(_DRV_ALWAYS_, m, "SDIO Local register:", - _TRUE, sdio->reg_local, 0x100); - if (sdio->reg_cia) - RTW_BUF_DUMP_SEL(_DRV_ALWAYS_, m, "SDIO CIA register:", - _TRUE, sdio->reg_cia, 0x200); - } -#endif /* DBG_SDIO >= 2 */ - - return 0; -} - -#if (DBG_SDIO >= 2) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) -#define strnicmp strncasecmp -#endif /* Linux kernel >= 4.0.0 */ -void rtw_sdio_dbg_reg_free(struct dvobj_priv *d); -#endif /* DBG_SDIO >= 2 */ - -ssize_t proc_set_sdio_dbg(struct file *file, const char __user *buffer, - size_t count, loff_t *pos, void *data) -{ -#if (DBG_SDIO >= 2) - struct net_device *dev = data; - struct dvobj_priv *d; - struct _ADAPTER *a; - struct sdio_data *sdio; - char tmp[32], cmd[32] = {0}; - int num; - - - if (count < 1) - return -EFAULT; - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - a = (struct _ADAPTER *)rtw_netdev_priv(dev); - d = adapter_to_dvobj(a); - sdio = &d->intf_data; - - if (buffer && !copy_from_user(tmp, buffer, count)) { - num = sscanf(tmp, "%s", cmd); - - if (num >= 1) { - if (strnicmp(cmd, "reg_reset", 10) == 0) { - sdio->reg_dump_mark = 0; - goto exit; - } - if (strnicmp(cmd, "reg_free", 9) == 0) { - rtw_sdio_dbg_reg_free(d); - sdio->reg_dump_mark = 0; - goto exit; - } -#if (DBG_SDIO >= 3) - if (strnicmp(cmd, "dbg_enable", 11) == 0) { - sdio->dbg_enable = 1; - goto exit; - } - if (strnicmp(cmd, "dbg_disable", 12) == 0) { - sdio->dbg_enable = 0; - goto exit; - } - if (strnicmp(cmd, "err_stop", 9) == 0) { - sdio->err_stop = 1; - goto exit; - } - if (strnicmp(cmd, "err_stop_disable", 16) == 0) { - sdio->err_stop = 0; - goto exit; - } - if (strnicmp(cmd, "err_test", 9) == 0) { - sdio->err_test_triggered = 0; - sdio->err_test = 1; - goto exit; - } -#endif /* DBG_SDIO >= 3 */ - } - - return -EINVAL; - } - -exit: -#endif /* DBG_SDIO >= 2 */ - return count; -} -#endif /* DBG_SDIO */ #endif /* CONFIG_SDIO_HCI */ static int proc_get_fw_info(struct seq_file *m, void *v) @@ -873,19 +711,6 @@ static ssize_t proc_set_backop_flags_mesh(struct file *file, const char __user * #endif /* CONFIG_SCAN_BACKOP */ -#if defined(CONFIG_LPS_PG) && defined(CONFIG_RTL8822C) -static int proc_get_lps_pg_debug(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = rtw_netdev_priv(dev); - struct dm_struct *dm = adapter_to_phydm(adapter); - - rtw_run_in_thread_cmd(adapter, ((void *)(odm_lps_pg_debug_8822c)), dm); - - return 0; -} -#endif - /* gpio setting */ #ifdef CONFIG_GPIO_API static ssize_t proc_set_config_gpio(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) @@ -1212,21 +1037,8 @@ static int proc_get_turboedca_ctrl(struct seq_file *m, void *v) _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter); - if (hal_data) { - - u32 edca_param; - - if (hal_data->dis_turboedca == 0) - RTW_PRINT_SEL(m, "Turbo-EDCA : %s\n", "Enable"); - else - RTW_PRINT_SEL(m, "Turbo-EDCA : %s, mode=%d, edca_param_mode=0x%x\n", "Disable", hal_data->dis_turboedca, hal_data->edca_param_mode); - - - rtw_hal_get_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&edca_param)); - - _RTW_PRINT_SEL(m, "PARAM_BE:0x%x\n", edca_param); - - } + if (hal_data) + RTW_PRINT_SEL(m, "Turbo-EDCA :%s\n", (hal_data->dis_turboedca) ? "Disable" : "Enable"); return 0; } @@ -1236,9 +1048,9 @@ static ssize_t proc_set_turboedca_ctrl(struct file *file, const char __user *buf struct net_device *dev = data; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter); + char tmp[32] = {0}; int mode = 0, num = 0; - u32 param_mode = 0; if (count < 1) return -EFAULT; @@ -1248,39 +1060,58 @@ static ssize_t proc_set_turboedca_ctrl(struct file *file, const char __user *buf if (buffer && !copy_from_user(tmp, buffer, count)) { - num = sscanf(tmp, "%d %x", &mode, ¶m_mode); + num = sscanf(tmp, "%d ", &mode); - if (num < 1 || num > 2) { + if (num != 1) { RTW_INFO("argument number is wrong\n"); return -EFAULT; } - - /* 0: enable turboedca, - 1: disable turboedca, - 2: disable turboedca and setting EDCA parameter based on the input parameter - > 2 : currently reset to 0 */ - - if (mode > 2) - mode = 0; - hal_data->dis_turboedca = mode; - - hal_data->edca_param_mode = 0; /* init. value */ - - RTW_INFO("dis_turboedca mode = 0x%x\n", hal_data->dis_turboedca); - - if (num == 2) { - - hal_data->edca_param_mode = param_mode; - - RTW_INFO("param_mode = 0x%x\n", param_mode); - } - } - return count; - } +#ifdef CONFIG_WOWLAN +static int proc_get_wow_lps_ctrl(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); + + if (pwrctl) + RTW_PRINT_SEL(m, "WOW lps :%s\n", (pwrctl->wowlan_dis_lps) ? "Disable" : "Enable"); + + return 0; +} + +static ssize_t proc_set_wow_lps_ctrl(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); + + char tmp[32] = {0}; + int mode = 0, num = 0; + + if (count < 1) + return -EFAULT; + + if (count > sizeof(tmp)) + return -EFAULT; + + if (buffer && !copy_from_user(tmp, buffer, count)) { + + num = sscanf(tmp, "%d ", &mode); + + if (num != 1) { + RTW_INFO("argument number is wrong\n"); + return -EFAULT; + } + pwrctl->wowlan_dis_lps = mode; + RTW_INFO("WOW lps :%s\n", (pwrctl->wowlan_dis_lps) ? "Disable" : "Enable"); + } + return count; +} +#endif static int proc_get_mac_qinfo(struct seq_file *m, void *v) { @@ -1411,7 +1242,7 @@ ssize_t proc_set_macaddr_acl(struct file *file, const char __user *buffer, size_ #define MAC_ACL_CMD_DEL 2 #define MAC_ACL_CMD_CLR 3 #define MAC_ACL_CMD_NUM 4 - + static const char * const mac_acl_cmd_str[] = { "mode", "add", @@ -1513,7 +1344,7 @@ ssize_t proc_set_macaddr_acl(struct file *file, const char __user *buffer, size_ } else if (!is_bcast) rtw_acl_add_sta(adapter, period, addr); } - + c = strsep(&next, " \t"); } } @@ -1653,7 +1484,7 @@ exit: } #ifdef CONFIG_DFS_MASTER -static int proc_get_dfs_test_case(struct seq_file *m, void *v) +int proc_get_dfs_master_test_case(struct seq_file *m, void *v) { struct net_device *dev = m->private; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); @@ -1661,14 +1492,14 @@ static int proc_get_dfs_test_case(struct seq_file *m, void *v) RTW_PRINT_SEL(m, "%-24s %-19s\n", "radar_detect_trigger_non", "choose_dfs_ch_first"); RTW_PRINT_SEL(m, "%24hhu %19hhu\n" - , rfctl->dbg_dfs_radar_detect_trigger_non - , rfctl->dbg_dfs_choose_dfs_ch_first + , rfctl->dbg_dfs_master_radar_detect_trigger_non + , rfctl->dbg_dfs_master_choose_dfs_ch_first ); return 0; } -static ssize_t proc_set_dfs_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +ssize_t proc_set_dfs_master_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *dev = data; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); @@ -1689,9 +1520,9 @@ static ssize_t proc_set_dfs_test_case(struct file *file, const char __user *buff int num = sscanf(tmp, "%hhu %hhu", &radar_detect_trigger_non, &choose_dfs_ch_first); if (num >= 1) - rfctl->dbg_dfs_radar_detect_trigger_non = radar_detect_trigger_non; + rfctl->dbg_dfs_master_radar_detect_trigger_non = radar_detect_trigger_non; if (num >= 2) - rfctl->dbg_dfs_choose_dfs_ch_first = choose_dfs_ch_first; + rfctl->dbg_dfs_master_choose_dfs_ch_first = choose_dfs_ch_first; } return count; @@ -1756,7 +1587,7 @@ ssize_t proc_set_radar_detect(struct file *file, const char __user *buffer, size if (num < 1) goto exit; - rfctl->dbg_dfs_fake_radar_detect_cnt = fake_radar_detect_cnt; + rfctl->dbg_dfs_master_fake_radar_detect_cnt = fake_radar_detect_cnt; } exit: @@ -1795,7 +1626,7 @@ static ssize_t proc_set_dfs_ch_sel_d_flags(struct file *file, const char __user goto exit; num = sscanf(tmp, "%hhx", &d_flags); - if (num != 1) + if (num != 1) goto exit; rfctl->dfs_ch_sel_d_flags = d_flags; @@ -1803,54 +1634,6 @@ static ssize_t proc_set_dfs_ch_sel_d_flags(struct file *file, const char __user exit: return count; } - -#ifdef CONFIG_DFS_SLAVE_WITH_RADAR_DETECT -static int proc_get_dfs_slave_with_rd(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter); - - RTW_PRINT_SEL(m, "%u\n", rfctl->dfs_slave_with_rd); - - return 0; -} - -static ssize_t proc_set_dfs_slave_with_rd(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) -{ - struct net_device *dev = data; - _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter); - char tmp[32]; - u8 rd; - int num; - - if (count < 1) - return -EFAULT; - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - if (!buffer || copy_from_user(tmp, buffer, count)) - goto exit; - - num = sscanf(tmp, "%hhu", &rd); - if (num != 1) - goto exit; - - rd = rd ? 1 : 0; - - if (rfctl->dfs_slave_with_rd != rd) { - rfctl->dfs_slave_with_rd = rd; - rtw_dfs_rd_en_decision_cmd(adapter); - } - -exit: - return count; -} -#endif /* CONFIG_DFS_SLAVE_WITH_RADAR_DETECT */ #endif /* CONFIG_DFS_MASTER */ #ifdef CONFIG_80211N_HT @@ -1902,42 +1685,6 @@ exit: } #endif /* CONFIG_80211N_HT */ -static int proc_get_rx_chk_limit(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); - - RTW_PRINT_SEL(m, "Rx chk limit : %d\n", rtw_get_rx_chk_limit(padapter)); - - return 0; -} - -static ssize_t proc_set_rx_chk_limit(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) -{ - char tmp[32]; - struct net_device *dev = data; - _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); - int rx_chk_limit; - - if (count < 1) { - RTW_INFO("argument size is less than 1\n"); - return -EFAULT; - } - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - if (buffer && !copy_from_user(tmp, buffer, count)) { - int num = sscanf(tmp, "%d", &rx_chk_limit); - - rtw_set_rx_chk_limit(padapter, rx_chk_limit); - } - - return count; -} - static int proc_get_udpport(struct seq_file *m, void *v) { struct net_device *dev = m->private; @@ -2004,6 +1751,7 @@ static int proc_get_macid_info(struct seq_file *m, void *v) _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); + struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter); u8 i; u8 null_addr[ETH_ALEN] = {0}; u8 *macaddr; @@ -2018,7 +1766,7 @@ static int proc_get_macid_info(struct seq_file *m, void *v) RTW_PRINT_SEL(m, "%-3s %-3s %-5s %-4s %-17s %-6s %-3s" , "id", "bmc", "ifbmp", "ch_g", "macaddr", "bw", "vht"); - if (GET_HAL_TX_NSS(adapter) > 2) + if (hal_spec->tx_nss_num > 2) _RTW_PRINT_SEL(m, " %-10s", "rate_bmp1"); _RTW_PRINT_SEL(m, " %-10s %s\n", "rate_bmp0", "status"); @@ -2042,7 +1790,7 @@ static int proc_get_macid_info(struct seq_file *m, void *v) , macid_ctl->vht_en[i] ); - if (GET_HAL_TX_NSS(adapter) > 2) + if (hal_spec->tx_nss_num > 2) _RTW_PRINT_SEL(m, " 0x%08X", macid_ctl->rate_bmp1[i]); _RTW_PRINT_SEL(m, " 0x%08X "H2C_MSR_FMT" %s\n" @@ -2052,14 +1800,6 @@ static int proc_get_macid_info(struct seq_file *m, void *v) ); } } - RTW_PRINT_SEL(m, "\n"); - - for (i = 0; i < H2C_MSR_ROLE_MAX; i++) { - if (macid_ctl->op_num[i]) { - RTW_PRINT_SEL(m, "%-5s op_num:%u\n" - , h2c_msr_role_str(i), macid_ctl->op_num[i]); - } - } return 0; } @@ -2189,132 +1929,13 @@ static ssize_t proc_set_change_bss_chbw(struct file *file, const char __user *bu } if (ifbmp) - rtw_change_bss_chbw_cmd(adapter, RTW_CMDF_WAIT_ACK, ifbmp, 0, ch, bw, offset); + rtw_change_bss_chbw_cmd(adapter, RTW_CMDF_WAIT_ACK, ifbmp, ch, bw, offset); } exit: return count; } -#if CONFIG_TX_AC_LIFETIME -static int proc_get_tx_aclt_force_val(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = rtw_netdev_priv(dev); - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - - dump_tx_aclt_force_val(m, dvobj); - - return 0; -} - -static ssize_t proc_set_tx_aclt_force_val(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) -{ - struct net_device *dev = data; - _adapter *adapter = rtw_netdev_priv(dev); - char tmp[32] = {0}; - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - if (buffer && !copy_from_user(tmp, buffer, count)) { - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - struct tx_aclt_conf_t input; - int num = sscanf(tmp, "%hhx %u %u", &input.en, &input.vo_vi, &input.be_bk); - - if (num < 1) - return count; - - rtw_hal_set_tx_aclt_force_val(adapter, &input, num); - rtw_run_in_thread_cmd(adapter, ((void *)(rtw_hal_update_tx_aclt)), adapter); - } - - return count; -} - -static int proc_get_tx_aclt_flags(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = rtw_netdev_priv(dev); - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - - RTW_PRINT_SEL(m, "0x%02x\n", dvobj->tx_aclt_flags); - - return 0; -} - -static ssize_t proc_set_tx_aclt_flags(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) -{ - struct net_device *dev = data; - _adapter *adapter = rtw_netdev_priv(dev); - char tmp[32] = {0}; - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - if (buffer && !copy_from_user(tmp, buffer, count)) { - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - u8 flags; - int num = sscanf(tmp, "%hhx", &flags); - - if (num < 1) - return count; - - if (dvobj->tx_aclt_flags == flags) - return count; - - dvobj->tx_aclt_flags = flags; - - rtw_run_in_thread_cmd(adapter, ((void *)(rtw_hal_update_tx_aclt)), adapter); - } - - return count; -} - -static int proc_get_tx_aclt_confs(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = rtw_netdev_priv(dev); - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - - RTW_PRINT_SEL(m, "flags:0x%02x\n", dvobj->tx_aclt_flags); - dump_tx_aclt_confs(m, dvobj); - - return 0; -} - -static ssize_t proc_set_tx_aclt_confs(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) -{ - struct net_device *dev = data; - _adapter *adapter = rtw_netdev_priv(dev); - char tmp[32] = {0}; - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - if (buffer && !copy_from_user(tmp, buffer, count)) { - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - u8 id; - struct tx_aclt_conf_t input; - int num = sscanf(tmp, "%hhu %hhx %u %u", &id, &input.en, &input.vo_vi, &input.be_bk); - - if (num < 2) - return count; - - rtw_hal_set_tx_aclt_conf(adapter, id, &input, num - 1); - rtw_run_in_thread_cmd(adapter, ((void *)(rtw_hal_update_tx_aclt)), adapter); - } - - return count; -} -#endif /* CONFIG_TX_AC_LIFETIME */ - static int proc_get_tx_bw_mode(struct seq_file *m, void *v) { struct net_device *dev = m->private; @@ -2327,37 +1948,12 @@ static int proc_get_tx_bw_mode(struct seq_file *m, void *v) return 0; } -static void rtw_set_tx_bw_mode(struct _ADAPTER *adapter, u8 bw_mode) -{ - struct mlme_ext_priv *mlmeext = &(adapter->mlmeextpriv); - struct macid_ctl_t *macid_ctl = &adapter->dvobj->macid_ctl; - u8 update = _FALSE; - - if ((MLME_STATE(adapter) & WIFI_ASOC_STATE) - && ((mlmeext->cur_channel <= 14 && BW_MODE_2G(bw_mode) != ADAPTER_TX_BW_2G(adapter)) - || (mlmeext->cur_channel >= 36 && BW_MODE_5G(bw_mode) != ADAPTER_TX_BW_5G(adapter))) - ) { - /* RA mask update needed */ - update = _TRUE; - } - adapter->driver_tx_bw_mode = bw_mode; - - if (update == _TRUE) { - struct sta_info *sta; - int i; - - for (i = 0; i < MACID_NUM_SW_LIMIT; i++) { - sta = macid_ctl->sta[i]; - if (sta && !is_broadcast_mac_addr(sta->cmn.mac_addr)) - rtw_dm_ra_mask_wk_cmd(adapter, (u8 *)sta); - } - } -} - static ssize_t proc_set_tx_bw_mode(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *dev = data; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); + struct macid_ctl_t *macid_ctl = &adapter->dvobj->macid_ctl; + struct mlme_ext_priv *mlmeext = &(adapter->mlmeextpriv); char tmp[32]; u8 bw_mode; @@ -2371,12 +1967,31 @@ static ssize_t proc_set_tx_bw_mode(struct file *file, const char __user *buffer, if (buffer && !copy_from_user(tmp, buffer, count)) { + u8 update = _FALSE; int num = sscanf(tmp, "%hhx", &bw_mode); if (num < 1 || bw_mode == adapter->driver_tx_bw_mode) goto exit; - rtw_set_tx_bw_mode(adapter, bw_mode); + if ((MLME_STATE(adapter) & WIFI_ASOC_STATE) + && ((mlmeext->cur_channel <= 14 && BW_MODE_2G(bw_mode) != ADAPTER_TX_BW_2G(adapter)) + || (mlmeext->cur_channel >= 36 && BW_MODE_5G(bw_mode) != ADAPTER_TX_BW_5G(adapter))) + ) { + /* RA mask update needed */ + update = _TRUE; + } + adapter->driver_tx_bw_mode = bw_mode; + + if (update == _TRUE) { + struct sta_info *sta; + int i; + + for (i = 0; i < MACID_NUM_SW_LIMIT; i++) { + sta = macid_ctl->sta[i]; + if (sta && !is_broadcast_mac_addr(sta->cmn.mac_addr)) + rtw_dm_ra_mask_wk_cmd(adapter, (u8 *)sta); + } + } } exit: @@ -2385,21 +2000,16 @@ exit: static int proc_get_hal_txpwr_info(struct seq_file *m, void *v) { -#ifdef CONFIG_TXPWR_PG_WITH_PWR_IDX struct net_device *dev = m->private; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter); struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter); - if (hal_data->txpwr_pg_mode == TXPWR_PG_WITH_PWR_IDX) { - if (hal_is_band_support(adapter, BAND_ON_2_4G)) - dump_hal_txpwr_info_2g(m, adapter, hal_spec->rfpath_num_2g, hal_data->max_tx_cnt); + if (hal_is_band_support(adapter, BAND_ON_2_4G)) + dump_hal_txpwr_info_2g(m, adapter, hal_spec->rfpath_num_2g, hal_spec->max_tx_cnt); - #ifdef CONFIG_IEEE80211_BAND_5GHZ - if (hal_is_band_support(adapter, BAND_ON_5G)) - dump_hal_txpwr_info_5g(m, adapter, hal_spec->rfpath_num_5g, hal_data->max_tx_cnt); - #endif - } +#ifdef CONFIG_IEEE80211_BAND_5GHZ + if (hal_is_band_support(adapter, BAND_ON_5G)) + dump_hal_txpwr_info_5g(m, adapter, hal_spec->rfpath_num_5g, hal_spec->max_tx_cnt); #endif return 0; @@ -2425,7 +2035,7 @@ static int proc_get_tx_power_by_rate(struct seq_file *m, void *v) return 0; } -#if CONFIG_TXPWR_LIMIT +#ifdef CONFIG_TXPWR_LIMIT static int proc_get_tx_power_limit(struct seq_file *m, void *v) { struct net_device *dev = m->private; @@ -2591,28 +2201,19 @@ static int proc_get_kfree_bb_gain(struct seq_file *m, void *v) u8 i, j; for (i = 0; i < BB_GAIN_NUM; i++) { + if (i == 0) + _RTW_PRINT_SEL(m, "2G: "); + else if (i == 1) + _RTW_PRINT_SEL(m, "5GLB1: "); + else if (i == 2) + _RTW_PRINT_SEL(m, "5GLB2: "); + else if (i == 3) + _RTW_PRINT_SEL(m, "5GMB1: "); + else if (i == 4) + _RTW_PRINT_SEL(m, "5GMB2: "); + else if (i == 5) + _RTW_PRINT_SEL(m, "5GHB: "); - if (i == 0) - _RTW_PRINT_SEL(m, "2G: "); -#ifdef CONFIG_IEEE80211_BAND_5GHZ - switch (i) { - case 1: - _RTW_PRINT_SEL(m, "5GLB1: "); - break; - case 2: - _RTW_PRINT_SEL(m, "5GLB2: "); - break; - case 3: - _RTW_PRINT_SEL(m, "5GMB1: "); - break; - case 4: - _RTW_PRINT_SEL(m, "5GMB2: "); - break; - case 5: - _RTW_PRINT_SEL(m, "5GHB: "); - break; - } -#endif for (j = 0; j < hal_data->NumTotalRFPath; j++) _RTW_PRINT_SEL(m, "%d ", kfree_data->bb_gain[i][j]); _RTW_PRINT_SEL(m, "\n"); @@ -2810,6 +2411,7 @@ static int btreg_parse_str(char const *input, u8 *type, u16 *addr, u16 *val) u8 t = 0; u32 a, v; u8 i, n; + u8 *p; num = sscanf(input, "%s %x %x", str, &a, &v); @@ -2822,9 +2424,13 @@ static int btreg_parse_str(char const *input, u8 *type, u16 *addr, u16 *val) return -EINVAL; } + /* convert to lower case for following type compare */ + p = str; + for (; *p; ++p) + *p = tolower(*p); n = sizeof(btreg_type) / sizeof(btreg_type[0]); for (i = 0; i < n; i++) { - if (!strcasecmp(str, btreg_type[i])) { + if (!strcmp(str, btreg_type[i])) { t = i; break; } @@ -3030,69 +2636,6 @@ exit: return count; } - -int proc_get_btc_reduce_wl_txpwr(struct seq_file *m, void *v) -{ - struct net_device *dev; - PADAPTER padapter; - u8 data; - - dev = m->private; - padapter = (PADAPTER)rtw_netdev_priv(dev); - - data = rtw_btcoex_get_reduce_wl_txpwr(padapter); - RTW_PRINT_SEL(m, "BTC reduce WL TxPwr = %d dB\n", data); - - return 0; -} - -ssize_t proc_set_btc_reduce_wl_txpwr(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) -{ - struct net_device *dev = data; - PADAPTER padapter; - HAL_DATA_TYPE *hal_data; - u8 tmp[80] = {0}; - u32 val = 0; - u32 num; - - padapter = (PADAPTER)rtw_netdev_priv(dev); - hal_data = GET_HAL_DATA(padapter); - - /* RTW_INFO("+" FUNC_ADPT_FMT "\n", FUNC_ADPT_ARG(padapter)); */ - - if (NULL == buffer) { - RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", - FUNC_ADPT_ARG(padapter)); - - return -EFAULT; - } - - if (count < 1) { - RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", - FUNC_ADPT_ARG(padapter)); - - return -EFAULT; - } - - num = count; - if (num > (sizeof(tmp) - 1)) - num = (sizeof(tmp) - 1); - - if (copy_from_user(tmp, buffer, num)) { - RTW_INFO(FUNC_ADPT_FMT ": copy buffer from user space FAIL!\n", - FUNC_ADPT_ARG(padapter)); - - return -EFAULT; - } - - num = sscanf(tmp, "%d", &val); - - if ((IS_HARDWARE_TYPE_8822C(padapter)) && (hal_data->EEPROMBluetoothCoexist == _TRUE)) - rtw_btc_reduce_wl_txpwr_cmd(padapter, val); - - return count; -} - #endif /* CONFIG_BT_COEXIST */ #ifdef CONFIG_MBSSID_CAM @@ -3282,15 +2825,6 @@ static int proc_get_hal_spec(struct seq_file *m, void *v) return 0; } -static int proc_get_hal_trx_mode(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = rtw_netdev_priv(dev); - - dump_hal_trx_mode(m, adapter); - return 0; -} - static int proc_get_phy_cap(struct seq_file *m, void *v) { struct net_device *dev = m->private; @@ -3477,7 +3011,7 @@ static ssize_t proc_set_napi_th(struct file *file, const char __user *buffer, si for (i = 0; i < dvobj->iface_nums; i++) { iface = dvobj->padapters[i]; - if (iface) { + if (iface) { if (buffer && !copy_from_user(tmp, buffer, count)) { registry = &iface->registrypriv; num = sscanf(tmp, "%d", &thrshld); @@ -3556,51 +3090,6 @@ static int proc_get_mesh_peer_sel_policy(struct seq_file *m, void *v) return 0; } -#if CONFIG_RTW_MESH_ACNODE_PREVENT -static int proc_get_mesh_acnode_prevent(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - - if (MLME_IS_MESH(adapter)) - dump_mesh_acnode_prevent_settings(m, adapter); - - return 0; -} - -static ssize_t proc_set_mesh_acnode_prevent(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) -{ - struct net_device *dev = data; - _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - char tmp[32]; - - if (count < 1) - return -EFAULT; - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - if (buffer && !copy_from_user(tmp, buffer, count)) { - struct mesh_peer_sel_policy *peer_sel_policy = &adapter->mesh_cfg.peer_sel_policy; - u8 enable; - u32 conf_timeout_ms; - u32 notify_timeout_ms; - int num = sscanf(tmp, "%hhu %u %u", &enable, &conf_timeout_ms, ¬ify_timeout_ms); - - if (num >= 1) - peer_sel_policy->acnode_prevent = enable; - if (num >= 2) - peer_sel_policy->acnode_conf_timeout_ms = conf_timeout_ms; - if (num >= 3) - peer_sel_policy->acnode_notify_timeout_ms = notify_timeout_ms; - } - - return count; -} -#endif /* CONFIG_RTW_MESH_ACNODE_PREVENT */ - #if CONFIG_RTW_MESH_OFFCH_CAND static int proc_get_mesh_offch_cand(struct seq_file *m, void *v) { @@ -3639,6 +3128,7 @@ static ssize_t proc_set_mesh_offch_cand(struct file *file, const char __user *bu peer_sel_policy->offch_find_int_ms = find_int_ms; } +exit: return count; } #endif /* CONFIG_RTW_MESH_OFFCH_CAND */ @@ -3684,6 +3174,7 @@ static ssize_t proc_set_mesh_peer_blacklist(struct file *file, const char __user peer_sel_policy->peer_blacklist_timeout_ms = blacklist_timeout_ms; } +exit: return count; } #endif /* CONFIG_RTW_MESH_PEER_BLACKLIST */ @@ -3719,17 +3210,11 @@ static ssize_t proc_set_mesh_cto_mgate_require(struct file *file, const char __u u8 require; int num = sscanf(tmp, "%hhu", &require); - if (num >= 1) { + if (num >= 1) peer_sel_policy->cto_mgate_require = require; - #if CONFIG_RTW_MESH_CTO_MGATE_CARRIER - if (rtw_mesh_cto_mgate_required(adapter)) - rtw_netif_carrier_off(adapter->pnetdev); - else - rtw_netif_carrier_on(adapter->pnetdev); - #endif - } } +exit: return count; } @@ -3773,6 +3258,7 @@ static ssize_t proc_set_mesh_cto_mgate_blacklist(struct file *file, const char _ peer_sel_policy->cto_mgate_blacklist_timeout_ms = blacklist_timeout_ms; } +exit: return count; } #endif /* CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST */ @@ -3798,28 +3284,6 @@ static int proc_get_mesh_plink_ctl(struct seq_file *m, void *v) return 0; } -static int proc_get_mesh_mpath(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - - if (MLME_IS_MESH(adapter) && MLME_IS_ASOC(adapter)) - dump_mpath(m, adapter); - - return 0; -} - -static int proc_get_mesh_mpp(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - - if (MLME_IS_MESH(adapter) && MLME_IS_ASOC(adapter)) - dump_mpp(m, adapter); - - return 0; -} - static int proc_get_mesh_known_gates(struct seq_file *m, void *v) { struct net_device *dev = m->private; @@ -3868,6 +3332,7 @@ static ssize_t proc_set_mesh_b2u_flags(struct file *file, const char __user *buf mcfg->b2u_flags_mfwd = mfwd; } +exit: return count; } #endif /* CONFIG_RTW_MESH_DATA_BMC_TO_UC */ @@ -3945,237 +3410,8 @@ static int proc_get_mesh_gate_state(struct seq_file *m, void *v) return 0; } -static int proc_get_peer_alive_based_preq(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - struct _ADAPTER *adapter= (_adapter *)rtw_netdev_priv(dev); - struct registry_priv *rp = &adapter->registrypriv; - - RTW_PRINT_SEL(m, "peer_alive_based_preq = %u\n", - rp->peer_alive_based_preq); - - return 0; -} - -static ssize_t -proc_set_peer_alive_based_preq(struct file *file, const char __user *buffer, - size_t count, loff_t *pos, void *data) -{ - struct net_device *dev = data; - struct _ADAPTER *adapter = (_adapter *)rtw_netdev_priv(dev); - struct registry_priv *rp = &adapter->registrypriv; - char tmp[8]; - int num = 0; - u8 enable = 0; - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - if (!buffer || copy_from_user(tmp, buffer, count)) - goto exit; - - num = sscanf(tmp, "%hhu", &enable); - if (num != 1) { - RTW_ERR("%s: invalid parameter!\n", __FUNCTION__); - goto exit; - } - - if (enable > 1) { - RTW_ERR("%s: invalid value!\n", __FUNCTION__); - goto exit; - } - rp->peer_alive_based_preq = enable; - -exit: - return count; -} #endif /* CONFIG_RTW_MESH */ -static int proc_get_scan_deny(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - struct _ADAPTER *adapter= (_adapter *)rtw_netdev_priv(dev); - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - - RTW_PRINT_SEL(m, "scan_deny is %s\n", (dvobj->scan_deny == _TRUE) ? "enable":"disable"); - - return 0; -} - -static ssize_t proc_set_scan_deny(struct file *file, const char __user *buffer, - size_t count, loff_t *pos, void *data) -{ - struct net_device *dev = data; - struct _ADAPTER *adapter = (_adapter *)rtw_netdev_priv(dev); - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - char tmp[8]; - int num = 0; - int enable = 0; - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - if (!buffer || copy_from_user(tmp, buffer, count)) - goto exit; - - num = sscanf(tmp, "%d", &enable); - if (num != 1) { - RTW_ERR("%s: invalid parameter!\n", __FUNCTION__); - goto exit; - } - - dvobj->scan_deny = enable ? _TRUE : _FALSE; - - RTW_PRINT("%s: scan_deny is %s\n", - __FUNCTION__, (dvobj->scan_deny == _TRUE) ? "enable":"disable"); - -exit: - return count; -} - -#ifdef CONFIG_RTW_TPT_MODE -static int proc_get_tpt_mode(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - struct _ADAPTER *adapter= (_adapter *)rtw_netdev_priv(dev); - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - - RTW_PRINT_SEL(m, "current tpt_mode = %d\n", dvobj->tpt_mode); - - return 0; -} - -static void tpt_mode_default(struct _ADAPTER *adapter) -{ - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - - /* 1. disable scan deny */ - dvobj->scan_deny = _FALSE; - - /* 2. back to original LPS mode */ -#ifdef CONFIG_LPS - rtw_pm_set_lps(adapter, adapter->registrypriv.power_mgnt); -#endif - - /* 3. back to original 2.4 tx bw mode */ - rtw_set_tx_bw_mode(adapter, adapter->registrypriv.tx_bw_mode); -} - -static void rtw_tpt_mode(struct _ADAPTER *adapter) -{ - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - - if (dvobj->tpt_mode > 0) { - - /* when enable each tpt mode - 1. scan deny - 2. disable LPS */ - - dvobj->scan_deny = _TRUE; - -#ifdef CONFIG_LPS - rtw_pm_set_lps(adapter, PS_MODE_ACTIVE); -#endif - - } - - switch (dvobj->tpt_mode) { - case 0: /* default mode */ - tpt_mode_default(adapter); - break; - case 1: /* High TP*/ - /*tpt_mode1(adapter);*/ - dvobj->edca_be_ul = 0x5e431c; - dvobj->edca_be_dl = 0x00431c; - break; - case 2: /* noise */ - /* tpt_mode2(adapter); */ - dvobj->edca_be_ul = 0x00431c; - dvobj->edca_be_dl = 0x00431c; - - rtw_set_tx_bw_mode(adapter, 0x20); /* for 2.4g, fixed tx_bw_mode to 20Mhz */ - break; - case 3: /* long distance */ - /* tpt_mode3(adapter); */ - dvobj->edca_be_ul = 0x00431c; - dvobj->edca_be_dl = 0x00431c; - - rtw_set_tx_bw_mode(adapter, 0x20); /* for 2.4g, fixed tx_bw_mode to 20Mhz */ - break; - case 4: /* noise + long distance */ - /* tpt_mode4(adapter); */ - dvobj->edca_be_ul = 0x00431c; - dvobj->edca_be_dl = 0x00431c; - - rtw_set_tx_bw_mode(adapter, 0x20); /* for 2.4g, fixed tx_bw_mode to 20Mhz */ - break; - default: /* default mode */ - tpt_mode_default(adapter); - break; - } - -} - -static ssize_t proc_set_tpt_mode(struct file *file, const char __user *buffer, - size_t count, loff_t *pos, void *data) -{ - struct net_device *dev = data; - struct _ADAPTER *adapter = (_adapter *)rtw_netdev_priv(dev); - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - char tmp[32]; - int num = 0; - int mode = 0; - -#define MAX_TPT_MODE_NUM 4 - - if (count > sizeof(tmp)) { - rtw_warn_on(1); - return -EFAULT; - } - - if (!buffer || copy_from_user(tmp, buffer, count)) - goto exit; - - num = sscanf(tmp, "%d", &mode); - if (num != 1) { - RTW_ERR("%s: invalid parameter!\n", __FUNCTION__); - goto exit; - } - - if (mode > MAX_TPT_MODE_NUM ) - mode = 0; - - RTW_PRINT("%s: previous mode = %d\n", - __FUNCTION__, dvobj->tpt_mode); - - RTW_PRINT("%s: enabled mode = %d\n", - __FUNCTION__, mode); - - dvobj->tpt_mode = mode; - - rtw_tpt_mode(adapter); - -exit: - return count; - -} -#endif /* CONFIG_RTW_TPT_MODE */ - -int proc_get_cur_beacon_keys(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - _adapter *adapter = rtw_netdev_priv(dev); - struct mlme_priv *mlme = &adapter->mlmepriv; - - rtw_dump_bcn_keys(m, &mlme->cur_beacon_keys); - - return 0; -} - /* * rtw_adapter_proc: * init/deinit when register/unregister net_device @@ -4213,9 +3449,6 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { #endif RTW_PROC_HDL_SSEQ("survey_info", proc_get_survey_info, proc_set_survey_info), RTW_PROC_HDL_SSEQ("ap_info", proc_get_ap_info, NULL), -#ifdef ROKU_PRIVATE - RTW_PROC_HDL_SSEQ("infra_ap", proc_get_infra_ap, NULL), -#endif /* ROKU_PRIVATE */ RTW_PROC_HDL_SSEQ("trx_info", proc_get_trx_info, proc_reset_trx_info), RTW_PROC_HDL_SSEQ("tx_power_offset", proc_get_tx_power_offset, proc_set_tx_power_offset), RTW_PROC_HDL_SSEQ("rate_ctl", proc_get_rate_ctl, proc_set_rate_ctl), @@ -4241,18 +3474,12 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("sd_f0_reg_dump", proc_get_sd_f0_reg_dump, NULL), RTW_PROC_HDL_SSEQ("sdio_local_reg_dump", proc_get_sdio_local_reg_dump, NULL), RTW_PROC_HDL_SSEQ("sdio_card_info", proc_get_sdio_card_info, NULL), -#ifdef DBG_SDIO - RTW_PROC_HDL_SSEQ("sdio_dbg", proc_get_sdio_dbg, proc_set_sdio_dbg), -#endif /* DBG_SDIO */ #endif /* CONFIG_SDIO_HCI */ RTW_PROC_HDL_SSEQ("fwdl_test_case", NULL, proc_set_fwdl_test_case), RTW_PROC_HDL_SSEQ("del_rx_ampdu_test_case", NULL, proc_set_del_rx_ampdu_test_case), RTW_PROC_HDL_SSEQ("wait_hiq_empty", NULL, proc_set_wait_hiq_empty), RTW_PROC_HDL_SSEQ("sta_linking_test", NULL, proc_set_sta_linking_test), -#ifdef CONFIG_AP_MODE - RTW_PROC_HDL_SSEQ("ap_linking_test", NULL, proc_set_ap_linking_test), -#endif RTW_PROC_HDL_SSEQ("mac_reg_dump", proc_get_mac_reg_dump, NULL), RTW_PROC_HDL_SSEQ("bb_reg_dump", proc_get_bb_reg_dump, NULL), @@ -4278,7 +3505,6 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { #endif RTW_PROC_HDL_SSEQ("rx_signal", proc_get_rx_signal, proc_set_rx_signal), - RTW_PROC_HDL_SSEQ("rx_chk_limit", proc_get_rx_chk_limit, proc_set_rx_chk_limit), RTW_PROC_HDL_SSEQ("hw_info", proc_get_hw_status, proc_set_hw_status), RTW_PROC_HDL_SSEQ("mac_rptbuf", proc_get_mac_rptbuf, NULL), #ifdef CONFIG_80211N_HT @@ -4308,7 +3534,6 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("btinfo_evt", NULL, proc_set_btinfo_evt), RTW_PROC_HDL_SSEQ("btreg_read", proc_get_btreg_read, proc_set_btreg_read), RTW_PROC_HDL_SSEQ("btreg_write", proc_get_btreg_write, proc_set_btreg_write), - RTW_PROC_HDL_SSEQ("btc_reduce_wl_txpwr", proc_get_btc_reduce_wl_txpwr, proc_set_btc_reduce_wl_txpwr), #ifdef CONFIG_RF4CE_COEXIST RTW_PROC_HDL_SSEQ("rf4ce_state", proc_get_rf4ce_state, proc_set_rf4ce_state), #endif @@ -4318,10 +3543,6 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("sreset", proc_get_sreset, proc_set_sreset), #endif /* DBG_CONFIG_ERROR_DETECT */ RTW_PROC_HDL_SSEQ("trx_info_debug", proc_get_trx_info_debug, NULL), - -#ifdef CONFIG_HUAWEI_PROC - RTW_PROC_HDL_SSEQ("huawei_trx_info", proc_get_huawei_trx_info, NULL), -#endif RTW_PROC_HDL_SSEQ("linked_info_dump", proc_get_linked_info_dump, proc_set_linked_info_dump), RTW_PROC_HDL_SSEQ("sta_tp_dump", proc_get_sta_tp_dump, proc_set_sta_tp_dump), RTW_PROC_HDL_SSEQ("sta_tp_info", proc_get_sta_tp_info, NULL), @@ -4329,10 +3550,6 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("tx_info_msg", proc_get_tx_info_msg, NULL), RTW_PROC_HDL_SSEQ("rx_info_msg", proc_get_rx_info_msg, proc_set_rx_info_msg), -#if defined(CONFIG_LPS_PG) && defined(CONFIG_RTL8822C) - RTW_PROC_HDL_SSEQ("lps_pg_debug", proc_get_lps_pg_debug, NULL), -#endif - #ifdef CONFIG_GPIO_API RTW_PROC_HDL_SSEQ("gpio_info", proc_get_gpio, proc_set_gpio), RTW_PROC_HDL_SSEQ("gpio_set_output_value", NULL, proc_set_gpio_output_value), @@ -4372,6 +3589,7 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { #ifdef CONFIG_WOW_PATTERN_HW_CAM RTW_PROC_HDL_SSEQ("wow_pattern_cam", proc_dump_pattern_cam, NULL), #endif + RTW_PROC_HDL_SSEQ("dis_wow_lps", proc_get_wow_lps_ctrl, proc_set_wow_lps_ctrl), #endif #ifdef CONFIG_GPIO_WAKEUP @@ -4390,13 +3608,10 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { #endif RTW_PROC_HDL_SSEQ("ch_sel_policy", proc_get_ch_sel_policy, proc_set_ch_sel_policy), #ifdef CONFIG_DFS_MASTER - RTW_PROC_HDL_SSEQ("dfs_test_case", proc_get_dfs_test_case, proc_set_dfs_test_case), + RTW_PROC_HDL_SSEQ("dfs_master_test_case", proc_get_dfs_master_test_case, proc_set_dfs_master_test_case), RTW_PROC_HDL_SSEQ("update_non_ocp", NULL, proc_set_update_non_ocp), RTW_PROC_HDL_SSEQ("radar_detect", NULL, proc_set_radar_detect), RTW_PROC_HDL_SSEQ("dfs_ch_sel_d_flags", proc_get_dfs_ch_sel_d_flags, proc_set_dfs_ch_sel_d_flags), - #ifdef CONFIG_DFS_SLAVE_WITH_RADAR_DETECT - RTW_PROC_HDL_SSEQ("dfs_slave_with_rd", proc_get_dfs_slave_with_rd, proc_set_dfs_slave_with_rd), - #endif #endif #ifdef CONFIG_BCN_CNT_CONFIRM_HDL RTW_PROC_HDL_SSEQ("new_bcn_max", proc_get_new_bcn_max, proc_set_new_bcn_max), @@ -4406,16 +3621,11 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("dump_rx_cnt_mode", proc_get_rx_cnt_dump, proc_set_rx_cnt_dump), #endif RTW_PROC_HDL_SSEQ("change_bss_chbw", NULL, proc_set_change_bss_chbw), -#if CONFIG_TX_AC_LIFETIME - RTW_PROC_HDL_SSEQ("tx_aclt_force_val", proc_get_tx_aclt_force_val, proc_set_tx_aclt_force_val), - RTW_PROC_HDL_SSEQ("tx_aclt_flags", proc_get_tx_aclt_flags, proc_set_tx_aclt_flags), - RTW_PROC_HDL_SSEQ("tx_aclt_confs", proc_get_tx_aclt_confs, proc_set_tx_aclt_confs), -#endif RTW_PROC_HDL_SSEQ("tx_bw_mode", proc_get_tx_bw_mode, proc_set_tx_bw_mode), RTW_PROC_HDL_SSEQ("hal_txpwr_info", proc_get_hal_txpwr_info, NULL), RTW_PROC_HDL_SSEQ("target_tx_power", proc_get_target_tx_power, NULL), RTW_PROC_HDL_SSEQ("tx_power_by_rate", proc_get_tx_power_by_rate, NULL), -#if CONFIG_TXPWR_LIMIT +#ifdef CONFIG_TXPWR_LIMIT RTW_PROC_HDL_SSEQ("tx_power_limit", proc_get_tx_power_limit, NULL), #endif RTW_PROC_HDL_SSEQ("tx_power_ext_info", proc_get_tx_power_ext_info, proc_set_tx_power_ext_info), @@ -4427,10 +3637,10 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("kfree_thermal", proc_get_kfree_thermal, proc_set_kfree_thermal), #endif #ifdef CONFIG_POWER_SAVING - RTW_PROC_HDL_SSEQ("ps_info", proc_get_ps_info, proc_set_ps_info), + RTW_PROC_HDL_SSEQ("ps_info", proc_get_ps_info, NULL), #ifdef CONFIG_WMMPS_STA RTW_PROC_HDL_SSEQ("wmmps_info", proc_get_wmmps_info, proc_set_wmmps_info), -#endif /* CONFIG_WMMPS_STA */ +#endif /* CONFIG_WMMPS_STA */ #endif #ifdef CONFIG_TDLS RTW_PROC_HDL_SSEQ("tdls_info", proc_get_tdls_info, NULL), @@ -4457,17 +3667,12 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("11w_tx_auth", proc_get_tx_auth, proc_set_tx_auth), #endif /* CONFIG_IEEE80211W */ -#ifdef CONFIG_CUSTOMER01_SMART_ANTENNA - RTW_PROC_HDL_SSEQ("pathb_phase", proc_get_pathb_phase, proc_set_pathb_phase), -#endif - #ifdef CONFIG_MBSSID_CAM RTW_PROC_HDL_SSEQ("mbid_cam", proc_get_mbid_cam_cache, NULL), #endif RTW_PROC_HDL_SSEQ("mac_addr", proc_get_mac_addr, NULL), RTW_PROC_HDL_SSEQ("skip_band", proc_get_skip_band, proc_set_skip_band), RTW_PROC_HDL_SSEQ("hal_spec", proc_get_hal_spec, NULL), - RTW_PROC_HDL_SSEQ("hal_trx_mode", proc_get_hal_trx_mode, NULL), RTW_PROC_HDL_SSEQ("rx_stat", proc_get_rx_stat, NULL), @@ -4508,9 +3713,6 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("fw_offload", proc_get_fw_offload, proc_set_fw_offload), #ifdef CONFIG_RTW_MESH - #if CONFIG_RTW_MESH_ACNODE_PREVENT - RTW_PROC_HDL_SSEQ("mesh_acnode_prevent", proc_get_mesh_acnode_prevent, proc_set_mesh_acnode_prevent), - #endif #if CONFIG_RTW_MESH_OFFCH_CAND RTW_PROC_HDL_SSEQ("mesh_offch_cand", proc_get_mesh_offch_cand, proc_set_mesh_offch_cand), #endif @@ -4524,8 +3726,6 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("mesh_peer_sel_policy", proc_get_mesh_peer_sel_policy, NULL), RTW_PROC_HDL_SSEQ("mesh_networks", proc_get_mesh_networks, NULL), RTW_PROC_HDL_SSEQ("mesh_plink_ctl", proc_get_mesh_plink_ctl, NULL), - RTW_PROC_HDL_SSEQ("mesh_mpath", proc_get_mesh_mpath, NULL), - RTW_PROC_HDL_SSEQ("mesh_mpp", proc_get_mesh_mpp, NULL), RTW_PROC_HDL_SSEQ("mesh_known_gates", proc_get_mesh_known_gates, NULL), #if CONFIG_RTW_MESH_DATA_BMC_TO_UC RTW_PROC_HDL_SSEQ("mesh_b2u_flags", proc_get_mesh_b2u_flags, proc_set_mesh_b2u_flags), @@ -4533,31 +3733,10 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("mesh_stats", proc_get_mesh_stats, NULL), RTW_PROC_HDL_SSEQ("mesh_gate_timeout_factor", proc_get_mesh_gate_timeout, proc_set_mesh_gate_timeout), RTW_PROC_HDL_SSEQ("mesh_gate_state", proc_get_mesh_gate_state, NULL), - RTW_PROC_HDL_SSEQ("mesh_peer_alive_based_preq", proc_get_peer_alive_based_preq, proc_set_peer_alive_based_preq), #endif #ifdef CONFIG_FW_HANDLE_TXBCN RTW_PROC_HDL_SSEQ("fw_tbtt_rpt", proc_get_fw_tbtt_rpt, proc_set_fw_tbtt_rpt), #endif -#ifdef CONFIG_LPS_CHK_BY_TP - RTW_PROC_HDL_SSEQ("lps_chk_tp", proc_get_lps_chk_tp, proc_set_lps_chk_tp), -#endif -#ifdef CONFIG_SUPPORT_STATIC_SMPS - RTW_PROC_HDL_SSEQ("smps", proc_get_smps, proc_set_smps), -#endif - - RTW_PROC_HDL_SSEQ("scan_deny", proc_get_scan_deny, proc_set_scan_deny), -#ifdef CONFIG_RTW_TPT_MODE - RTW_PROC_HDL_SSEQ("tpt_mode", proc_get_tpt_mode, proc_set_tpt_mode), -#endif - -#ifdef CONFIG_CTRL_TXSS_BY_TP - RTW_PROC_HDL_SSEQ("txss_tp", proc_get_txss_tp, proc_set_txss_tp), - #ifdef DBG_CTRL_TXSS - RTW_PROC_HDL_SSEQ("txss_ctrl", proc_get_txss_ctrl, proc_set_txss_ctrl), - #endif -#endif - - RTW_PROC_HDL_SSEQ("cur_beacon_keys", proc_get_cur_beacon_keys, NULL), }; const int adapter_proc_hdls_num = sizeof(adapter_proc_hdls) / sizeof(struct rtw_proc_hdl); @@ -4579,10 +3758,6 @@ static int rtw_adapter_proc_open(struct inode *inode, struct file *file) int (*show)(struct seq_file *, void *) = hdl->u.show ? hdl->u.show : proc_get_dummy; return single_open(file, show, private); - } else if (hdl->type == RTW_PROC_HDL_TYPE_SZSEQ) { - int (*show)(struct seq_file *, void *) = hdl->u.sz.show ? hdl->u.sz.show : proc_get_dummy; - - return single_open_size(file, show, private, hdl->u.sz.size); } else { return -EROFS; } @@ -4600,7 +3775,6 @@ static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buff return -EROFS; } -/* static const struct file_operations rtw_adapter_proc_seq_fops = { */ static const rtw_proc_op_t rtw_adapter_proc_seq_fops = { #ifdef HAVE_PROC_OPS_STRUCT .proc_open = rtw_adapter_proc_open, @@ -4618,7 +3792,6 @@ static const rtw_proc_op_t rtw_adapter_proc_seq_fops = { #endif }; -/* static const struct file_operations rtw_adapter_proc_sseq_fops = { */ static const rtw_proc_op_t rtw_adapter_proc_sseq_fops = { #ifdef HAVE_PROC_OPS_STRUCT .proc_open = rtw_adapter_proc_open, @@ -4676,7 +3849,7 @@ ssize_t proc_set_odm_adaptivity(struct file *file, const char __user *buffer, si } static char *phydm_msg = NULL; -#define PHYDM_MSG_LEN 80*24*4 +#define PHYDM_MSG_LEN 80*24 int proc_get_phydm_cmd(struct seq_file *m, void *v) { @@ -4748,7 +3921,7 @@ ssize_t proc_set_phydm_cmd(struct file *file, const char __user *buffer, size_t */ const struct rtw_proc_hdl odm_proc_hdls[] = { RTW_PROC_HDL_SSEQ("adaptivity", proc_get_odm_adaptivity, proc_set_odm_adaptivity), - RTW_PROC_HDL_SZSEQ("cmd", proc_get_phydm_cmd, proc_set_phydm_cmd, PHYDM_MSG_LEN), + RTW_PROC_HDL_SSEQ("cmd", proc_get_phydm_cmd, proc_set_phydm_cmd), }; const int odm_proc_hdls_num = sizeof(odm_proc_hdls) / sizeof(struct rtw_proc_hdl); @@ -4770,10 +3943,6 @@ static int rtw_odm_proc_open(struct inode *inode, struct file *file) int (*show)(struct seq_file *, void *) = hdl->u.show ? hdl->u.show : proc_get_dummy; return single_open(file, show, private); - } else if (hdl->type == RTW_PROC_HDL_TYPE_SZSEQ) { - int (*show)(struct seq_file *, void *) = hdl->u.sz.show ? hdl->u.sz.show : proc_get_dummy; - - return single_open_size(file, show, private, hdl->u.sz.size); } else { return -EROFS; } @@ -4791,7 +3960,6 @@ static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer, return -EROFS; } -/* static const struct file_operations rtw_odm_proc_seq_fops = { */ static const rtw_proc_op_t rtw_odm_proc_seq_fops = { #ifdef HAVE_PROC_OPS_STRUCT .proc_open = rtw_odm_proc_open, @@ -4809,7 +3977,6 @@ static const rtw_proc_op_t rtw_odm_proc_seq_fops = { #endif }; -/* static const struct file_operations rtw_odm_proc_sseq_fops = { */ static const rtw_proc_op_t rtw_odm_proc_sseq_fops = { #ifdef HAVE_PROC_OPS_STRUCT .proc_open = rtw_odm_proc_open, @@ -4855,8 +4022,7 @@ struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev) for (i = 0; i < odm_proc_hdls_num; i++) { if (odm_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SEQ) entry = rtw_proc_create_entry(odm_proc_hdls[i].name, dir_odm, &rtw_odm_proc_seq_fops, (void *)i); - else if (odm_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ || - odm_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SZSEQ) + else if (odm_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ) entry = rtw_proc_create_entry(odm_proc_hdls[i].name, dir_odm, &rtw_odm_proc_sseq_fops, (void *)i); else entry = NULL; @@ -4905,9 +4071,6 @@ const struct rtw_proc_hdl mcc_proc_hdls[] = { RTW_PROC_HDL_SSEQ("mcc_info", proc_get_mcc_info, NULL), RTW_PROC_HDL_SSEQ("mcc_enable", proc_get_mcc_info, proc_set_mcc_enable), RTW_PROC_HDL_SSEQ("mcc_duration", proc_get_mcc_info, proc_set_mcc_duration), - #ifdef CONFIG_MCC_PHYDM_OFFLOAD - RTW_PROC_HDL_SSEQ("mcc_phydm_offload", proc_get_mcc_info, proc_set_mcc_phydm_offload_enable), - #endif RTW_PROC_HDL_SSEQ("mcc_single_tx_criteria", proc_get_mcc_info, proc_set_mcc_single_tx_criteria), RTW_PROC_HDL_SSEQ("mcc_ap_bw20_target_tp", proc_get_mcc_info, proc_set_mcc_ap_bw20_target_tp), RTW_PROC_HDL_SSEQ("mcc_ap_bw40_target_tp", proc_get_mcc_info, proc_set_mcc_ap_bw40_target_tp), @@ -4937,10 +4100,6 @@ static int rtw_mcc_proc_open(struct inode *inode, struct file *file) int (*show)(struct seq_file *, void *) = hdl->u.show ? hdl->u.show : proc_get_dummy; return single_open(file, show, private); - } else if (hdl->type == RTW_PROC_HDL_TYPE_SZSEQ) { - int (*show)(struct seq_file *, void *) = hdl->u.sz.show ? hdl->u.sz.show : proc_get_dummy; - - return single_open_size(file, show, private, hdl->u.sz.size); } else { return -EROFS; } @@ -4958,25 +4117,15 @@ static ssize_t rtw_mcc_proc_write(struct file *file, const char __user *buffer, return -EROFS; } -/* static const struct file_operations rtw_mcc_proc_seq_fops = { */ -static const rtw_proc_op_t rtw_mcc_proc_seq_fops = { - #ifdef HAVE_PROC_OPS_STRUCT - .proc_open = rtw_mcc_proc_open, - .proc_read = seq_read, - .proc_lseek = seq_lseek, - .proc_release = seq_release, - .proc_write = rtw_mcc_proc_write, - #else +static const struct file_operations rtw_mcc_proc_seq_fops = { .owner = THIS_MODULE, .open = rtw_mcc_proc_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, .write = rtw_mcc_proc_write, - #endif }; -/* static const struct file_operations rtw_mcc_proc_sseq_fops = { */ static const rtw_proc_op_t rtw_mcc_proc_sseq_fops = { #ifdef HAVE_PROC_OPS_STRUCT .proc_open = rtw_mcc_proc_open, @@ -5022,8 +4171,7 @@ struct proc_dir_entry *rtw_mcc_proc_init(struct net_device *dev) for (i = 0; i < mcc_proc_hdls_num; i++) { if (mcc_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SEQ) entry = rtw_proc_create_entry(mcc_proc_hdls[i].name, dir_mcc, &rtw_mcc_proc_seq_fops, (void *)i); - else if (mcc_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ || - mcc_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SZSEQ) + else if (mcc_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ) entry = rtw_proc_create_entry(mcc_proc_hdls[i].name, dir_mcc, &rtw_mcc_proc_sseq_fops, (void *)i); else entry = NULL; @@ -5088,8 +4236,7 @@ struct proc_dir_entry *rtw_adapter_proc_init(struct net_device *dev) for (i = 0; i < adapter_proc_hdls_num; i++) { if (adapter_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SEQ) entry = rtw_proc_create_entry(adapter_proc_hdls[i].name, dir_dev, &rtw_adapter_proc_seq_fops, (void *)i); - else if (adapter_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ || - adapter_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SZSEQ) + else if (adapter_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ) entry = rtw_proc_create_entry(adapter_proc_hdls[i].name, dir_dev, &rtw_adapter_proc_sseq_fops, (void *)i); else entry = NULL; diff --git a/os_dep/linux/rtw_proc.h b/os_dep/linux/rtw_proc.h index da6addb..839d647 100755 --- a/os_dep/linux/rtw_proc.h +++ b/os_dep/linux/rtw_proc.h @@ -20,7 +20,6 @@ #define RTW_PROC_HDL_TYPE_SEQ 0 #define RTW_PROC_HDL_TYPE_SSEQ 1 -#define RTW_PROC_HDL_TYPE_SZSEQ 2 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) #define HAVE_PROC_OPS_STRUCT @@ -35,10 +34,6 @@ struct rtw_proc_hdl { union { int (*show)(struct seq_file *, void *); struct seq_operations *seq_op; - struct { - int (*show)(struct seq_file *, void *); - size_t size; - } sz; } u; ssize_t (*write)(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); }; @@ -49,11 +44,9 @@ struct rtw_proc_hdl { #define RTW_PROC_HDL_SSEQ(_name, _show, _write) \ { .name = _name, .type = RTW_PROC_HDL_TYPE_SSEQ, .u.show = _show, .write = _write} -#define RTW_PROC_HDL_SZSEQ(_name, _show, _write, _size) \ - { .name = _name, .type = RTW_PROC_HDL_TYPE_SZSEQ, .u.sz.show = _show, .write = _write, .u.sz.size = _size} - #ifdef CONFIG_PROC_DEBUG +struct proc_dir_entry *get_rtw_drv_proc(void); int rtw_drv_proc_init(void); void rtw_drv_proc_deinit(void); struct proc_dir_entry *rtw_adapter_proc_init(struct net_device *dev); @@ -62,9 +55,10 @@ void rtw_adapter_proc_replace(struct net_device *dev); #else /* !CONFIG_PROC_DEBUG */ -static inline int rtw_drv_proc_init(void) {return _FAIL;} +#define get_rtw_drv_proc() NULL +#define rtw_drv_proc_init() 0 #define rtw_drv_proc_deinit() do {} while (0) -static inline struct proc_dir_entry *rtw_adapter_proc_init(struct net_device *dev) {return NULL;} +#define rtw_adapter_proc_init(dev) NULL #define rtw_adapter_proc_deinit(dev) do {} while (0) #define rtw_adapter_proc_replace(dev) do {} while (0)