From cde9070d9970eef1f7ec2360586c802a16230ad8 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Fri, 10 May 2024 07:43:50 +0000 Subject: [PATCH] rtl88x2CE_WiFi_linux driver --- kernel/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ieee80211.c | 94 +++++++--------------------------------------- 1 files changed, 15 insertions(+), 79 deletions(-) diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ieee80211.c b/kernel/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ieee80211.c index d76ab97..26d4d4b 100644 --- a/kernel/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ieee80211.c +++ b/kernel/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ieee80211.c @@ -976,7 +976,7 @@ } int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, - int *pairwise_cipher, int *gmcs, u32 *akm, u8 *mfp_opt, u8 *spp_opt) + int *pairwise_cipher, int *gmcs, u32 *akm, u8 *mfp_opt) { struct rsne_info info; int i, ret = _SUCCESS; @@ -1019,12 +1019,6 @@ *mfp_opt = MFP_NO; if (info.cap) *mfp_opt = GET_RSN_CAP_MFP_OPTION(info.cap); - } - - if (spp_opt) { - *spp_opt = 0; - if (info.cap) - *spp_opt = GET_RSN_CAP_SPP_OPT(info.cap); } exit: @@ -1273,7 +1267,6 @@ * @wps_ielen: Length limit from wps_ie * @target_attr_id: The attribute ID of WPS attribute to search * @buf_content: If not NULL and the WPS attribute is found, WPS attribute content will be copied to the buf starting from buf_content - * If len_content is NULL, only copy one byte. * @len_content: If not NULL and the WPS attribute is found, will set to the length of the WPS attribute content * * Returns: the address of the specific WPS attribute content found, or NULL @@ -1283,25 +1276,20 @@ u8 *attr_ptr; u32 attr_len; + if (len_content) + *len_content = 0; + attr_ptr = rtw_get_wps_attr(wps_ie, wps_ielen, target_attr_id, NULL, &attr_len); if (attr_ptr && attr_len) { - if (len_content) { - if ((buf_content && (*len_content > (attr_len - 4))) || !buf_content) - *len_content = attr_len - 4; - } + if (buf_content) + _rtw_memcpy(buf_content, attr_ptr + 4, attr_len - 4); - if (len_content && buf_content) { - _rtw_memcpy(buf_content, attr_ptr + 4, *len_content); - } else if (buf_content) { - _rtw_memcpy(buf_content, attr_ptr + 4, 1); - } + if (len_content) + *len_content = attr_len - 4; return attr_ptr + 4; } - - if (len_content) - *len_content = 0; return NULL; } @@ -2326,7 +2314,6 @@ * @p2p_ielen: Length limit from p2p_ie * @target_attr_id: The attribute ID of P2P attribute to search * @buf_content: If not NULL and the P2P attribute is found, P2P attribute content will be copied to the buf starting from buf_content - * If len_content is NULL, only copy one byte. * @len_content: If not NULL and the P2P attribute is found, will set to the length of the P2P attribute content * * Returns: the address of the specific P2P attribute content found, or NULL @@ -2336,25 +2323,20 @@ u8 *attr_ptr; u32 attr_len; + if (len_content) + *len_content = 0; + attr_ptr = rtw_get_p2p_attr(p2p_ie, p2p_ielen, target_attr_id, NULL, &attr_len); if (attr_ptr && attr_len) { - if (len_content) { - if ((buf_content && (*len_content > (attr_len - 3))) || !buf_content) - *len_content = attr_len - 3; - } + if (buf_content) + _rtw_memcpy(buf_content, attr_ptr + 3, attr_len - 3); - if (len_content && buf_content) { - _rtw_memcpy(buf_content, attr_ptr + 3, *len_content); - } else if (buf_content) { - _rtw_memcpy(buf_content, attr_ptr + 3, 1); - } + if (len_content) + *len_content = attr_len - 3; return attr_ptr + 3; } - - if (len_content) - *len_content = 0; return NULL; } @@ -3180,50 +3162,4 @@ action = (action >= ACT_PUBLIC_MAX) ? ACT_PUBLIC_MAX : action; return _action_public_str[action]; } -/*tmp for sta mode, root cause have to wait supplicant's update.*/ -void rtw_set_spp_amsdu_mode(u8 mode, u8 *rsn_ie, int rsn_ie_len) -{ - struct rsne_info info; - int i, ret = _SUCCESS; - u8 spp_req_cap = 0; - - if (mode == RTW_AMSDU_MODE_NON_SPP ) { - spp_req_cap = (u8)(~SPP_CAP | ~SPP_REQ); - } else if (mode == RTW_AMSDU_MODE_SPP) { - spp_req_cap = (u8)(SPP_CAP | SPP_REQ); - } else if (mode == RTW_AMSDU_MODE_ALL_DROP) { - spp_req_cap = (u8)(~SPP_CAP | SPP_REQ); - } else { - RTW_INFO("%s unexpected mode = %d, please check the config\n", __func__, mode); - return; - } - - ret = rtw_rsne_info_parse(rsn_ie, rsn_ie_len, &info); - if (ret != _SUCCESS) - return; - - SET_RSN_CAP_SPP(info.cap, spp_req_cap); - RTW_INFO("%s set spp opt = %d\n", __func__, GET_RSN_CAP_SPP_OPT(info.cap)); -} - -u8 rtw_check_amsdu_disable(u8 mode, u8 spp_opt) -{ - u8 ret = _FALSE; - RTW_INFO("%s spp_opt=%u \n", __func__, spp_opt); - - /* pp amsdu: peer's required has to be 0, or disable */ - if ((mode == RTW_AMSDU_MODE_NON_SPP) && (spp_opt & SPP_REQ)) - ret = _TRUE; - /* spp amsdu: peer's cap has to be 1, or disable */ - else if ((mode == RTW_AMSDU_MODE_SPP) && ~(spp_opt & SPP_CAP)) - ret = _TRUE; - /* mode = all drop */ - else if (mode == RTW_AMSDU_MODE_ALL_DROP) - ret = _TRUE; - else - ret = _FALSE; - return ret; -} - - -- Gitblit v1.6.2