Forráskód Böngészése

qcacld-3.0: Enable SAE auth cache api for Diag logging

SAE authentication frames during roaming should be cached and
printed after roam scan done print. This support is not present
in diag logging.
Enable SAE auth frame caching for diag logging.

Change-Id: I205bd2fd1c91253d1e6aaf3361857baf67ccd6fd
CRs-Fixed: 3254216
Pragaspathi Thilagaraj 2 éve
szülő
commit
74d3b5dbcb

+ 25 - 10
components/cmn_services/logging/inc/wlan_connectivity_logging.h

@@ -764,53 +764,63 @@ struct wlan_connectivity_log_buf_data {
 #define logging_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_QDF, ## params)
 #define logging_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_QDF, ## params)
 
-#if defined(WLAN_FEATURE_CONNECTIVITY_LOGGING) && \
+#if (defined(WLAN_FEATURE_CONNECTIVITY_LOGGING) || \
+	defined(CONNECTIVITY_DIAG_EVENT)) && \
 	defined(WLAN_FEATURE_ROAM_OFFLOAD)
 /**
  * wlan_print_cached_sae_auth_logs() - Enqueue SAE authentication frame logs
+ * @psoc: Global psoc pointer
  * @bssid:  BSSID
  * @vdev_id: Vdev id
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS wlan_print_cached_sae_auth_logs(struct qdf_mac_addr *bssid,
+QDF_STATUS wlan_print_cached_sae_auth_logs(struct wlan_objmgr_psoc *psoc,
+					   struct qdf_mac_addr *bssid,
 					   uint8_t vdev_id);
 
 /**
  * wlan_is_log_record_present_for_bssid() - Check if there is existing log
  * record for the given bssid
+ * @psoc: Global psoc pointer
  * @bssid: BSSID
  * @vdev_id: vdev id
  *
  * Return: true if record is present else false
  */
