Przeglądaj źródła

qcacld-3.0: Introduce support for STA info logging

Add support for STA info logging via api
wlan_connectivity_sta_info_event()

STA info logs is sent immediately after the
connect request initiated from userspace.

Change-Id: I92c42c9ca27f90acae23452e8fba1f2b20396214
CRs-Fixed: 3597543
Vijay Raj 1 rok temu
rodzic
commit
8255bcee81

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

@@ -1187,6 +1187,15 @@ wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
 static inline void wlan_connectivity_logging_stop(void)
 {}
 
+/**
+ * wlan_connectivity_sta_info_event() - APi to send STA info event
+ * @psoc: Pointer to global psoc object
+ * @vdev_id: Vdev id
+ */
+void
+wlan_connectivity_sta_info_event(struct wlan_objmgr_psoc *psoc,
+				 uint8_t vdev_id);
+
 #elif defined(WLAN_FEATURE_CONNECTIVITY_LOGGING)
 /**
  * wlan_connectivity_logging_start()  - Initialize the connectivity/roaming
@@ -1255,6 +1264,15 @@ wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
 			     uint8_t auth_algo, uint8_t auth_type,
 			     uint8_t auth_seq, uint16_t aid,
 			     enum wlan_main_tag tag);
+
+/**
+ * wlan_connectivity_sta_info_event() - APi to send STA info event
+ * @psoc: Pointer to global psoc object
+ * @vdev_id: Vdev id
+ */
+void
+wlan_connectivity_sta_info_event(struct wlan_objmgr_psoc *psoc,
+				 uint8_t vdev_id);
 #else
 static inline
 void wlan_connectivity_logging_start(struct wlan_objmgr_psoc *psoc,
@@ -1286,5 +1304,10 @@ wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
 			     uint8_t auth_seq, uint16_t aid,
 			     enum wlan_main_tag tag)
 {}
+static inline void
+wlan_connectivity_sta_info_event(struct wlan_objmgr_psoc *psoc,
+				 uint8_t vdev_id)
+{
+}
 #endif
 #endif /* _WLAN_CONNECTIVITY_LOGGING_H_ */

+ 90 - 0
components/cmn_services/logging/src/wlan_connectivity_logging.c

@@ -23,6 +23,7 @@
 #include "wlan_connectivity_logging.h"
 #include "wlan_cm_api.h"
 #include "wlan_mlme_main.h"
+#include "wlan_mlo_mgr_sta.h"
 
 #ifdef WLAN_FEATURE_CONNECTIVITY_LOGGING
 static struct wlan_connectivity_log_buf_data global_cl;
@@ -299,6 +300,95 @@ wlan_cache_connectivity_log(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
 
 #define WLAN_SAE_AUTH_ALGO_NUMBER 3
 #ifdef CONNECTIVITY_DIAG_EVENT
+
+#ifdef WLAN_FEATURE_11BE_MLO
+static QDF_STATUS
+wlan_populate_link_addr(struct wlan_objmgr_vdev *vdev,
+			struct wlan_diag_sta_info *wlan_diag_event)
+{
+	uint i = 0;
+	struct mlo_link_switch_context *link_ctx = vdev->mlo_dev_ctx->link_ctx;
+	struct wlan_channel *link_chan_info;
+
+	if (!link_ctx)
+		return QDF_STATUS_E_FAILURE;
+
+	for (i = 0; i < WLAN_MAX_ML_BSS_LINKS; i++) {
+		link_chan_info = link_ctx->links_info[i].link_chan_info;
+
+		if (wlan_reg_is_24ghz_ch_freq(
+		    (qdf_freq_t)link_chan_info->ch_freq)) {
+			qdf_mem_copy(wlan_diag_event->mac_2g,
+				     link_ctx->links_info[i].link_addr.bytes,
+				     QDF_MAC_ADDR_SIZE);
+		} else if (wlan_reg_is_5ghz_ch_freq(
+			   (qdf_freq_t)link_chan_info->ch_freq)) {
+			qdf_mem_copy(wlan_diag_event->mac_5g,
+				     link_ctx->links_info[i].link_addr.bytes,
+				     QDF_MAC_ADDR_SIZE);
+		} else if (wlan_reg_is_6ghz_chan_freq(
+			   link_chan_info->ch_freq)) {
+			qdf_mem_copy(wlan_diag_event->mac_6g,
+				     link_ctx->links_info[i].link_addr.bytes,
+				     QDF_MAC_ADDR_SIZE);
+		}
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static QDF_STATUS
+wlan_populate_link_addr(struct wlan_objmgr_vdev *vdev,
+			struct wlan_diag_sta_info *wlan_diag_event)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
+void
+wlan_connectivity_sta_info_event(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
+{
+	QDF_STATUS status;
+	struct wlan_objmgr_vdev *vdev = NULL;
+
+	WLAN_HOST_DIAG_EVENT_DEF(wlan_diag_event, struct wlan_diag_sta_info);
+
+	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;
+	}
+
+	if (wlan_vdev_mlme_get_opmode(vdev) != QDF_STA_MODE)
+		goto out;
+
+	wlan_diag_event.diag_cmn.timestamp_us = qdf_get_time_of_the_day_us();
+	wlan_diag_event.diag_cmn.ktime_us = qdf_ktime_to_us(qdf_ktime_get());
+	wlan_diag_event.diag_cmn.vdev_id = vdev_id;
+	wlan_diag_event.is_mlo = mlo_is_mld_sta(vdev);
+
+	if (wlan_diag_event.is_mlo) {
+		qdf_mem_copy(wlan_diag_event.diag_cmn.bssid,
+			     wlan_vdev_mlme_get_mldaddr(vdev),
+			     QDF_MAC_ADDR_SIZE);
+		status = wlan_populate_link_addr(vdev, &wlan_diag_event);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			logging_err_rl("wlan_populate_link_addr failed");
+			goto out;
+		}
+	} else {
+		qdf_mem_copy(wlan_diag_event.diag_cmn.bssid,
+			     wlan_vdev_mlme_get_macaddr(vdev),
+			     QDF_MAC_ADDR_SIZE);
+	}
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_STA_INFO);
+
+out:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+}
+
 void
 wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
 			     struct wlan_frame_hdr *mac_hdr,

+ 4 - 0
core/mac/src/pe/lim/lim_process_probe_rsp_frame.c

@@ -326,6 +326,8 @@ lim_process_probe_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_Packet_info
 
 	if (session_entry->limMlmState ==
 			eLIM_MLM_WT_JOIN_BEACON_STATE) {
+		uint8_t vdev_id = wlan_vdev_get_id(session_entry->vdev);
+
 		/*
 		 * Either Beacon/probe response is required.
 		 * Hence store it in same buffer.
@@ -355,6 +357,8 @@ lim_process_probe_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_Packet_info
 		lim_check_and_announce_join_success(mac_ctx, probe_rsp,
 						header,
 						session_entry);
+		wlan_connectivity_sta_info_event(mac_ctx->psoc, vdev_id);
+
 	} else if (session_entry->limMlmState ==
 		   eLIM_MLM_LINK_ESTABLISHED_STATE) {
 		/*