Jelajahi Sumber

qcacld-3.0: Add ini to enable sae auth/assoc retry

Introduce new INI sae_connect_retries to decide auth (initial connect
and roam auth) and connect retry for sae. MAX reties is capped to 2
and max for roam auth is 1.
Default is 0x49 i.e. 1 retry each.

Bits       Retry Type
BIT[0:2]   AUTH retries
BIT[3:5]   Connection reties
BIT[6:8]   ROAM AUTH retries

Change-Id: Idae86a7bdb32244c7f3a140b8591418b8238758a
CRs-Fixed: 2728458
Abhishek Ambure 4 tahun lalu
induk
melakukan
fbdde4785a

+ 2 - 0
components/mlme/core/src/wlan_mlme_main.c

@@ -347,6 +347,8 @@ static void mlme_init_generic_cfg(struct wlan_objmgr_psoc *psoc,
 		cfg_get(psoc, CFG_DP_ENABLE_PEER_UMAP_CONF_SUPPORT);
 	gen->dfs_chan_ageout_time =
 		cfg_get(psoc, CFG_DFS_CHAN_AGEOUT_TIME);
+	gen->sae_connect_retries =
+		cfg_get(psoc, CFG_SAE_CONNECION_RETRIES);
 }
 
 static void mlme_init_edca_ani_cfg(struct wlan_mlme_edca_params *edca_params)

+ 44 - 1
components/mlme/dispatcher/inc/cfg_mlme_generic.h

@@ -710,6 +710,48 @@
 			0, 8, 0, CFG_VALUE_OR_DEFAULT, \
 			"Set DFS Channel ageout time from host to firmware")
 
+/*
+ * <ini>
+ * sae_connect_retries - Bit mask to retry Auth and full connection on assoc
+ * timeout to same AP and auth retries during roaming
+ * @Min: 0x0
+ * @Max: 0x52
+ * @Default: 0x49
+ *
+ * This ini is used to set max auth retry in auth phase of roaming and initial
+ * connection and max connection retry in case of assoc timeout. MAX Auth and
+ * connection retries are capped to 2 and roam Auth retry is capped to 1.
+ * Default is 0x49 i.e. 1 retry each.
+ *
+ * Bits       Retry Type
+ * BIT[0:2]   AUTH retries
+ * BIT[3:5]   Connection reties
+ * BIT[6:8]   ROAM AUTH retries
+ *
+ * Some Possible values are as below
+ * 0          - NO auth/roam Auth retry and NO full connection retry after
+ *              assoc timeout
+ * 0x49       - 1 auth/roam auth retry and 1 full connection retry
+ * 0x52       - 1 roam auth retry, 2 auth retry and 2 full connection retry
+ * 0x1 /0x2   - 0 roam auth retry, 1 or 2 auth retry respectively and NO full
+ *              connection retry
+ * 0x8 /0x10  - 0 roam auth retry,NO auth retry and 1 or 2 full connection retry
+ *              respectively.
+ * 0x4A       - 1 roam auth retry,2 auth retry and 1 full connection retry
+ * 0x51       - 1 auth/roam auth retry and 2 full connection retry
+ *
+ * Related: None
+ *
+ * Supported Feature: STA SAE
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SAE_CONNECION_RETRIES CFG_INI_UINT("sae_connect_retries", \
+				0, 0x52, 0x49, CFG_VALUE_OR_DEFAULT, \
+				"Bit mask to retry Auth and full connection on assoc timeout to same AP for SAE connection")
+
 #define CFG_GENERIC_ALL \
 	CFG(CFG_ENABLE_DEBUG_PACKET_LOG) \
 	CFG(CFG_PMF_SA_QUERY_MAX_RETRIES) \
@@ -740,5 +782,6 @@
 	CFG(CFG_MGMT_RETRY_MAX) \
 	CFG(CFG_BMISS_SKIP_FULL_SCAN) \
 	CFG(CFG_ENABLE_RING_BUFFER) \
-	CFG(CFG_DFS_CHAN_AGEOUT_TIME)
+	CFG(CFG_DFS_CHAN_AGEOUT_TIME) \
+	CFG(CFG_SAE_CONNECION_RETRIES)
 #endif /* __CFG_MLME_GENERIC_H */

+ 59 - 0
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -2539,6 +2539,65 @@ QDF_STATUS
 wlan_mlme_get_dfs_chan_ageout_time(struct wlan_objmgr_psoc *psoc,
 				   uint8_t *dfs_chan_ageout_time);
 
