Ver código fonte

qcacld-3.0: Add conditional check for SAP key clearing

qcacld-2.0 to qcacld-3.0 propagation

SAP keys should be retained at HDD layer when wlan driver
performs internal restarting due to MCC to SCC switch

Change-Id: I5458f7602a0e3851d678981e107ef3b5bda17dd7
CRs-Fixed: 1095584
wadesong 8 anos atrás
pai
commit
9b81907d27

+ 4 - 0
core/cds/src/cds_concurrency.c

@@ -5982,9 +5982,13 @@ static void cds_check_sta_ap_concurrent_ch_intf(void *data)
 	if (intf_ch == 0)
 		return;
 
+	cds_info("SAP restarts due to MCC->SCC switch, orig chan: %d, new chan: %d",
+		hdd_ap_ctx->sapConfig.channel, intf_ch);
+
 	hdd_ap_ctx->sapConfig.channel = intf_ch;
 	hdd_ap_ctx->sapConfig.ch_params.ch_width =
 		hdd_ap_ctx->sapConfig.ch_width_orig;
+	hdd_ap_ctx->bss_stop_reason = BSS_STOP_DUE_TO_MCC_SCC_SWITCH;
 	cds_set_channel_params(hdd_ap_ctx->sapConfig.channel,
 			hdd_ap_ctx->sapConfig.sec_ch,
 			&hdd_ap_ctx->sapConfig.ch_params);

+ 16 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -708,6 +708,20 @@ typedef struct hdd_hostapd_state_s {
 
 } hdd_hostapd_state_t;
 
+/**
+ * enum bss_stop_reason - reasons why a BSS is stopped.
+ * @BSS_STOP_REASON_INVALID: no reason specified explicitly.
+ * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host
+ *  driver is trying to switch AP role to a different channel
+ *  to maintain SCC mode with the STA role on the same card.
+ *  this usually happens when STA is connected to an external
+ *  AP that runs on a different channel
+ */
+enum bss_stop_reason {
+	BSS_STOP_REASON_INVALID = 0,
+	BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1,
+};
+
 /*
  * Per station structure kept in HDD for multiple station support for SoftAP
  */
@@ -789,6 +803,8 @@ struct hdd_ap_ctx_s {
 	void *sapContext;
 
 	bool dfs_cac_block_tx;
+
+	enum bss_stop_reason bss_stop_reason;
 };
 
 typedef struct hdd_scaninfo_s {

+ 16 - 3
core/hdd/src/wlan_hdd_hostapd.c

@@ -1356,9 +1356,22 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 			hdd_info("P2PGO is going down now");
 			hdd_issue_stored_joinreq(sta_adapter, pHddCtx);
 		}
-		pHddApCtx->groupKey.keyLength = 0;
-		for (i = 0; i < CSR_MAX_NUM_KEY; i++)
-			pHddApCtx->wepKey[i].keyLength = 0;
+		hdd_info("bss_stop_reason=%d", pHddApCtx->bss_stop_reason);
+		if (pHddApCtx->bss_stop_reason !=
+			BSS_STOP_DUE_TO_MCC_SCC_SWITCH) {
+			/* when MCC to SCC switching happens, key storage
+			 * should not be cleared due to hostapd will not
+			 * repopulate the original keys
+			 */
+			pHddApCtx->groupKey.keyLength = 0;
+			for (i = 0; i < CSR_MAX_NUM_KEY; i++)
+				pHddApCtx->wepKey[i].keyLength = 0;
+		}
+
+		/* clear the reason code in case BSS is stopped
+		 * in another place
+		 */
+		pHddApCtx->bss_stop_reason = BSS_STOP_REASON_INVALID;
 		goto stopbss;
 
 	case eSAP_DFS_CAC_START: