diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index 8ab3786f59..93d9ca502a 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -1389,6 +1389,7 @@ static void mlme_init_sta_cfg(struct wlan_objmgr_psoc *psoc, cfg_get(psoc, CFG_QCN_IE_SUPPORT); sta->fils_max_chan_guard_time = cfg_get(psoc, CFG_FILS_MAX_CHAN_GUARD_TIME); + sta->deauth_retry_cnt = cfg_get(psoc, CFG_DEAUTH_RETRY_CNT); sta->single_tid = cfg_get(psoc, CFG_SINGLE_TID_RC); sta->sta_miracast_mcc_rest_time = diff --git a/components/mlme/dispatcher/inc/cfg_mlme_sta.h b/components/mlme/dispatcher/inc/cfg_mlme_sta.h index 63643aa0d5..3d3e068a3d 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_sta.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_sta.h @@ -193,6 +193,31 @@ 0, \ "send deauth before connection") +/* + * + * deauth_retry_cnt- No. of deauth retries if the Tx is failed + * @Min: 0 + * @Max: 4 + * @Default: 2 + * + * This ini is used to set retry deauth if Tx is not success. + * + * Related: None + * + * Supported Feature: STA + * + * Usage: Internal/External + * + * + */ +#define CFG_DEAUTH_RETRY_CNT CFG_INI_UINT( \ + "deauth_retry_cnt", \ + 0, \ + 4, \ + 2, \ + CFG_VALUE_OR_DEFAULT, \ + "Set Deauth retry count") + /* * * gDot11PMode - 802.11p mode @@ -441,6 +466,7 @@ CFG(CFG_PPS_ENABLE_5G_EBT) \ CFG(CFG_ENABLE_DEAUTH_BEFORE_CONNECTION) \ CFG(CFG_DOT11P_MODE) \ + CFG(CFG_DEAUTH_RETRY_CNT) \ CFG(CFG_ENABLE_GO_CTS2SELF_FOR_STA) \ CFG(CFG_QCN_IE_SUPPORT) \ CFG(CFG_STA_MCAST_MCC_REST_TIME) \ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index 5c4a999038..aec507c255 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -1331,6 +1331,7 @@ enum station_keepalive_method { * @dot11p_mode: Set 802.11p mode * @fils_max_chan_guard_time: Set maximum channel guard time * @current_rssi: Current rssi + * @deauth_retry_cnt: Deauth retry count * @ignore_peer_erp_info: Ignore peer infrormation * @sta_prefer_80mhz_over_160mhz: Set Sta preference to connect in 80HZ/160HZ * @enable_5g_ebt: Set default 5G early beacon termination @@ -1351,6 +1352,7 @@ struct wlan_mlme_sta_cfg { enum dot11p_mode dot11p_mode; uint8_t fils_max_chan_guard_time; uint8_t current_rssi; + uint8_t deauth_retry_cnt; bool ignore_peer_erp_info; bool sta_prefer_80mhz_over_160mhz; bool enable_5g_ebt; diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 641e8d8ed0..02d9082567 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -1366,6 +1366,18 @@ struct deauth_req { uint16_t reasonCode; }; +/** + * struct deauth_retry_params - deauth retry params + * @peer_mac: peer mac + * @reason_code: reason for disconnect indication + * @retry_cnt: retry count + */ +struct deauth_retry_params { + struct qdf_mac_addr peer_macaddr; + uint16_t reason_code; + uint8_t retry_cnt; +}; + /* / Definition for Deauthetication response */ struct deauth_rsp { uint16_t messageType; /* eWNI_SME_DEAUTH_RSP */ diff --git a/core/mac/src/pe/include/lim_session.h b/core/mac/src/pe/include/lim_session.h index b63af3ffca..87e7c81cfd 100644 --- a/core/mac/src/pe/include/lim_session.h +++ b/core/mac/src/pe/include/lim_session.h @@ -539,6 +539,7 @@ struct pe_session { uint8_t bss_color_changing; #endif #endif + struct deauth_retry_params deauth_retry; bool enable_bcast_probe_rsp; uint8_t ht_client_cnt; bool force_24ghz_in_ht20; diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index 742ccd42a6..b95fd2d212 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -3220,6 +3220,10 @@ static QDF_STATUS lim_deauth_tx_complete_cnf_handler(void *context, struct mac_context *mac_ctx = (struct mac_context *)context; QDF_STATUS status_code; struct scheduler_msg msg = {0}; + tLimMlmDeauthReq *deauth_req; + struct pe_session *session = NULL; + + deauth_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; pe_debug("tx_complete = %s tx_success = %d", (tx_success == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ? @@ -3227,6 +3231,22 @@ static QDF_STATUS lim_deauth_tx_complete_cnf_handler(void *context, if (buf) qdf_nbuf_free(buf); + if (deauth_req) + session = pe_find_session_by_session_id(mac_ctx, + deauth_req->sessionId); + if (tx_success != WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK && session && + session->deauth_retry.retry_cnt) { + if (tx_timer_running( + &mac_ctx->lim.lim_timers.gLimDeauthAckTimer)) + lim_deactivate_and_change_timer(mac_ctx, + eLIM_DEAUTH_ACK_TIMER); + lim_send_deauth_mgmt_frame(mac_ctx, + session->deauth_retry.reason_code, + session->deauth_retry.peer_macaddr.bytes, + session, true); + session->deauth_retry.retry_cnt--; + return QDF_STATUS_SUCCESS; + } msg.type = (uint16_t) WMA_DEAUTH_TX_COMP; msg.bodyptr = params; msg.bodyval = tx_success; @@ -3594,6 +3614,15 @@ lim_send_deauth_mgmt_frame(struct mac_context *mac, lim_diag_mgmt_tx_event_report(mac, pMacHdr, pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); + if (pe_session->opmode == QDF_STA_MODE && + mac->mlme_cfg->sta.deauth_retry_cnt && + !pe_session->deauth_retry.retry_cnt) { + pe_session->deauth_retry.retry_cnt = + mac->mlme_cfg->sta.deauth_retry_cnt; + pe_session->deauth_retry.reason_code = nReason; + qdf_mem_copy(pe_session->deauth_retry.peer_macaddr.bytes, + peer, QDF_MAC_ADDR_SIZE); + } /* Queue Disassociation frame in high priority WQ */ qdf_status = wma_tx_frameWithTxComplete(mac, pPacket, (uint16_t) nBytes,