+#ifdef WLAN_FEATURE_SAE
+/**
+ * wlan_mlme_get_sae_assoc_retry_count() - Get the sae assoc retry count
+ * @psoc: pointer to psoc object
+ * @retry_count: assoc retry count
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+wlan_mlme_get_sae_assoc_retry_count(struct wlan_objmgr_psoc *psoc,
+				    uint8_t *retry_count);
+/**
+ * wlan_mlme_get_sae_assoc_retry_count() - Get the sae auth retry count
+ * @psoc: pointer to psoc object
+ * @retry_count: auth retry count
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+wlan_mlme_get_sae_auth_retry_count(struct wlan_objmgr_psoc *psoc,
+				   uint8_t *retry_count);
+
+/**
+ * wlan_mlme_get_sae_roam_auth_retry_count() - Get the sae roam auth retry count
+ * @psoc: pointer to psoc object
+ * @retry_count: auth retry count
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+wlan_mlme_get_sae_roam_auth_retry_count(struct wlan_objmgr_psoc *psoc,
+					uint8_t *retry_count);
+
+#else
+static inline QDF_STATUS
+wlan_mlme_get_sae_assoc_retry_count(struct wlan_objmgr_psoc *psoc,
+				    uint8_t *retry_count)
+{
+	*retry_count = 0;
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS
+wlan_mlme_get_sae_auth_retry_count(struct wlan_objmgr_psoc *psoc,
+				    uint8_t *retry_count)
+{
+	*retry_count = 0;
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS
+wlan_mlme_get_sae_roam_auth_retry_count(struct wlan_objmgr_psoc *psoc,
+					uint8_t *retry_count)
+{
+	*retry_count = 0;
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 /**
  * wlan_mlme_get_dual_sta_roaming_enabled  - API to get if the dual sta

+ 2 - 0
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -1108,6 +1108,7 @@ struct wlan_mlme_chainmask {
  * supports stop all host scan request type.
  * @peer_create_conf_support: Peer create confirmation command support
  * @dual_sta_roam_fw_support: Firmware support for dual sta roaming feature
+ * @sae_connect_retries: sae connect retry bitmask
  */
 struct wlan_mlme_generic {
 	enum band_info band_capability;
@@ -1148,6 +1149,7 @@ struct wlan_mlme_generic {
 	bool stop_all_host_scan_support;
 	bool peer_create_conf_support;
 	bool dual_sta_roam_fw_support;
+	uint32_t sae_connect_retries;
 };
 
 /*

+ 77 - 0
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -3928,6 +3928,83 @@ wlan_mlme_get_dfs_chan_ageout_time(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_SAE
+
+#define NUM_RETRY_BITS 3
+#define ROAM_AUTH_INDEX 2
+#define ASSOC_INDEX 1
+#define AUTH_INDEX 0
+#define MAX_RETRIES 2
+#define MAX_ROAM_AUTH_RETRIES 1
+
+QDF_STATUS
+wlan_mlme_get_sae_assoc_retry_count(struct wlan_objmgr_psoc *psoc,
+				    uint8_t *retry_count)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+
+	if (!mlme_obj) {
+		*retry_count = 0;
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	*retry_count =
+		QDF_GET_BITS(mlme_obj->cfg.gen.sae_connect_retries,
+			     ASSOC_INDEX * NUM_RETRY_BITS, NUM_RETRY_BITS);
+
+	*retry_count = QDF_MIN(MAX_RETRIES, *retry_count);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+wlan_mlme_get_sae_auth_retry_count(struct wlan_objmgr_psoc *psoc,
+				   uint8_t *retry_count)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+
+	if (!mlme_obj) {
+		*retry_count = 0;
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	*retry_count =
+		QDF_GET_BITS(mlme_obj->cfg.gen.sae_connect_retries,
+			     AUTH_INDEX * NUM_RETRY_BITS, NUM_RETRY_BITS);
+
+	*retry_count = QDF_MIN(MAX_RETRIES, *retry_count);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+wlan_mlme_get_sae_roam_auth_retry_count(struct wlan_objmgr_psoc *psoc,
+					uint8_t *retry_count)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+
+	if (!mlme_obj) {
+		*retry_count = 0;
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	*retry_count =
+		QDF_GET_BITS(mlme_obj->cfg.gen.sae_connect_retries,
+			     ROAM_AUTH_INDEX * NUM_RETRY_BITS, NUM_RETRY_BITS);
+
+	*retry_count = QDF_MIN(MAX_ROAM_AUTH_RETRIES, *retry_count);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+#endif
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 bool
 wlan_mlme_get_dual_sta_roaming_enabled(struct wlan_objmgr_psoc *psoc)

+ 14 - 2
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -55,6 +55,7 @@
 #include <cdp_txrx_peer_ops.h>
 #include "lim_process_fils.h"
 #include "wlan_utility.h"
+#include <wlan_mlme_api.h>
 
 /**
  *
@@ -5348,7 +5349,6 @@ error_delba:
 }
 
 #define WLAN_SAE_AUTH_TIMEOUT 1000
-#define WLAN_SAE_AUTH_RETRY 1
 
 /**
  * lim_tx_mgmt_frame() - Transmits Auth mgmt frame
@@ -5408,6 +5408,7 @@ lim_handle_sae_auth_retry(struct mac_context *mac_ctx, uint8_t vdev_id,
 {
 	struct pe_session *session;
 	struct sae_auth_retry *sae_retry;
+	uint8_t retry_count = 0;
 
 	session = pe_find_session_by_vdev_id(mac_ctx, vdev_id);
 	if (!session) {
@@ -5416,6 +5417,17 @@ lim_handle_sae_auth_retry(struct mac_context *mac_ctx, uint8_t vdev_id,
 		return;
 	}
 
+	if (session->limMlmState == eLIM_MLM_WT_SAE_AUTH_STATE)
+		wlan_mlme_get_sae_auth_retry_count(mac_ctx->psoc, &retry_count);
+	else
+		wlan_mlme_get_sae_roam_auth_retry_count(mac_ctx->psoc,
+							&retry_count);
+	if (!retry_count) {
+		pe_debug("vdev %d: SAE Auth retry disabled", vdev_id);
+		return;
+	}
+
+
 	sae_retry = mlme_get_sae_auth_retry(session->vdev);
 	if (!sae_retry) {
 		pe_err("sae retry pointer is NULL for vdev_id %d",
@@ -5438,7 +5450,7 @@ lim_handle_sae_auth_retry(struct mac_context *mac_ctx, uint8_t vdev_id,
 	mac_ctx->lim.lim_timers.g_lim_periodic_auth_retry_timer.sessionId =
 					session->peSessionId;
 	sae_retry->sae_auth.len = frame_len;
-	sae_retry->sae_auth_max_retry = WLAN_SAE_AUTH_RETRY;
+	sae_retry->sae_auth_max_retry = retry_count;
 
 	tx_timer_change(
 		&mac_ctx->lim.lim_timers.g_lim_periodic_auth_retry_timer,

+ 16 - 11
core/sme/src/csr/csr_api_roam.c

@@ -9067,15 +9067,16 @@ static void csr_roam_join_rsp_processor(struct mac_context *mac,
 	tSmeCmd *pCommand = NULL;
 	mac_handle_t mac_handle = MAC_HANDLE(mac);
 	struct csr_roam_session *session_ptr;
-	struct scan_result_list *bss_list = NULL;
 	struct csr_roam_profile *profile = NULL;
 	struct csr_roam_connectedinfo *prev_connect_info;
 	struct wlan_crypto_pmksa *pmksa;
 	uint32_t len = 0, roamId = 0, reason_code = 0;
 	bool is_dis_pending;
 	bool use_same_bss = false;
+	uint8_t max_retry_count = 1;
 	bool retry_same_bss = false;
 	bool attempt_next_bss = true;
+	enum csr_akm_type auth_type = eCSR_AUTH_TYPE_NONE;
 
 	if (!pSmeJoinRsp) {
 		sme_err("Sme Join Response is NULL");
@@ -9161,8 +9162,7 @@ static void csr_roam_join_rsp_processor(struct mac_context *mac,
 	if (pCommand) {
 		roamId = pCommand->u.roamCmd.roamId;
 		profile = &pCommand->u.roamCmd.roamProfile;
-		bss_list =
-			(struct scan_result_list *)pCommand->u.roamCmd.hBSSList;
+		auth_type = profile->AuthType.authType[0];
 	}
 
 	reason_code = pSmeJoinRsp->protStatusCode;
@@ -9209,11 +9209,14 @@ static void csr_roam_join_rsp_processor(struct mac_context *mac,
 	    pSmeJoinRsp->status_code == eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE &&
 	    (mlme_get_reconn_after_assoc_timeout_flag(mac->psoc,
 						     pSmeJoinRsp->vdev_id) ||
-	    (profile && (profile->AuthType.authType[0] == eCSR_AUTH_TYPE_SAE ||
-	      profile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_SAE) &&
-	    bss_list && (csr_ll_count(&bss_list->List) ==
-	    session_ptr->join_bssid_count))))
+	    (auth_type == eCSR_AUTH_TYPE_SAE ||
+	     auth_type == eCSR_AUTH_TYPE_FT_SAE))) {
 		retry_same_bss = true;
+		if (auth_type == eCSR_AUTH_TYPE_SAE ||
+		    auth_type == eCSR_AUTH_TYPE_FT_SAE)
+			wlan_mlme_get_sae_assoc_retry_count(mac->psoc,
+							    &max_retry_count);
+	}
 
 	if (attempt_next_bss && retry_same_bss &&
 	    pCommand && pCommand->u.roamCmd.pRoamBssEntry) {
@@ -9223,10 +9226,12 @@ static void csr_roam_join_rsp_processor(struct mac_context *mac,
 			GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry,
 				      struct tag_csrscan_result, Link);
 		/* Retry with same BSSID without PMKID */
-		if (!scan_result->retry_count) {
-			sme_info("Retry once with same BSSID, status %d reason %d",
-				 pSmeJoinRsp->status_code, reason_code);
-			scan_result->retry_count = 1;
+		if (scan_result->retry_count < max_retry_count) {
+			sme_info("Retry once with same BSSID, status %d reason %d auth_type %d retry count %d max count %d",
+				 pSmeJoinRsp->status_code, reason_code,
+				 auth_type, scan_result->retry_count,
+				 max_retry_count);
+			scan_result->retry_count++;
 			use_same_bss = true;
 		}
 	}