Browse Source

qcacld-3.0: Avoid disconnect for 2nd beacon CAPS mismatch

When beacon CAPS mismatch happens, host send a probe
request to see if probe response has also mismatch.

If both probe response and beacon has mismatch, driver
initiate a disconnect.

In case if before probe response is received a second
beacon is received, as caps are anyway mismatching,
driver disconnects.

To avoid this false alarm, if beacon is received again
before probe response send probe request again,
instead of disconnecting.

Change-Id: I51960876eb1cf3bc5c7ee97a41c36f686e08e9e4
CRs-Fixed: 3500334
Abhishek Singh 1 year ago
parent
commit
368b1b603d

+ 14 - 4
core/mac/src/pe/include/lim_api.h

@@ -274,10 +274,20 @@ void lim_send_sme_tdls_del_sta_ind(struct mac_context *mac, tpDphHashNode sta,
 				   uint16_t reasonCode);
 #endif
 
-/* / Function that checks for change in AP's capabilities on STA */
-void lim_detect_change_in_ap_capabilities(struct mac_context *,
-					  tpSirProbeRespBeacon,
-					  struct pe_session *);
+/**
+ * lim_detect_change_in_ap_capabilities() - Detect any change in AP's
+ * capabilities.
+ * @mac: Pointer to Global MAC structure
+ * @pBeacon: Pointer to parsed Beacon/probe rsp structure
+ * @session: pe session
+ * @is_bcn: if passed pointer is beacon or probe
+ *
+ * Return: void
+ */
+void lim_detect_change_in_ap_capabilities(struct mac_context *mac,
+					  tpSirProbeRespBeacon pBeacon,
+					  struct pe_session *session,
+					  bool is_bcn);
 
 QDF_STATUS lim_update_short_slot(struct mac_context *mac,
 				    tpSirProbeRespBeacon pBeacon,

+ 17 - 37
core/mac/src/pe/lim/lim_api.c

@@ -1511,33 +1511,11 @@ lim_enc_type_matched(struct mac_context *mac_ctx,
 	return false;
 }
 
-/**
- * lim_detect_change_in_ap_capabilities()
- *
- ***FUNCTION:
- * This function is called while SCH is processing
- * received Beacon from AP on STA to detect any
- * change in AP's capabilities. If there any change
- * is detected, Roaming is informed of such change
- * so that it can trigger reassociation.
- *
- ***LOGIC:
- *
- ***ASSUMPTIONS:
- *
- ***NOTE:
- * Notification is enabled for STA product only since
- * it is not a requirement on BP side.
- *
- * @param  mac      Pointer to Global MAC structure
- * @param  pBeacon   Pointer to parsed Beacon structure
- * @return None
- */
-
 void
 lim_detect_change_in_ap_capabilities(struct mac_context *mac,
 				     tpSirProbeRespBeacon pBeacon,
-				     struct pe_session *pe_session)
+				     struct pe_session *pe_session,
+				     bool is_bcn)
 {
 	uint8_t len;
 	uint32_t new_chan_freq;
@@ -1563,16 +1541,17 @@ lim_detect_change_in_ap_capabilities(struct mac_context *mac,
 		(new_chan_freq != 0)) ||
 	      (false == security_caps_matched)
 	     ))) {
-		if (false == pe_session->fWaitForProbeRsp) {
+		if (!pe_session->fWaitForProbeRsp || is_bcn) {
 			/* If Beacon capabilities is not matching with the current capability,
 			 * then send unicast probe request to AP and take decision after
 			 * receiving probe response */
-			if (true == pe_session->fIgnoreCapsChange) {
-				pe_debug("Ignoring the Capability change as it is false alarm");
+			if (pe_session->fIgnoreCapsChange) {
+				pe_debug_rl("Ignore the Capability change as probe rsp Capability matched");
 				return;
 			}
 			pe_session->fWaitForProbeRsp = true;
-			pe_warn("AP capabilities are not matching, sending directed probe request");
+			pe_info(QDF_MAC_ADDR_FMT ": capabilities are not matching, sending directed probe request",
+				QDF_MAC_ADDR_REF(pe_session->bssId));
 			status =
 				lim_send_probe_req_mgmt_frame(
 					mac, &pe_session->ssId,
@@ -1596,8 +1575,9 @@ lim_detect_change_in_ap_capabilities(struct mac_context *mac,
 		      pBeacon->ssId.length + 1;
 
 		if (new_chan_freq != pe_session->curr_op_freq) {
-			pe_err("Channel freq Change from %d --> %d Ignoring beacon!",
-			       pe_session->curr_op_freq, new_chan_freq);
+			pe_info(QDF_MAC_ADDR_FMT ": Channel freq Change from %d --> %d Ignoring beacon!",
+				QDF_MAC_ADDR_REF(pe_session->bssId),
+				pe_session->curr_op_freq, new_chan_freq);
 			return;
 		}
 
@@ -1613,29 +1593,29 @@ lim_detect_change_in_ap_capabilities(struct mac_context *mac,
 		 */
 		else if ((SIR_MAC_GET_PRIVACY(ap_cap) == 0) &&
 			 (pBeacon->rsnPresent || pBeacon->wpaPresent)) {
-			pe_err("BSS Caps (Privacy) bit 0 in beacon, but WPA or RSN IE present, Ignore Beacon!");
+			pe_info_rl(QDF_MAC_ADDR_FMT ": BSS Caps (Privacy) bit 0 in beacon, but WPA or RSN IE present, Ignore Beacon!",
+				   QDF_MAC_ADDR_REF(pe_session->bssId));
 			return;
 		}
 
 		pe_session->fIgnoreCapsChange = false;
 		pe_session->fWaitForProbeRsp = false;
 		pe_session->limSentCapsChangeNtf = true;
-		pe_err("Disconnect as cap mismatch!");
+		pe_info(QDF_MAC_ADDR_FMT ": initiate Disconnect due to cap mismatch!",
+			QDF_MAC_ADDR_REF(pe_session->bssId));
 		lim_send_deauth_mgmt_frame(mac, REASON_UNSPEC_FAILURE,
 					   pe_session->bssId, pe_session,
 					   false);
 		lim_tear_down_link_with_ap(mac, pe_session->peSessionId,
 					   REASON_UNSPEC_FAILURE,
 					   eLIM_HOST_DISASSOC);
-	} else if (true == pe_session->fWaitForProbeRsp) {
+	} else if (pe_session->fWaitForProbeRsp) {
 		/* Only for probe response frames and matching capabilities the control
 		 * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp
 		 * will be false, the control will not come here*/
 
-		pe_debug("capabilities in probe response are"
-				       "matching with the current setting,"
-				       "Ignoring subsequent capability"
-				       "mismatch");
+		pe_debug(QDF_MAC_ADDR_FMT ": capabilities in probe rsp are matching, so ignoring capability mismatch",
+			 QDF_MAC_ADDR_REF(pe_session->bssId));
 		pe_session->fIgnoreCapsChange = true;
 		pe_session->fWaitForProbeRsp = false;
 	}

+ 2 - 1
core/mac/src/pe/lim/lim_process_probe_rsp_frame.c

@@ -155,7 +155,8 @@ lim_process_updated_ies_in_probe_rsp(struct mac_context *mac_ctx,
 		if (session_entry->fWaitForProbeRsp) {
 			pe_warn("Check probe resp for caps change");
 			lim_detect_change_in_ap_capabilities(mac_ctx, probe_rsp,
-							     session_entry);
+							     session_entry,
+							     false);
 		}
 	}
 }

+ 1 - 1
core/mac/src/pe/sch/sch_beacon_process.c

@@ -290,7 +290,7 @@ sch_bcn_process_sta(struct mac_context *mac_ctx,
 		return false;
 	}
 
-	lim_detect_change_in_ap_capabilities(mac_ctx, bcn, session);
+	lim_detect_change_in_ap_capabilities(mac_ctx, bcn, session, true);
 	beaconParams->bss_idx = session->vdev_id;
 	qdf_mem_copy((uint8_t *) &session->lastBeaconTimeStamp,
 			(uint8_t *) bcn->timeStamp, sizeof(uint64_t));