forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ieee80211.c
....@@ -976,7 +976,7 @@
976976 }
977977
978978 int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
979
- int *pairwise_cipher, int *gmcs, u32 *akm, u8 *mfp_opt, u8 *spp_opt)
979
+ int *pairwise_cipher, int *gmcs, u32 *akm, u8 *mfp_opt)
980980 {
981981 struct rsne_info info;
982982 int i, ret = _SUCCESS;
....@@ -1019,12 +1019,6 @@
10191019 *mfp_opt = MFP_NO;
10201020 if (info.cap)
10211021 *mfp_opt = GET_RSN_CAP_MFP_OPTION(info.cap);
1022
- }
1023
-
1024
- if (spp_opt) {
1025
- *spp_opt = 0;
1026
- if (info.cap)
1027
- *spp_opt = GET_RSN_CAP_SPP_OPT(info.cap);
10281022 }
10291023
10301024 exit:
....@@ -1273,7 +1267,6 @@
12731267 * @wps_ielen: Length limit from wps_ie
12741268 * @target_attr_id: The attribute ID of WPS attribute to search
12751269 * @buf_content: If not NULL and the WPS attribute is found, WPS attribute content will be copied to the buf starting from buf_content
1276
- * If len_content is NULL, only copy one byte.
12771270 * @len_content: If not NULL and the WPS attribute is found, will set to the length of the WPS attribute content
12781271 *
12791272 * Returns: the address of the specific WPS attribute content found, or NULL
....@@ -1283,25 +1276,20 @@
12831276 u8 *attr_ptr;
12841277 u32 attr_len;
12851278
1279
+ if (len_content)
1280
+ *len_content = 0;
1281
+
12861282 attr_ptr = rtw_get_wps_attr(wps_ie, wps_ielen, target_attr_id, NULL, &attr_len);
12871283
12881284 if (attr_ptr && attr_len) {
1289
- if (len_content) {
1290
- if ((buf_content && (*len_content > (attr_len - 4))) || !buf_content)
1291
- *len_content = attr_len - 4;
1292
- }
1285
+ if (buf_content)
1286
+ _rtw_memcpy(buf_content, attr_ptr + 4, attr_len - 4);
12931287
1294
- if (len_content && buf_content) {
1295
- _rtw_memcpy(buf_content, attr_ptr + 4, *len_content);
1296
- } else if (buf_content) {
1297
- _rtw_memcpy(buf_content, attr_ptr + 4, 1);
1298
- }
1288
+ if (len_content)
1289
+ *len_content = attr_len - 4;
12991290
13001291 return attr_ptr + 4;
13011292 }
1302
-
1303
- if (len_content)
1304
- *len_content = 0;
13051293
13061294 return NULL;
13071295 }
....@@ -2326,7 +2314,6 @@
23262314 * @p2p_ielen: Length limit from p2p_ie
23272315 * @target_attr_id: The attribute ID of P2P attribute to search
23282316 * @buf_content: If not NULL and the P2P attribute is found, P2P attribute content will be copied to the buf starting from buf_content
2329
- * If len_content is NULL, only copy one byte.
23302317 * @len_content: If not NULL and the P2P attribute is found, will set to the length of the P2P attribute content
23312318 *
23322319 * Returns: the address of the specific P2P attribute content found, or NULL
....@@ -2336,25 +2323,20 @@
23362323 u8 *attr_ptr;
23372324 u32 attr_len;
23382325
2326
+ if (len_content)
2327
+ *len_content = 0;
2328
+
23392329 attr_ptr = rtw_get_p2p_attr(p2p_ie, p2p_ielen, target_attr_id, NULL, &attr_len);
23402330
23412331 if (attr_ptr && attr_len) {
2342
- if (len_content) {
2343
- if ((buf_content && (*len_content > (attr_len - 3))) || !buf_content)
2344
- *len_content = attr_len - 3;
2345
- }
2332
+ if (buf_content)
2333
+ _rtw_memcpy(buf_content, attr_ptr + 3, attr_len - 3);
23462334
2347
- if (len_content && buf_content) {
2348
- _rtw_memcpy(buf_content, attr_ptr + 3, *len_content);
2349
- } else if (buf_content) {
2350
- _rtw_memcpy(buf_content, attr_ptr + 3, 1);
2351
- }
2335
+ if (len_content)
2336
+ *len_content = attr_len - 3;
23522337
23532338 return attr_ptr + 3;
23542339 }
2355
-
2356
- if (len_content)
2357
- *len_content = 0;
23582340
23592341 return NULL;
23602342 }
....@@ -3180,50 +3162,4 @@
31803162 action = (action >= ACT_PUBLIC_MAX) ? ACT_PUBLIC_MAX : action;
31813163 return _action_public_str[action];
31823164 }
3183
-/*tmp for sta mode, root cause have to wait supplicant's update.*/
3184
-void rtw_set_spp_amsdu_mode(u8 mode, u8 *rsn_ie, int rsn_ie_len)
3185
-{
3186
- struct rsne_info info;
3187
- int i, ret = _SUCCESS;
3188
- u8 spp_req_cap = 0;
3189
-
3190
- if (mode == RTW_AMSDU_MODE_NON_SPP ) {
3191
- spp_req_cap = (u8)(~SPP_CAP | ~SPP_REQ);
3192
- } else if (mode == RTW_AMSDU_MODE_SPP) {
3193
- spp_req_cap = (u8)(SPP_CAP | SPP_REQ);
3194
- } else if (mode == RTW_AMSDU_MODE_ALL_DROP) {
3195
- spp_req_cap = (u8)(~SPP_CAP | SPP_REQ);
3196
- } else {
3197
- RTW_INFO("%s unexpected mode = %d, please check the config\n", __func__, mode);
3198
- return;
3199
- }
3200
-
3201
- ret = rtw_rsne_info_parse(rsn_ie, rsn_ie_len, &info);
3202
- if (ret != _SUCCESS)
3203
- return;
3204
-
3205
- SET_RSN_CAP_SPP(info.cap, spp_req_cap);
3206
- RTW_INFO("%s set spp opt = %d\n", __func__, GET_RSN_CAP_SPP_OPT(info.cap));
3207
-}
3208
-
3209
-u8 rtw_check_amsdu_disable(u8 mode, u8 spp_opt)
3210
-{
3211
- u8 ret = _FALSE;
3212
- RTW_INFO("%s spp_opt=%u \n", __func__, spp_opt);
3213
-
3214
- /* pp amsdu: peer's required has to be 0, or disable */
3215
- if ((mode == RTW_AMSDU_MODE_NON_SPP) && (spp_opt & SPP_REQ))
3216
- ret = _TRUE;
3217
- /* spp amsdu: peer's cap has to be 1, or disable */
3218
- else if ((mode == RTW_AMSDU_MODE_SPP) && ~(spp_opt & SPP_CAP))
3219
- ret = _TRUE;
3220
- /* mode = all drop */
3221
- else if (mode == RTW_AMSDU_MODE_ALL_DROP)
3222
- ret = _TRUE;
3223
- else
3224
- ret = _FALSE;
3225
- return ret;
3226
-}
3227
-
3228
-
32293165