From f2d954d22e311be71e260e8c822f51ed6fadf879 Mon Sep 17 00:00:00 2001 From: Abhinav Kumar Date: Wed, 6 May 2020 20:02:16 +0530 Subject: [PATCH] qcacld-3.0: Fix emergency roaming failure DUT perform FT-IM association instead of FT roaming to process emergency deauth from connected AP. In the case of FT-IM association, FW sends assoc requests instead of re-assoc requests in roam sync indication to host. Host truncate fixed parameters from assoc req and forward frame tagged parameters to supplicants. In re-assoc request fixed params length is 10bytes and in assoc request, fixed param length is 4 bytes. Currently host always truncating 10 bytes of assoc/re-assoc frame present in roam sync ind and forward it to supplicant. This results in extra first 6 bytes of assoc frame get stripped by host. Due to this supplicant is not able to parse frame content properly. This leads to 11r roaming failure. As in case of FT-IM association roaming, FW forward assoc req in roam sync ind, Host should truncate 4 bytes of fixed parameters. Fix is to ensure that host truncate only 4 bytes if assoc request present in roam sync ind data. Change-Id: Ie1352e41f9caffc4a28ed046330a73f303af36da CRs-Fixed: 2664097 --- core/mac/inc/sir_api.h | 1 + core/mac/inc/sir_mac_prot_def.h | 5 ++++- core/mac/src/pe/include/lim_api.h | 4 ++++ core/mac/src/pe/lim/lim_api.c | 31 +++++++++++++++++++++++++++++++ core/sme/src/csr/csr_api_roam.c | 13 +++++++++++-- 5 files changed, 51 insertions(+), 3 deletions(-) diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index da3e6677675b..8eeb03a94c63 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -2945,6 +2945,7 @@ struct roam_offload_synch_ind { struct qdf_mac_addr src_mac; uint16_t hlp_data_len; uint8_t hlp_data[FILS_MAX_HLP_DATA_LEN]; + bool is_ft_im_roam; }; #ifdef WLAN_FEATURE_ROAM_OFFLOAD diff --git a/core/mac/inc/sir_mac_prot_def.h b/core/mac/inc/sir_mac_prot_def.h index 30dcaa77e70f..a7623d4188d5 100644 --- a/core/mac/inc/sir_mac_prot_def.h +++ b/core/mac/inc/sir_mac_prot_def.h @@ -251,7 +251,10 @@ #define SIR_MAC_B_PR_SSID_OFFSET 12 /* Association/Reassociation offsets */ -#define SIR_MAC_REASSOC_SSID_OFFSET 10 +#define SIR_MAC_REASSOC_REQ_SSID_OFFSET 10 + +/* Association Request offsets */ +#define SIR_MAC_ASSOC_REQ_SSID_OFFSET 4 /* / Transaction sequence number definitions (used in Authentication frames) */ #define SIR_MAC_AUTH_FRAME_1 1 diff --git a/core/mac/src/pe/include/lim_api.h b/core/mac/src/pe/include/lim_api.h index 2aaf2a84c59b..b7daccc4dec8 100644 --- a/core/mac/src/pe/include/lim_api.h +++ b/core/mac/src/pe/include/lim_api.h @@ -328,6 +328,10 @@ pe_roam_synch_callback(struct mac_context *mac_ctx, struct bss_description *bss_desc_ptr, enum sir_roam_op_code reason); +void +lim_check_ft_initial_im_association(struct roam_offload_synch_ind *roam_synch, + struct pe_session *session_entry); + /** * pe_disconnect_callback() - Callback to handle deauth event is received * from firmware diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index c4532e10e20e..5f4ac7a52f4e 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -2457,6 +2457,35 @@ lim_fill_fils_ft(struct pe_session *src_session, {} #endif +/** + * lim_check_ft_initial_im_association() - To check FT initial mobility(im) + * association + * @roam_synch: A pointer to roam sync ind structure + * @session_entry: pe session + * + * This function is to check ft_initial_im_association. + * + * Return: None + */ +void +lim_check_ft_initial_im_association(struct roam_offload_synch_ind *roam_synch, + struct pe_session *session_entry) +{ + tpSirMacMgmtHdr hdr; + uint8_t *assoc_req_ptr; + + assoc_req_ptr = (uint8_t *) roam_synch + roam_synch->reassoc_req_offset; + hdr = (tpSirMacMgmtHdr) assoc_req_ptr; + + if (hdr->fc.type == SIR_MAC_MGMT_FRAME && + hdr->fc.subType == SIR_MAC_MGMT_ASSOC_REQ && + session_entry->is11Rconnection) { + pe_debug("Frame subtype: %d and connection is %d", + hdr->fc.subType, session_entry->is11Rconnection); + roam_synch->is_ft_im_roam = true; + } +} + QDF_STATUS pe_roam_synch_callback(struct mac_context *mac_ctx, struct roam_offload_synch_ind *roam_sync_ind_ptr, @@ -2621,6 +2650,8 @@ pe_roam_synch_callback(struct mac_context *mac_ctx, lim_process_assoc_rsp_frame(mac_ctx, mac_ctx->roam.pReassocResp, LIM_REASSOC, ft_session_ptr); + lim_check_ft_initial_im_association(roam_sync_ind_ptr, ft_session_ptr); + lim_copy_and_free_hlp_data_from_session(ft_session_ptr, roam_sync_ind_ptr); diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index d751c7d03e33..0203d1a08f54 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -20776,6 +20776,7 @@ static QDF_STATUS csr_process_roam_sync_callback(struct mac_context *mac_ctx, bool abort_host_scan_cap = false; wlan_scan_id scan_id; struct wlan_crypto_pmksa *pmksa; + uint8_t ssid_offset; vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc, session_id, WLAN_LEGACY_SME_ID); @@ -21109,9 +21110,16 @@ static QDF_STATUS csr_process_roam_sync_callback(struct mac_context *mac_ctx, csr_neighbor_roam_state_transition(mac_ctx, eCSR_NEIGHBOR_ROAM_STATE_INIT, session_id); } + + if (roam_synch_data->is_ft_im_roam) { + ssid_offset = SIR_MAC_ASSOC_REQ_SSID_OFFSET; + } else { + ssid_offset = SIR_MAC_REASSOC_REQ_SSID_OFFSET; + } + roam_info->nBeaconLength = 0; roam_info->nAssocReqLength = roam_synch_data->reassoc_req_length - - SIR_MAC_HDR_LEN_3A - SIR_MAC_REASSOC_SSID_OFFSET; + SIR_MAC_HDR_LEN_3A - ssid_offset; roam_info->nAssocRspLength = roam_synch_data->reassocRespLength - SIR_MAC_HDR_LEN_3A; roam_info->pbFrames = qdf_mem_malloc(roam_info->nBeaconLength + @@ -21127,8 +21135,9 @@ static QDF_STATUS csr_process_roam_sync_callback(struct mac_context *mac_ctx, qdf_mem_copy(roam_info->pbFrames, (uint8_t *)roam_synch_data + roam_synch_data->reassoc_req_offset + - SIR_MAC_HDR_LEN_3A + SIR_MAC_REASSOC_SSID_OFFSET, + SIR_MAC_HDR_LEN_3A + ssid_offset, roam_info->nAssocReqLength); + qdf_mem_copy(roam_info->pbFrames + roam_info->nAssocReqLength, (uint8_t *)roam_synch_data + roam_synch_data->reassocRespOffset +