-bool wlan_is_log_record_present_for_bssid(struct qdf_mac_addr *bssid,
+bool wlan_is_log_record_present_for_bssid(struct wlan_objmgr_psoc *psoc,
+					  struct qdf_mac_addr *bssid,
 					  uint8_t vdev_id);
 
 /**
  * wlan_clear_sae_auth_logs_cache() - Clear the cached auth related logs
+ * @psoc: Pointer to global psoc object
  * @vdev_id: vdev id
  *
  * Return: None
  */
-void wlan_clear_sae_auth_logs_cache(uint8_t vdev_id);
+void wlan_clear_sae_auth_logs_cache(struct wlan_objmgr_psoc *psoc,
+				    uint8_t vdev_id);
 #else
 static inline
-QDF_STATUS wlan_print_cached_sae_auth_logs(struct qdf_mac_addr *bssid,
+QDF_STATUS wlan_print_cached_sae_auth_logs(struct wlan_objmgr_psoc *psoc,
+					   struct qdf_mac_addr *bssid,
 					   uint8_t vdev_id)
 {
 	return QDF_STATUS_SUCCESS;
 }
 
 static inline
-bool wlan_is_log_record_present_for_bssid(struct qdf_mac_addr *bssid,
+bool wlan_is_log_record_present_for_bssid(struct wlan_objmgr_psoc *psoc,
+					  struct qdf_mac_addr *bssid,
 					  uint8_t vdev_id)
 {
 	return false;
 }
 
 static inline
-void wlan_clear_sae_auth_logs_cache(uint8_t vdev_id)
+void wlan_clear_sae_auth_logs_cache(struct wlan_objmgr_psoc *psoc,
+				    uint8_t vdev_id)
 {}
 #endif
 
@@ -818,6 +828,7 @@ void wlan_clear_sae_auth_logs_cache(uint8_t vdev_id)
 /**
  * wlan_connectivity_mgmt_event()  - Fill and enqueue a new record
  * for management frame information.
+ * @psoc: Pointer to global psoc object
  * @mac_hdr: 802.11 management frame header
  * @vdev_id: Vdev id
  * @status_code: Frame status code as defined in IEEE 802.11 - 2020 standard
@@ -836,7 +847,8 @@ void wlan_clear_sae_auth_logs_cache(uint8_t vdev_id)
  * Return: QDF_STATUS
  */
 void
-wlan_connectivity_mgmt_event(struct wlan_frame_hdr *mac_hdr,
+wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
+			     struct wlan_frame_hdr *mac_hdr,
 			     uint8_t vdev_id, uint16_t status_code,
 			     enum qdf_dp_tx_rx_status tx_status,
 			     int8_t peer_rssi,
@@ -887,6 +899,7 @@ QDF_STATUS wlan_connectivity_log_enqueue(struct wlan_log_record *new_record);
 /**
  * wlan_connectivity_mgmt_event()  - Fill and enqueue a new record
  * for management frame information.
+ * @psoc: Pointer to global psoc object
  * @mac_hdr: 802.11 management frame header
  * @vdev_id: Vdev id
  * @status_code: Frame status code as defined in IEEE 802.11 - 2020 standard
@@ -905,7 +918,8 @@ QDF_STATUS wlan_connectivity_log_enqueue(struct wlan_log_record *new_record);
  * Return: QDF_STATUS
  */
 void
-wlan_connectivity_mgmt_event(struct wlan_frame_hdr *mac_hdr,
+wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
+			     struct wlan_frame_hdr *mac_hdr,
 			     uint8_t vdev_id, uint16_t status_code,
 			     enum qdf_dp_tx_rx_status tx_status,
 			     int8_t peer_rssi,
@@ -934,7 +948,8 @@ QDF_STATUS wlan_connectivity_log_enqueue(struct wlan_log_record *new_record)
 }
 
 static inline void
-wlan_connectivity_mgmt_event(struct wlan_frame_hdr *mac_hdr,
+wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
+			     struct wlan_frame_hdr *mac_hdr,
 			     uint8_t vdev_id, uint16_t status_code,
 			     enum qdf_dp_tx_rx_status tx_status,
 			     int8_t peer_rssi,

+ 247 - 33
components/cmn_services/logging/src/wlan_connectivity_logging.c

@@ -88,16 +88,43 @@ void wlan_connectivity_logging_stop(void)
 }
 #endif
 
+#ifdef WLAN_FEATURE_ROAM_OFFLOAD
+void wlan_clear_sae_auth_logs_cache(struct wlan_objmgr_psoc *psoc,
+				    uint8_t vdev_id)
+{
+	struct wlan_objmgr_vdev *vdev;
+	struct mlme_legacy_priv *mlme_priv;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_OBJMGR_ID);
+	if (!vdev) {
+		logging_err_rl("Invalid vdev:%d", vdev_id);
+		return;
+	}
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+		logging_err_rl("vdev legacy private object is NULL");
+		return;
+	}
+
+	qdf_mem_zero(mlme_priv->auth_log, sizeof(mlme_priv->auth_log));
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+}
+#endif
+
 #if defined(WLAN_FEATURE_ROAM_OFFLOAD) && \
 	defined(WLAN_FEATURE_CONNECTIVITY_LOGGING)
-QDF_STATUS wlan_print_cached_sae_auth_logs(struct qdf_mac_addr *bssid,
+QDF_STATUS wlan_print_cached_sae_auth_logs(struct wlan_objmgr_psoc *psoc,
+					   struct qdf_mac_addr *bssid,
 					   uint8_t vdev_id)
 {
 	uint8_t i, j;
 	struct wlan_objmgr_vdev *vdev;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(global_cl.psoc, vdev_id,
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
 						    WLAN_MLME_OBJMGR_ID);
 	if (!vdev) {
 		logging_err_rl("Invalid vdev:%d", vdev_id);
@@ -148,7 +175,8 @@ QDF_STATUS wlan_print_cached_sae_auth_logs(struct qdf_mac_addr *bssid,
 	return QDF_STATUS_SUCCESS;
 }
 
-bool wlan_is_log_record_present_for_bssid(struct qdf_mac_addr *bssid,
+bool wlan_is_log_record_present_for_bssid(struct wlan_objmgr_psoc *psoc,
+					  struct qdf_mac_addr *bssid,
 					  uint8_t vdev_id)
 {
 	struct wlan_log_record *record;
@@ -156,7 +184,7 @@ bool wlan_is_log_record_present_for_bssid(struct qdf_mac_addr *bssid,
 	struct mlme_legacy_priv *mlme_priv;
 	int i;
 
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(global_cl.psoc, vdev_id,
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
 						    WLAN_MLME_OBJMGR_ID);
 	if (!vdev) {
 		logging_err_rl("Invalid vdev:%d", vdev_id);
@@ -194,15 +222,25 @@ bool wlan_is_log_record_present_for_bssid(struct qdf_mac_addr *bssid,
  * Return: QDF_STATUS
  */
 static QDF_STATUS
-wlan_add_sae_log_record_to_available_slot(struct mlme_legacy_priv *mlme_priv,
+wlan_add_sae_log_record_to_available_slot(struct wlan_objmgr_psoc *psoc,
+					  struct wlan_objmgr_vdev *vdev,
 					  struct wlan_log_record *rec)
 {
+	struct mlme_legacy_priv *mlme_priv;
 	uint8_t i, j;
 	bool is_entry_exist =
-		wlan_is_log_record_present_for_bssid(&rec->bssid, rec->vdev_id);
+		wlan_is_log_record_present_for_bssid(psoc,
+						     &rec->bssid, rec->vdev_id);
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		logging_err_rl("vdev legacy private object is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
 
 	for (i = 0; i < MAX_ROAM_CANDIDATE_AP; i++) {
-		if (is_entry_exist && mlme_priv->auth_log[i][0].ktime_us &&
+		if (is_entry_exist &&
+		    mlme_priv->auth_log[i][0].ktime_us &&
 		    qdf_is_macaddr_equal(&rec->bssid,
 					 &mlme_priv->auth_log[i][0].bssid)) {
 			/*
@@ -237,6 +275,9 @@ wlan_add_sae_auth_log_record(struct wlan_objmgr_vdev *vdev,
 			     struct wlan_log_record *rec)
 {
 	struct mlme_legacy_priv *mlme_priv;
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_vdev_get_psoc(vdev);
 
 	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
 	if (!mlme_priv) {
@@ -244,68 +285,213 @@ wlan_add_sae_auth_log_record(struct wlan_objmgr_vdev *vdev,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	return wlan_add_sae_log_record_to_available_slot(mlme_priv, rec);
+	return wlan_add_sae_log_record_to_available_slot(psoc, mlme_priv, rec);
 }
 
-void wlan_clear_sae_auth_logs_cache(uint8_t vdev_id)
+static void
+wlan_cache_connectivity_log(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
+			    struct wlan_log_record *rec)
 {
 	struct wlan_objmgr_vdev *vdev;
-	struct mlme_legacy_priv *mlme_priv;
 
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(global_cl.psoc, vdev_id,
+	if (!psoc) {
+		logging_err_rl("PSOC is NULL");
+		return;
+	}
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
 						    WLAN_MLME_OBJMGR_ID);
 	if (!vdev) {
 		logging_err_rl("Invalid vdev:%d", vdev_id);
 		return;
 	}
 
+	wlan_add_sae_auth_log_record(vdev, rec);
+
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+}
+#elif defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(CONNECTIVITY_DIAG_EVENT)
+QDF_STATUS wlan_print_cached_sae_auth_logs(struct wlan_objmgr_psoc *psoc,
+					   struct qdf_mac_addr *bssid,
+					   uint8_t vdev_id)
+{
+	uint8_t i, j;
+	struct wlan_objmgr_vdev *vdev;
+	struct mlme_legacy_priv *mlme_priv;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_OBJMGR_ID);
+	if (!vdev) {
+		logging_err_rl("Invalid vdev:%d", vdev_id);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
 	if (!mlme_priv) {
-		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
 		logging_err_rl("vdev legacy private object is NULL");
-		return;
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	/*
+	 * Get the index of matching bssid and queue all the records for
+	 * that bssid
+	 */
+	for (i = 0; i < MAX_ROAM_CANDIDATE_AP; i++) {
+		if (!mlme_priv->auth_log[i][0].diag_cmn.ktime_us)
+			continue;
+
+		if (qdf_is_macaddr_equal(bssid,
+					 (struct qdf_mac_addr *)mlme_priv->auth_log[i][0].diag_cmn.bssid))
+			break;
+	}
+
+	/*
+	 * No matching bssid found in cached log records.
+	 * So return from here.
+	 */
+	if (i >= MAX_ROAM_CANDIDATE_AP) {
+		logging_debug("No cached SAE auth logs");
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	for (j = 0; j < WLAN_ROAM_MAX_CACHED_AUTH_FRAMES; j++) {
+		if (!mlme_priv->auth_log[i][j].diag_cmn.ktime_us)
+			continue;
+
+		WLAN_HOST_DIAG_EVENT_REPORT(&mlme_priv->auth_log[i][j],
+					    EVENT_WLAN_MGMT);
+		qdf_mem_zero(&mlme_priv->auth_log[i][j],
+			     sizeof(struct wlan_diag_packet_info));
 	}
 
-	qdf_mem_zero(mlme_priv->auth_log, sizeof(mlme_priv->auth_log));
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+
+	return QDF_STATUS_SUCCESS;
 }
 
-static void
-wlan_cache_connectivity_log(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
-			    struct wlan_log_record *rec)
+bool wlan_is_log_record_present_for_bssid(struct wlan_objmgr_psoc *psoc,
+					  struct qdf_mac_addr *bssid,
+					  uint8_t vdev_id)
 {
+	struct wlan_diag_packet_info *pkt_info;
 	struct wlan_objmgr_vdev *vdev;
-
-	if (!psoc) {
-		logging_err_rl("PSOC is NULL");
-		return;
-	}
+	struct mlme_legacy_priv *mlme_priv;
+	int i;
 
 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
 						    WLAN_MLME_OBJMGR_ID);
 	if (!vdev) {
 		logging_err_rl("Invalid vdev:%d", vdev_id);
-		return;
+		return false;
 	}
 
-	wlan_add_sae_auth_log_record(vdev, rec);
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+		logging_err_rl("vdev legacy private object is NULL");
+		return false;
+	}
 
+	for (i = 0; i < MAX_ROAM_CANDIDATE_AP; i++) {
+		pkt_info = &mlme_priv->auth_log[i][0];
+		if (!pkt_info->diag_cmn.ktime_us)
+			continue;
+
+		if (qdf_is_macaddr_equal(bssid,
+					 (struct qdf_mac_addr *)pkt_info->diag_cmn.bssid)) {
+			wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+			return true;
+		}
+	}
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+
+	return false;
 }
 
-#else
-static inline QDF_STATUS
-wlan_add_sae_log_record_to_available_slot(struct mlme_legacy_priv *mlme_priv,
-					  struct wlan_log_record *rec)
+/**
+ * wlan_add_sae_log_record_to_available_slot() - Add a new log record into the
+ * cache for the queue.
+ * @mlme_priv: Mlme private object
+ * @pkt_info: Log packet record pointer
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+wlan_add_sae_log_record_to_available_slot(struct wlan_objmgr_psoc *psoc,
+					  struct wlan_objmgr_vdev *vdev,
+					  struct wlan_diag_packet_info *pkt_info)
 {
+	struct mlme_legacy_priv *mlme_priv;
+	uint8_t i, j;
+	uint8_t vdev_id = wlan_vdev_get_id(vdev);
+	bool is_entry_exist =
+		wlan_is_log_record_present_for_bssid(psoc,
+						     (struct qdf_mac_addr *)pkt_info->diag_cmn.bssid,
+						     vdev_id);
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		logging_err_rl("vdev legacy private object is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	for (i = 0; i < MAX_ROAM_CANDIDATE_AP; i++) {
+		if (is_entry_exist &&
+		    mlme_priv->auth_log[i][0].diag_cmn.ktime_us &&
+		    qdf_is_macaddr_equal((struct qdf_mac_addr *)pkt_info->diag_cmn.bssid,
+					 (struct qdf_mac_addr *)mlme_priv->auth_log[i][0].diag_cmn.bssid)) {
+			/*
+			 * Frames for given bssid already exists store the new
+			 * frame in corresponding array in empty slot
+			 */
+			for (j = 0; j < WLAN_ROAM_MAX_CACHED_AUTH_FRAMES; j++) {
+				if (mlme_priv->auth_log[i][j].diag_cmn.ktime_us)
+					continue;
+
+				mlme_priv->auth_log[i][j] = *pkt_info;
+				break;
+			}
+
+		} else if (!is_entry_exist &&
+			   !mlme_priv->auth_log[i][0].diag_cmn.ktime_us) {
+			/*
+			 * For given record, there is no existing bssid
+			 * so add the entry at first available slot
+			 */
+			mlme_priv->auth_log[i][0] = *pkt_info;
+			break;
+		}
+	}
+
 	return QDF_STATUS_SUCCESS;
 }
+
+static void
+wlan_cache_connectivity_log(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
+			    struct wlan_diag_packet_info *pkt_info)
+{
+	struct wlan_objmgr_vdev *vdev;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_OBJMGR_ID);
+	if (!vdev) {
+		logging_err_rl("Invalid vdev:%d", vdev_id);
+		return;
+	}
+
+	wlan_add_sae_log_record_to_available_slot(psoc, vdev, pkt_info);
+
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+}
 #endif
 
 #define WLAN_SAE_AUTH_ALGO_NUMBER 3
 #ifdef CONNECTIVITY_DIAG_EVENT
 void
-wlan_connectivity_mgmt_event(struct wlan_frame_hdr *mac_hdr,
+wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
+			     struct wlan_frame_hdr *mac_hdr,
 			     uint8_t vdev_id, uint16_t status_code,
 			     enum qdf_dp_tx_rx_status tx_status,
 			     int8_t peer_rssi,
@@ -313,8 +499,28 @@ wlan_connectivity_mgmt_event(struct wlan_frame_hdr *mac_hdr,
 			     uint8_t auth_seq, uint16_t aid,
 			     enum wlan_main_tag tag)
 {
+	enum QDF_OPMODE opmode;
+	bool is_auth_frame_caching_required, is_initial_connection;
+	struct wlan_objmgr_vdev *vdev;
+
 	WLAN_HOST_DIAG_EVENT_DEF(wlan_diag_event, struct wlan_diag_packet_info);
 
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_OBJMGR_ID);
+	if (!vdev) {
+		logging_debug("Unable to find vdev:%d", vdev_id);
+		return;
+	}
+
+	opmode = wlan_vdev_mlme_get_opmode(vdev);
+	if (opmode != QDF_STA_MODE && opmode != QDF_P2P_CLIENT_MODE) {
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+		return;
+	}
+
+	is_initial_connection = wlan_cm_is_vdev_connecting(vdev);
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+
 	qdf_mem_zero(&wlan_diag_event, sizeof(struct wlan_diag_packet_info));
 
 	wlan_diag_event.diag_cmn.timestamp_us = qdf_get_time_of_the_day_us();
@@ -338,13 +544,21 @@ wlan_connectivity_mgmt_event(struct wlan_frame_hdr *mac_hdr,
 
 	wlan_diag_event.is_retry_frame =
 			(mac_hdr->i_fc[1] & IEEE80211_FC1_RETRY);
-
-	WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_MGMT);
+	is_auth_frame_caching_required =
+		wlan_psoc_nif_fw_ext2_cap_get(psoc,
+					      WLAN_ROAM_STATS_FRAME_INFO_PER_CANDIDATE);
+	if (!is_initial_connection &&
+	    (tag == WLAN_AUTH_REQ || tag == WLAN_AUTH_RESP) &&
+	    auth_algo == WLAN_SAE_AUTH_ALGO_NUMBER &&
+	    is_auth_frame_caching_required)
+		wlan_cache_connectivity_log(psoc, vdev_id, &wlan_diag_event);
+	else
+		WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_MGMT);
 }
-
 #else
 void
-wlan_connectivity_mgmt_event(struct wlan_frame_hdr *mac_hdr,
+wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
+			     struct wlan_frame_hdr *mac_hdr,
 			     uint8_t vdev_id, uint16_t status_code,
 			     enum qdf_dp_tx_rx_status tx_status,
 			     int8_t peer_rssi,

+ 7 - 2
components/mlme/core/inc/wlan_mlme_main.h

@@ -473,8 +473,13 @@ struct mlme_legacy_priv {
 	uint32_t vdev_stop_type;
 	struct wlan_mlme_roam mlme_roam;
 	struct wlan_cm_roam cm_roam;
-#ifdef WLAN_FEATURE_ROAM_OFFLOAD
-	struct wlan_log_record auth_log[MAX_ROAM_CANDIDATE_AP][WLAN_ROAM_MAX_CACHED_AUTH_FRAMES];
+#if defined(WLAN_FEATURE_ROAM_OFFLOAD) && \
+		defined(WLAN_FEATURE_CONNECTIVITY_LOGGING)
+	struct wlan_log_record
+	    auth_log[MAX_ROAM_CANDIDATE_AP][WLAN_ROAM_MAX_CACHED_AUTH_FRAMES];
+#elif defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(CONNECTIVITY_DIAG_EVENT)
+	struct wlan_diag_packet_info
+	    auth_log[MAX_ROAM_CANDIDATE_AP][WLAN_ROAM_MAX_CACHED_AUTH_FRAMES];
 #endif
 	bool bigtk_vdev_support;
 	struct sae_auth_retry sae_retry;

+ 3 - 1
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.c

@@ -5384,10 +5384,12 @@ static void cm_roam_start_init(struct wlan_objmgr_psoc *psoc,
 	 */
 	cm_store_sae_single_pmk_to_global_cache(psoc, pdev, vdev);
 
-	if (!MLME_IS_ROAM_SYNCH_IN_PROGRESS(psoc, vdev_id))
+	if (!MLME_IS_ROAM_SYNCH_IN_PROGRESS(psoc, vdev_id)) {
+		wlan_clear_sae_auth_logs_cache(psoc, vdev_id);
 		wlan_cm_roam_state_change(pdev, vdev_id,
 					  WLAN_ROAM_RSO_ENABLED,
 					  REASON_CTX_INIT);
+	}
 }
 
 void cm_roam_start_init_on_connect(struct wlan_objmgr_pdev *pdev,

+ 10 - 6
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c

@@ -3166,7 +3166,8 @@ cm_get_frame_subtype_str(enum mgmt_subtype frame_subtype)
 
 #define WLAN_SAE_AUTH_ALGO 3
 static void
-cm_roam_print_frame_info(struct roam_frame_stats *frame_data,
+cm_roam_print_frame_info(struct wlan_objmgr_psoc *psoc,
+			 struct roam_frame_stats *frame_data,
 			 struct wmi_roam_scan_data *scan_data, uint8_t vdev_id)
 {
 	struct roam_frame_info *frame_info;
@@ -3179,9 +3180,11 @@ cm_roam_print_frame_info(struct roam_frame_stats *frame_data,
 	for (i = 0; i < frame_data->num_frame; i++) {
 		frame_info = &frame_data->frame_info[i];
 		if (frame_info->auth_algo == WLAN_SAE_AUTH_ALGO &&
-		    wlan_is_log_record_present_for_bssid(&frame_info->bssid,
+		    wlan_is_log_record_present_for_bssid(psoc,
+							 &frame_info->bssid,
 							 vdev_id)) {
-			wlan_print_cached_sae_auth_logs(&frame_info->bssid,
+			wlan_print_cached_sae_auth_logs(psoc,
+							&frame_info->bssid,
 							vdev_id);
 			continue;
 		}
@@ -3326,7 +3329,7 @@ cm_roam_handle_btm_stats(struct wlan_objmgr_psoc *psoc,
 						stats_info->vdev_id);
 
 	if (stats_info->frame_stats[i].num_frame)
-		cm_roam_print_frame_info(&stats_info->frame_stats[i],
+		cm_roam_print_frame_info(psoc, &stats_info->frame_stats[i],
 					 &stats_info->scan[i],
 					 stats_info->vdev_id);
 
@@ -3410,7 +3413,8 @@ cm_roam_stats_event_handler(struct wlan_objmgr_psoc *psoc,
 							stats_info->vdev_id);
 
 		if (stats_info->frame_stats[i].num_frame)
-			cm_roam_print_frame_info(&stats_info->frame_stats[i],
+			cm_roam_print_frame_info(psoc,
+						 &stats_info->frame_stats[i],
 						 &stats_info->scan[i],
 						 stats_info->vdev_id);
 
@@ -3509,7 +3513,7 @@ cm_roam_stats_event_handler(struct wlan_objmgr_psoc *psoc,
 		}
 	}
 
-	wlan_clear_sae_auth_logs_cache(stats_info->vdev_id);
+	wlan_clear_sae_auth_logs_cache(psoc, stats_info->vdev_id);
 	qdf_mem_free(stats_info->roam_msg_info);
 	qdf_mem_free(stats_info);
 

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

@@ -1267,7 +1267,8 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 
 	if (subtype != LIM_REASSOC) {
 		aid = assoc_rsp->aid & 0x3FFF;
-		wlan_connectivity_mgmt_event((struct wlan_frame_hdr *)hdr,
+		wlan_connectivity_mgmt_event(mac_ctx->psoc,
+					     (struct wlan_frame_hdr *)hdr,
 					     session_entry->vdev_id,
 					     assoc_rsp->status_code, 0, rssi,
 					     0, 0, 0, aid,

+ 5 - 2
core/mac/src/pe/lim/lim_process_auth_frame.c

@@ -487,6 +487,7 @@ static void lim_process_sae_auth_frame(struct mac_context *mac_ctx,
 					      SAE_AUTH_STATUS_CODE_OFFSET);
 		}
 		wlan_connectivity_mgmt_event(
+			mac_ctx->psoc,
 			(struct wlan_frame_hdr *)mac_hdr, pe_session->vdev_id,
 			sae_status_code, 0,
 			WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info), auth_algo,
@@ -1731,7 +1732,8 @@ lim_process_auth_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 			SIR_MAC_AUTH_FRAME_4;
 	}
 
-	wlan_connectivity_mgmt_event((struct wlan_frame_hdr *)mac_hdr,
+	wlan_connectivity_mgmt_event(mac_ctx->psoc,
+				     (struct wlan_frame_hdr *)mac_hdr,
 				     pe_session->vdev_id,
 				     rx_auth_frm_body->authStatusCode,
 				     0, WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info),
@@ -1827,7 +1829,8 @@ bool lim_process_sae_preauth_frame(struct mac_context *mac, uint8_t *rx_pkt)
 		wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID);
 	}
 
-	wlan_connectivity_mgmt_event((struct wlan_frame_hdr *)dot11_hdr,
+	wlan_connectivity_mgmt_event(mac->psoc,
+				     (struct wlan_frame_hdr *)dot11_hdr,
 				     vdev_id, sae_status_code,
 				     0, WMA_GET_RX_RSSI_NORMALIZED(rx_pkt),
 				     auth_alg, sae_auth_seq,

+ 1 - 1
core/mac/src/pe/lim/lim_process_deauth_frame.c

@@ -155,7 +155,7 @@ lim_process_deauth_frame(struct mac_context *mac, uint8_t *pRxPacketInfo,
 			pe_session->limSmeState,
 			GET_LIM_SYSTEM_ROLE(pe_session));
 
-	wlan_connectivity_mgmt_event((struct wlan_frame_hdr *)pHdr,
+	wlan_connectivity_mgmt_event(mac->psoc, (struct wlan_frame_hdr *)pHdr,
 				     pe_session->vdev_id, reasonCode,
 				     0, frame_rssi, 0, 0, 0, 0,
 				     WLAN_DEAUTH_RX);

+ 1 - 1
core/mac/src/pe/lim/lim_process_disassoc_frame.c

@@ -152,7 +152,7 @@ lim_process_disassoc_frame(struct mac_context *mac, uint8_t *pRxPacketInfo,
 			reasonCode, pe_session->limMlmState,
 			pe_session->limSmeState,
 			GET_LIM_SYSTEM_ROLE(pe_session));
-	wlan_connectivity_mgmt_event((struct wlan_frame_hdr *)pHdr,
+	wlan_connectivity_mgmt_event(mac->psoc, (struct wlan_frame_hdr *)pHdr,
 				     pe_session->vdev_id, reasonCode,
 				     0, frame_rssi, 0, 0, 0, 0,
 				     WLAN_DISASSOC_RX);

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

@@ -2252,6 +2252,7 @@ static void wlan_send_tx_complete_event(struct mac_context *mac, qdf_nbuf_t buf,
 				type = seq;
 
 			wlan_connectivity_mgmt_event(
+					mac->psoc,
 					mac_hdr, params->vdev_id, status,
 					qdf_tx_complete, mac->lim.bss_rssi,
 					algo, type, seq, 0, WLAN_AUTH_REQ);
@@ -2262,6 +2263,7 @@ static void wlan_send_tx_complete_event(struct mac_context *mac, qdf_nbuf_t buf,
 			reason_code = pe_session->deauth_disassoc_rc;
 
 		wlan_connectivity_mgmt_event(
+					mac->psoc,
 					mac_hdr, params->vdev_id, reason_code,
 					qdf_tx_complete, mac->lim.bss_rssi,
 					0, 0, 0, 0, tag);
@@ -4238,7 +4240,8 @@ lim_send_disassoc_mgmt_frame(struct mac_context *mac,
 		lim_diag_mgmt_tx_event_report(mac, pMacHdr,
 					      pe_session,
 					      QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS);
-		wlan_connectivity_mgmt_event((struct wlan_frame_hdr *)pMacHdr,
+		wlan_connectivity_mgmt_event(mac->psoc,
+					     (struct wlan_frame_hdr *)pMacHdr,
 					     pe_session->vdev_id, nReason,
 					     QDF_TX_RX_STATUS_OK,
 					     mac->lim.bss_rssi, 0, 0, 0, 0,
@@ -4484,7 +4487,8 @@ lim_send_deauth_mgmt_frame(struct mac_context *mac,
 					      QDF_STATUS_SUCCESS,
 					      QDF_STATUS_SUCCESS);
 
-		wlan_connectivity_mgmt_event((struct wlan_frame_hdr *)pMacHdr,
+		wlan_connectivity_mgmt_event(mac->psoc,
+					     (struct wlan_frame_hdr *)pMacHdr,
 					     pe_session->vdev_id, nReason,
 					     QDF_TX_RX_STATUS_OK,
 					     mac->lim.bss_rssi, 0, 0, 0, 0,