Explorar o código

qcacld-3.0: Add connectivity log for BTM drop/block

Currently, driver drops BTM frames in unsupported cases,
e.g. connected to MBO AP without PMF capability, concurrent P2P
session present which doesn't allow STA roaming.

Add connectivity log support and indicate the reason for BTM
drop/block.

Define interface for userspace as below,
New subtype: WLAN_CONN_DIAG_BTM_BLOCK_EVENT
New enum to fill sub_reason for BTM_BLOCK_EVENT type

Change-Id: I87115da57d275a94c5ae69252ec09bcad698e47c
CRs-Fixed: 3699042
Srinivas Dasari hai 1 ano
pai
achega
2021b8ee2c

+ 13 - 0
components/cmn_services/logging/inc/wlan_connectivity_logging.h

@@ -168,6 +168,7 @@ enum wlan_main_tag {
  * @WLAN_CONN_DIAG_BCN_RPT_RESP_EVENT: Beacon report response
  * @WLAN_CONN_DIAG_MLO_T2LM_REQ_EVENT: MLO T2LM request
  * @WLAN_CONN_DIAG_MLO_T2LM_RESP_EVENT: MLO T2LM response
+ * @WLAN_CONN_DIAG_BTM_BLOCK_EVENT: BTM-drop indication
  * @WLAN_CONN_DIAG_MAX: MAX tag
  */
 enum qca_conn_diag_log_event_type {
@@ -218,6 +219,7 @@ enum qca_conn_diag_log_event_type {
 	WLAN_CONN_DIAG_BCN_RPT_RESP_EVENT,
 	WLAN_CONN_DIAG_MLO_T2LM_REQ_EVENT,
 	WLAN_CONN_DIAG_MLO_T2LM_RESP_EVENT,
+	WLAN_CONN_DIAG_BTM_BLOCK_EVENT,
 	WLAN_CONN_DIAG_MAX
 };
 
@@ -323,6 +325,17 @@ enum wlan_diag_connect_fail_reason {
 	WLAN_DIAG_VALID_CANDIDATE_CHECK_FAIL,
 };
 
+/**
+ * enum wlan_diag_btm_block_reason - BTM drop/ignore reason code
+ * @WLAN_DIAG_BTM_BLOCK_MBO_WO_PMF: Connected to MBO without PMF capable AP
+ * @WLAN_DIAG_BTM_BLOCK_UNSUPPORTED_P2P_CONC: p2p go/cli is present which
+ *  restricts BTM roaming
+ */
+enum wlan_diag_btm_block_reason {
+	WLAN_DIAG_BTM_BLOCK_MBO_WO_PMF = 1,
+	WLAN_DIAG_BTM_BLOCK_UNSUPPORTED_P2P_CONC = 2,
+};
+
 /**
  * struct wlan_connectivity_log_diag_cmn - Structure for diag event
  * @bssid: bssid

+ 21 - 2
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -42,7 +42,6 @@
 #include "connection_mgr/core/src/wlan_cm_main.h"
 #include "connection_mgr/core/src/wlan_cm_sm.h"
 #include "wlan_reg_ucfg_api.h"
-#include "wlan_connectivity_logging.h"
 #include "wlan_if_mgr_roam.h"
 #include "wlan_roam_debug.h"
 #include "wlan_mlo_mgr_roam.h"
@@ -7081,6 +7080,26 @@ cm_roam_btm_req_event(struct wmi_roam_btm_trigger_data *btm_data,
 	return status;
 }
 
+QDF_STATUS
+cm_roam_btm_block_event(uint8_t vdev_id, uint8_t token,
+			enum wlan_diag_btm_block_reason reason)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(wlan_diag_event, struct wlan_diag_btm_info);
+
+	qdf_mem_zero(&wlan_diag_event, sizeof(wlan_diag_event));
+
+	populate_diag_cmn(&wlan_diag_event.diag_cmn, vdev_id, 0, NULL);
+
+	wlan_diag_event.subtype = WLAN_CONN_DIAG_BTM_BLOCK_EVENT;
+	wlan_diag_event.version = DIAG_BTM_VERSION_2;
+	wlan_diag_event.token = token;
+	wlan_diag_event.sub_reason = reason;
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_BTM);
+
+	return QDF_STATUS_SUCCESS;
+}
+
 static enum wlan_diag_wifi_band
 wlan_convert_bitmap_to_band(uint8_t bitmap)
 {

+ 21 - 1
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -28,6 +28,7 @@
 
 #include "qdf_str.h"
 #include "wlan_cm_roam_public_struct.h"
+#include "wlan_connectivity_logging.h"
 
 #if defined(CONNECTIVITY_DIAG_EVENT) && \
 	defined(WLAN_FEATURE_ROAM_OFFLOAD)
@@ -673,6 +674,18 @@ cm_roam_neigh_rpt_req_event(struct wmi_neighbor_report_data *neigh_rpt,
 void
 cm_roam_neigh_rpt_resp_event(struct wmi_neighbor_report_data *neigh_rpt,
 			     uint8_t vdev_id);
+
+/**
+ * cm_roam_btm_block_event() - Send BTM block/drop logging event
+ * @vdev_id: vdev id
+ * @token: BTM token
+ * @reason: Reason for dropping the BTM frame
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+cm_roam_btm_block_event(uint8_t vdev_id, uint8_t token,
+			enum wlan_diag_btm_block_reason reason);
 #else
 static inline QDF_STATUS
 cm_roam_mgmt_frame_event(struct wlan_objmgr_vdev *vdev,
@@ -725,6 +738,13 @@ cm_roam_neigh_rpt_resp_event(struct wmi_neighbor_report_data *neigh_rpt,
 			     uint8_t vdev_id)
 {
 }
+
+static inline QDF_STATUS
+cm_roam_btm_block_event(uint8_t vdev_id, uint8_t token,
+			enum wlan_diag_btm_block_reason reason)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
 #endif /* FEATURE_CONNECTIVITY_LOGGING */
 
 /**

+ 23 - 1
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -30,6 +30,7 @@
 #include "wlan_mlme_api.h"
 #include "wlan_reg_ucfg_api.h"
 #include "wlan_cm_tgt_if_tx_api.h"
+#include "wlan_connectivity_logging.h"
 
 #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD)
 /**
@@ -1396,6 +1397,20 @@ wlan_cm_add_all_link_probe_rsp_to_scan_db(struct wlan_objmgr_psoc *psoc,
  */
 bool wlan_cm_is_mbo_ap_without_pmf(struct wlan_objmgr_psoc *psoc,
 				   uint8_t vdev_id);
+
+/**
+ * wlan_cm_roam_btm_block_event() - Send BTM block/drop logging event
+ * @vdev_id: vdev id
+ * @token: BTM token
+ * @reason: Reason for dropping the BTM frame
+ *
+ * This is wrapper for cm_roam_btm_block_event()
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_cm_roam_btm_block_event(uint8_t vdev_id, uint8_t token,
+			     enum wlan_diag_btm_block_reason reason);
 #else
 static inline
 void wlan_cm_roam_activate_pcl_per_vdev(struct wlan_objmgr_psoc *psoc,
@@ -1671,6 +1686,13 @@ bool wlan_cm_is_mbo_ap_without_pmf(struct wlan_objmgr_psoc *psoc,
 {
 	return false;
 }
+
+static inline QDF_STATUS
+wlan_cm_roam_btm_block_event(uint8_t vdev_id, uint8_t token,
+			     enum wlan_diag_btm_block_reason reason)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
 #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
 
 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_FEATURE_ROAM_OFFLOAD)

+ 8 - 1
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -4738,6 +4738,13 @@ bool wlan_cm_is_mbo_ap_without_pmf(struct wlan_objmgr_psoc *psoc,
 {
 	return cm_is_mbo_ap_without_pmf(psoc, vdev_id);
 }
+
+QDF_STATUS
+wlan_cm_roam_btm_block_event(uint8_t vdev_id, uint8_t token,
+			     enum wlan_diag_btm_block_reason reason)
+{
+	return cm_roam_btm_block_event(vdev_id, token, reason);
+}
 #else
 QDF_STATUS
 cm_roam_stats_event_handler(struct wlan_objmgr_psoc *psoc,

+ 64 - 33
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -1043,6 +1043,64 @@ static void lim_handle_unknown_a2_index_frames(struct mac_context *mac_ctx,
 	return;
 }
 
+static bool
+lim_is_ignore_btm_frame(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
+			tSirMacFrameCtl fc, uint8_t *body, uint16_t frm_len)
+{
+	bool is_sta_roam_disabled_by_p2p, is_mbo_wo_pmf;
+	uint8_t action_id, category, token = 0;
+	tpSirMacActionFrameHdr action_hdr;
+	enum wlan_diag_btm_block_reason reason;
+
+	/*
+	 * Drop BTM frame received on STA interface if concurrent
+	 * P2P connection is active and p2p_disable_roam ini is
+	 * enabled. This will help to avoid scan triggered by
+	 * userspace after processing the BTM frame from AP so the
+	 * audio glitches are not seen in P2P connection.
+	 */
+	is_sta_roam_disabled_by_p2p = cfg_p2p_is_roam_config_disabled(psoc) &&
+		(policy_mgr_mode_specific_connection_count(psoc,
+							   PM_P2P_CLIENT_MODE,
+							   NULL) ||
+		 policy_mgr_mode_specific_connection_count(psoc,
+							   PM_P2P_GO_MODE,
+							   NULL));
+
+	is_mbo_wo_pmf = wlan_cm_is_mbo_ap_without_pmf(psoc, vdev_id);
+	if (!is_sta_roam_disabled_by_p2p && !is_mbo_wo_pmf)
+		return false;
+
+	action_hdr = (tpSirMacActionFrameHdr)body;
+
+	if (frm_len < sizeof(*action_hdr) || !action_hdr ||
+	    fc.type != SIR_MAC_MGMT_FRAME || fc.subType != SIR_MAC_MGMT_ACTION)
+		return false;
+
+	action_id = action_hdr->actionID;
+	category = action_hdr->category;
+	if (category == ACTION_CATEGORY_WNM &&
+	    (action_id == WNM_BSS_TM_QUERY ||
+	     action_id == WNM_BSS_TM_REQUEST ||
+	     action_id == WNM_BSS_TM_RESPONSE)) {
+		if (frm_len >= sizeof(*action_hdr) + 1)
+			token = *(body + sizeof(*action_hdr));
+		if (is_mbo_wo_pmf) {
+			pe_debug("Drop the BTM frame as it's received from MBO AP without PMF, vdev %d",
+				 vdev_id);
+			reason = WLAN_DIAG_BTM_BLOCK_MBO_WO_PMF;
+		} else {
+			pe_debug("Drop the BTM frame as p2p session is active, vdev %d",
+				 vdev_id);
+			reason = WLAN_DIAG_BTM_BLOCK_UNSUPPORTED_P2P_CONC;
+		}
+		wlan_cm_roam_btm_block_event(vdev_id, token, reason);
+		return true;
+	}
+
+	return false;
+}
+
 /**
  * lim_check_mgmt_registered_frames() - This function handles registered
  *                                      management frames.
@@ -1069,15 +1127,13 @@ lim_check_mgmt_registered_frames(struct mac_context *mac_ctx, uint8_t *buff_desc
 	uint16_t frm_len;
 	uint8_t type, sub_type;
 	bool match = false;
-	tpSirMacActionFrameHdr action_hdr;
-	uint8_t actionID, category, vdev_id = WLAN_INVALID_VDEV_ID;
+	uint8_t vdev_id = WLAN_INVALID_VDEV_ID;
 	QDF_STATUS qdf_status;
 
 	hdr = WMA_GET_RX_MAC_HEADER(buff_desc);
 	fc = hdr->fc;
 	frm_type = (fc.type << 2) | (fc.subType << 4);
 	body = WMA_GET_RX_MPDU_DATA(buff_desc);
-	action_hdr = (tpSirMacActionFrameHdr)body;
 	frm_len = WMA_GET_RX_PAYLOAD_LEN(buff_desc);
 
 	qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
@@ -1122,36 +1178,11 @@ lim_check_mgmt_registered_frames(struct mac_context *mac_ctx, uint8_t *buff_desc
 	if (match) {
 		pe_debug("rcvd frame match with registered frame params");
 
-		/*
-		 * Drop BTM frame received on STA interface if concurrent
-		 * P2P connection is active and p2p_disable_roam ini is
-		 * enabled. This will help to avoid scan triggered by
-		 * userspace after processing the BTM frame from AP so the
-		 * audio glitches are not seen in P2P connection.
-		 */
 		if (session_entry && LIM_IS_STA_ROLE(session_entry) &&
-		    ((cfg_p2p_is_roam_config_disabled(mac_ctx->psoc) &&
-		      (policy_mgr_mode_specific_connection_count(mac_ctx->psoc,
-						PM_P2P_CLIENT_MODE, NULL) ||
-		       policy_mgr_mode_specific_connection_count(mac_ctx->psoc,
-						PM_P2P_GO_MODE, NULL))) ||
-		     wlan_cm_is_mbo_ap_without_pmf(mac_ctx->psoc,
-						   session_entry->vdev_id))) {
-			if (frm_len >= sizeof(*action_hdr) && action_hdr &&
-			    fc.type == SIR_MAC_MGMT_FRAME &&
-			    fc.subType == SIR_MAC_MGMT_ACTION) {
-				actionID = action_hdr->actionID;
-				category = action_hdr->category;
-				if (category == ACTION_CATEGORY_WNM &&
-				    (actionID == WNM_BSS_TM_QUERY ||
-				     actionID == WNM_BSS_TM_REQUEST ||
-				     actionID == WNM_BSS_TM_RESPONSE)) {
-					pe_debug("Drop the BTM frame as p2p session is active or rcvd from MBO AP without PMF, vdev %d",
-						 session_entry->vdev_id);
-					return match;
-				}
-			}
-		}
+		    lim_is_ignore_btm_frame(mac_ctx->psoc,
+					    session_entry->vdev_id, fc, body,
+					    frm_len))
+			return match;
 
 		/*
 		 * Some frames like GAS_INITIAL_REQ are registered with