Quellcode durchsuchen

qcacld-3.0: Add chipset stats for TX/RX mgmt frames

Add chipset stats for mgmt TX/RX frames

Change-Id: I14e487ef797fbacb7247bcf50b4ce9d77856376d
CRs-Fixed: 3783020
Prasanna JS vor 1 Jahr
Ursprung
Commit
57734374e9

+ 16 - 0
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -2863,6 +2863,22 @@ void lim_process_assoc_req_frame(struct mac_context *mac_ctx,
 	lim_proc_assoc_req_frm_cmn(mac_ctx, sub_type, session, hdr->sa,
 				   assoc_req, 0);
 
+	if (sub_type == LIM_ASSOC) {
+		lim_cp_stats_cstats_log_assoc_req_evt
+			(session, CSTATS_DIR_RX, hdr->bssId, hdr->sa,
+			 assoc_req->ssId.length, assoc_req->ssId.ssId,
+			 assoc_req->HTCaps.present, assoc_req->VHTCaps.present,
+			 assoc_req->he_cap.present, assoc_req->eht_cap.present,
+			 false);
+	} else if (sub_type == LIM_REASSOC) {
+		lim_cp_stats_cstats_log_assoc_req_evt
+			(session, CSTATS_DIR_RX, hdr->bssId, hdr->sa,
+			 assoc_req->ssId.length, assoc_req->ssId.ssId,
+			 assoc_req->HTCaps.present, assoc_req->VHTCaps.present,
+			 assoc_req->he_cap.present, assoc_req->eht_cap.present,
+			 true);
+	}
+
 	return;
 error:
 	if (assoc_req) {

+ 16 - 0
core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c

@@ -1269,6 +1269,22 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 		return;
 	}
 
+	if (subtype == LIM_REASSOC) {
+		lim_cp_stats_cstats_log_assoc_resp_evt
+			(session_entry, CSTATS_DIR_RX, assoc_rsp->status_code,
+			 assoc_rsp->aid, hdr->bssId, hdr->da,
+			 assoc_rsp->HTCaps.present,
+			 assoc_rsp->VHTCaps.present, assoc_rsp->he_cap.present,
+			 assoc_rsp->eht_op.present, true);
+	} else if (subtype == LIM_ASSOC) {
+		lim_cp_stats_cstats_log_assoc_resp_evt
+			(session_entry, CSTATS_DIR_RX, assoc_rsp->status_code,
+			 assoc_rsp->aid, hdr->bssId, hdr->da,
+			 assoc_rsp->HTCaps.present,
+			 assoc_rsp->VHTCaps.present, assoc_rsp->he_cap.present,
+			 assoc_rsp->eht_op.present, false);
+	}
+
 	if (subtype != LIM_REASSOC) {
 		aid = assoc_rsp->aid & 0x3FFF;
 		wlan_connectivity_mgmt_event(mac_ctx->psoc,

+ 10 - 0
core/mac/src/pe/lim/lim_process_auth_frame.c

@@ -856,6 +856,10 @@ static void lim_process_sae_auth_frame(struct mac_context *mac_ctx,
 				auth_algo, sae_auth_seq, sae_auth_seq, 0,
 				WLAN_AUTH_RESP);
 
+		lim_cp_stats_cstats_log_auth_evt(pe_session, CSTATS_DIR_RX,
+						 auth_algo, sae_auth_seq,
+						 sae_status_code);
+
 		status = lim_update_link_to_mld_address(mac_ctx,
 							pe_session->vdev,
 							mac_hdr);
@@ -2115,6 +2119,12 @@ lim_process_auth_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 				     auth_alg, 0,
 				     rx_auth_frm_body->authTransactionSeqNumber,
 				     0, WLAN_AUTH_RESP);
+
+	lim_cp_stats_cstats_log_auth_evt
+			(pe_session, CSTATS_DIR_RX, auth_alg,
+			 rx_auth_frm_body->authTransactionSeqNumber,
+			 rx_auth_frm_body->authStatusCode);
+
 	switch (rx_auth_frm_body->authTransactionSeqNumber) {
 	case SIR_MAC_AUTH_FRAME_1:
 		lim_process_auth_frame_type1(mac_ctx,

+ 3 - 0
core/mac/src/pe/lim/lim_process_deauth_frame.c

@@ -165,6 +165,9 @@ lim_process_deauth_frame(struct mac_context *mac, uint8_t *pRxPacketInfo,
 	lim_diag_event_report(mac, WLAN_PE_DIAG_DEAUTH_FRAME_EVENT,
 		pe_session, 0, reasonCode);
 
+	lim_cp_stats_cstats_log_deauth_evt(pe_session, CSTATS_DIR_RX,
+					   reasonCode);
+
 	if (lim_check_disassoc_deauth_ack_pending(mac, (uint8_t *) pHdr->sa)) {
 		pe_debug("Ignore the Deauth received, while waiting for ack of "
 			"disassoc/deauth");

+ 3 - 0
core/mac/src/pe/lim/lim_process_disassoc_frame.c

@@ -162,6 +162,9 @@ lim_process_disassoc_frame(struct mac_context *mac, uint8_t *pRxPacketInfo,
 	lim_diag_event_report(mac, WLAN_PE_DIAG_DISASSOC_FRAME_EVENT,
 		pe_session, 0, reasonCode);
 
+	lim_cp_stats_cstats_log_disassoc_evt(pe_session, CSTATS_DIR_RX,
+					     reasonCode);
+
 	/**
 	 * Extract 'associated' context for STA, if any.
 	 * This is maintained by DPH and created by LIM.

+ 10 - 1
core/mac/src/pe/lim/lim_send_frames_host_roam.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-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
@@ -897,6 +897,15 @@ void lim_send_reassoc_req_mgmt_frame(struct mac_context *mac,
 		pe_warn("warning packing a Re-AssocReq: (0x%08x)", nStatus);
 	}
 
+	lim_cp_stats_cstats_log_assoc_req_evt(pe_session, CSTATS_DIR_TX,
+					      pMacHdr->bssId, pMacHdr->sa,
+					      frm->SSID.num_ssid,
+					      frm->SSID.ssid,
+					      frm->HTCaps.present,
+					      frm->VHTCaps.present,
+					      frm->he_cap.present,
+					      frm->eht_cap.present, true);
+
 	pe_debug("*** Sending Re-Association Request length: %d" "to", nBytes);
 
 	if (pe_session->assoc_req) {

+ 26 - 0
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -1921,6 +1921,13 @@ lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx,
 		      frm.vendor_vht_ie.present, frm.he_cap.present,
 		      frm.eht_cap.present);
 
+	lim_cp_stats_cstats_log_assoc_resp_evt(pe_session, CSTATS_DIR_TX,
+					       status_code, aid, mac_hdr->bssId,
+					       mac_hdr->da, frm.HTCaps.present,
+					       frm.VHTCaps.present,
+					       frm.he_cap.present,
+					       frm.eht_cap.present, false);
+
 	if (!wlan_reg_is_24ghz_ch_freq(pe_session->curr_op_freq) ||
 	    pe_session->opmode == QDF_P2P_CLIENT_MODE ||
 	    pe_session->opmode == QDF_P2P_GO_MODE)
@@ -2174,6 +2181,9 @@ static void wlan_send_tx_complete_event(struct mac_context *mac, qdf_nbuf_t buf,
 					mac_hdr, params->vdev_id, status,
 					qdf_tx_complete, mac->lim.bss_rssi,
 					algo, type, seq, 0, WLAN_AUTH_REQ);
+			lim_cp_stats_cstats_log_auth_evt(pe_session,
+							 CSTATS_DIR_TX, algo,
+							 seq, status);
 			return;
 		}
 
@@ -3061,6 +3071,16 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 		     pe_session->vdev_id, QDF_MAC_ADDR_REF(pe_session->bssId),
 		     mac_ctx->mgmtSeqNum);
 
+	lim_cp_stats_cstats_log_assoc_req_evt(pe_session, CSTATS_DIR_TX,
+					      pe_session->bssId,
+					      mac_hdr->sa,
+					      frm->SSID.num_ssid,
+					      frm->SSID.ssid,
+					      frm->HTCaps.present,
+					      frm->VHTCaps.present,
+					      frm->he_cap.present,
+					      frm->eht_cap.present, false);
+
 	min_rid = lim_get_min_session_txrate(pe_session, NULL);
 	lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_START_EVENT,
 			      pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS);
@@ -4360,6 +4380,9 @@ lim_send_disassoc_mgmt_frame(struct mac_context *mac,
 					     mac->lim.bss_rssi, 0, 0, 0, 0,
 					     WLAN_DISASSOC_TX);
 
+		lim_cp_stats_cstats_log_disassoc_evt(pe_session, CSTATS_DIR_TX,
+						     nReason);
+
 		/* Queue Disassociation frame in high priority WQ */
 		qdf_status = wma_tx_frame(mac, pPacket, (uint16_t) nBytes,
 					TXRX_FRM_802_11_MGMT,
@@ -4623,6 +4646,9 @@ lim_send_deauth_mgmt_frame(struct mac_context *mac,
 					     mac->lim.bss_rssi, 0, 0, 0, 0,
 					     WLAN_DEAUTH_TX);
 
+		lim_cp_stats_cstats_log_deauth_evt(pe_session, CSTATS_DIR_TX,
+						   nReason);
+
 		/* Queue Disassociation frame in high priority WQ */
 		qdf_status =
 			wma_tx_frame(mac, pPacket, (uint16_t) nBytes,

+ 162 - 0
core/mac/src/pe/lim/lim_utils.c

@@ -11849,3 +11849,165 @@ rel_vdev:
 		}
 	}
 }
+
+#ifdef WLAN_CHIPSET_STATS
+void lim_cp_stats_cstats_log_assoc_resp_evt(struct pe_session *session_entry,
+					    enum cstats_dir dir,
+					    uint16_t status_code, uint16_t aid,
+					    uint8_t *bssid, uint8_t *da,
+					    bool is_ht, bool is_vht,
+					    bool is_he, bool is_eht,
+					    bool is_reassoc)
+{
+	struct cstats_assoc_resp_mgmt_frm stat = {0};
+
+	if (is_reassoc) {
+		stat.cmn.hdr.evt_id =
+				WLAN_CHIPSET_STATS_MGMT_REASSOC_RESP_EVENT_ID;
+	} else {
+		stat.cmn.hdr.evt_id =
+			WLAN_CHIPSET_STATS_MGMT_ASSOC_RESP_EVENT_ID;
+	}
+
+	stat.cmn.hdr.length = sizeof(struct cstats_assoc_resp_mgmt_frm) -
+			      sizeof(struct cstats_hdr);
+	stat.cmn.vdev_id = session_entry->vdev_id;
+	stat.cmn.opmode = session_entry->opmode;
+	stat.cmn.timestamp_us = qdf_get_time_of_the_day_us();
+	stat.cmn.time_tick = qdf_get_log_timestamp();
+
+	stat.direction = dir;
+	stat.status_code = status_code;
+	stat.aid = aid;
+
+	if (is_ht)
+		CSTATS_SET_BIT(stat.flags, CSTATS_FLAG_HT);
+
+	if (is_vht)
+		CSTATS_SET_BIT(stat.flags, CSTATS_FLAG_VHT);
+
+	if (is_he)
+		CSTATS_SET_BIT(stat.flags, CSTATS_FLAG_HE);
+
+	if (is_eht)
+		CSTATS_SET_BIT(stat.flags, CSTATS_FLAG_EHT);
+
+	CSTATS_MAC_COPY(stat.bssid, bssid);
+	CSTATS_MAC_COPY(stat.dest_mac, da);
+
+	wlan_cstats_host_stats(sizeof(struct cstats_assoc_resp_mgmt_frm),
+			       &stat);
+}
+
+void
+lim_cp_stats_cstats_log_auth_evt(struct pe_session *pe_session,
+				 enum cstats_dir dir, uint16_t algo,
+				 uint16_t seq, uint16_t status)
+{
+	struct cstats_auth_mgmt_frm stat = {0};
+
+	stat.cmn.hdr.evt_id = WLAN_CHIPSET_STATS_MGMT_AUTH_EVENT_ID;
+	stat.cmn.hdr.length =
+		sizeof(struct cstats_auth_mgmt_frm) -
+		sizeof(struct cstats_hdr);
+	stat.cmn.opmode = pe_session->opmode;
+	stat.cmn.vdev_id = pe_session->vdev_id;
+	stat.cmn.timestamp_us = qdf_get_time_of_the_day_us();
+	stat.cmn.time_tick = qdf_get_log_timestamp();
+
+	stat.direction = dir;
+	stat.auth_algo = algo;
+	stat.auth_seq_num = seq;
+	stat.status = status;
+
+	wlan_cstats_host_stats(sizeof(struct cstats_auth_mgmt_frm), &stat);
+}
+
+void lim_cp_stats_cstats_log_deauth_evt(struct pe_session *pe_session,
+					enum cstats_dir dir,
+					uint16_t reasonCode)
+{
+	struct cstats_deauth_mgmt_frm stat = {0};
+
+	stat.cmn.hdr.evt_id = WLAN_CHIPSET_STATS_MGMT_DEAUTH_EVENT_ID;
+	stat.cmn.hdr.length = sizeof(struct cstats_deauth_mgmt_frm) -
+			      sizeof(struct cstats_hdr);
+	stat.cmn.opmode = pe_session->opmode;
+	stat.cmn.vdev_id = pe_session->vdev_id;
+	stat.cmn.timestamp_us = qdf_get_time_of_the_day_us();
+	stat.cmn.time_tick = qdf_get_log_timestamp();
+
+	stat.reason = reasonCode;
+	stat.direction = dir;
+
+	wlan_cstats_host_stats(sizeof(struct cstats_deauth_mgmt_frm), &stat);
+}
+
+void lim_cp_stats_cstats_log_disassoc_evt(struct pe_session *pe_session,
+					  enum cstats_dir dir,
+					  uint16_t reasonCode)
+{
+	struct cstats_disassoc_mgmt_frm stat = {0};
+
+	stat.cmn.hdr.evt_id = WLAN_CHIPSET_STATS_MGMT_DISASSOC_EVENT_ID;
+	stat.cmn.hdr.length = sizeof(struct cstats_disassoc_mgmt_frm) -
+			      sizeof(struct cstats_hdr);
+	stat.cmn.opmode = pe_session->opmode;
+	stat.cmn.vdev_id = pe_session->vdev_id;
+	stat.cmn.timestamp_us = qdf_get_time_of_the_day_us();
+	stat.cmn.time_tick = qdf_get_log_timestamp();
+
+	stat.reason = reasonCode;
+	stat.direction = dir;
+
+	wlan_cstats_host_stats(sizeof(struct cstats_disassoc_mgmt_frm), &stat);
+}
+
+void lim_cp_stats_cstats_log_assoc_req_evt(struct pe_session *pe_session,
+					   enum cstats_dir dir,
+					   uint8_t *bssid, uint8_t *sa,
+					   uint8_t ssid_len, uint8_t *ssid,
+					   bool is_ht, bool is_vht, bool is_he,
+					   bool is_eht, bool is_reassoc)
+{
+	struct cstats_assoc_req_mgmt_frm stat = {0};
+
+	if (is_reassoc) {
+		stat.cmn.hdr.evt_id =
+				WLAN_CHIPSET_STATS_MGMT_REASSOC_REQ_EVENT_ID;
+	} else {
+		stat.cmn.hdr.evt_id =
+				WLAN_CHIPSET_STATS_MGMT_ASSOC_REQ_EVENT_ID;
+	}
+
+	stat.cmn.hdr.length = sizeof(struct cstats_assoc_req_mgmt_frm) -
+			      sizeof(struct cstats_hdr);
+
+	stat.cmn.opmode = pe_session->opmode;
+	stat.cmn.vdev_id = pe_session->vdev_id;
+	stat.cmn.timestamp_us = qdf_get_time_of_the_day_us();
+	stat.cmn.time_tick = qdf_get_log_timestamp();
+
+	stat.freq = pe_session->curr_op_freq;
+	stat.ssid_len = ssid_len;
+	qdf_mem_copy(stat.ssid, ssid, ssid_len);
+
+	stat.direction = dir;
+	CSTATS_MAC_COPY(stat.bssid, bssid);
+	CSTATS_MAC_COPY(stat.sa, sa);
+
+	if (is_ht)
+		CSTATS_SET_BIT(stat.flags, CSTATS_FLAG_HT);
+
+	if (is_vht)
+		CSTATS_SET_BIT(stat.flags, CSTATS_FLAG_VHT);
+
+	if (is_he)
+		CSTATS_SET_BIT(stat.flags, CSTATS_FLAG_HE);
+
+	if (is_eht)
+		CSTATS_SET_BIT(stat.flags, CSTATS_FLAG_EHT);
+
+	wlan_cstats_host_stats(sizeof(struct cstats_assoc_req_mgmt_frm), &stat);
+}
+#endif /* WLAN_CHIPSET_STATS */

+ 131 - 0
core/mac/src/pe/lim/lim_utils.h

@@ -39,6 +39,7 @@
 #include "include/wlan_vdev_mlme.h"
 #include "wlan_mlme_vdev_mgr_interface.h"
 #include "wlan_qct_sys.h"
+#include <wlan_cp_stats_chipset_stats.h>
 
 #define LIM_QOS_AP_SUPPORTS_UAPSD         0x80
 
@@ -3401,4 +3402,134 @@ uint32_t lim_cmp_ssid(tSirMacSSid *ssid, struct pe_session *pe_session);
 void
 lim_configure_fd_for_existing_6ghz_sap(struct pe_session *session,
 				       bool is_sap_starting);
+
+#ifdef WLAN_CHIPSET_STATS
+/**
+ * lim_cp_stats_cstats_log_assoc_resp_evt() - Log chipset stats for assoc resp
+ *
+ * @session_entry: pointer to session object
+ * @dir: Direction
+ * @status_code: assoc/reassoc status
+ * @aid: association identifier
+ * @bssid: bssid
+ * @da: destination address
+ * @is_ht: is HT
+ * @is_vht: is VHT
+ * @is_he: is HE
+ * @is_eht: is EHT
+ * @is_reassoc: is reassoc frame
+ *
+ * Return : void
+ */
+void lim_cp_stats_cstats_log_assoc_resp_evt(struct pe_session *session_entry,
+					    enum cstats_dir dir,
+					    uint16_t status_code, uint16_t aid,
+					    uint8_t *bssid, uint8_t *da,
+					    bool is_ht, bool is_vht, bool is_he,
+					    bool is_eht, bool is_reassoc);
+
+/**
+ * lim_cp_stats_cstats_log_auth_evt() - Log chipset stats for auth frames
+ *
+ * @pe_session: pointer to session object
+ * @dir: direction
+ * @algo: auth algorithm
+ * @seq: auth sequence
+ * @status: Status
+ *
+ * Return : void
+ */
+void lim_cp_stats_cstats_log_auth_evt(struct pe_session *pe_session,
+				      enum cstats_dir dir, uint16_t algo,
+				      uint16_t seq, uint16_t status);
+
+/**
+ * lim_cp_stats_cstats_log_deauth_evt() - Log chipset stats for deauth frames
+ *
+ * @pe_session: pointer to session object
+ * @dir: direction
+ * @reasonCode: reason code
+ *
+ * Return : void
+ */
+void lim_cp_stats_cstats_log_deauth_evt(struct pe_session *pe_session,
+					enum cstats_dir dir,
+					uint16_t reasonCode);
+
+/**
+ * lim_cp_stats_cstats_log_disassoc_evt() - Log chipset stats for disassoc frm
+ *
+ * @pe_session: pointer to session object
+ * @dir: direction
+ * @reasonCode: reason code
+ *
+ * Return : void
+ */
+void lim_cp_stats_cstats_log_disassoc_evt(struct pe_session *pe_session,
+					  enum cstats_dir dir,
+					  uint16_t reasonCode);
+
+/**
+ * lim_cp_stats_cstats_log_assoc_req_evt() - Log chipset stats for assoc req frm
+ *
+ * @pe_session: pointer to session object
+ * @dir: Direction
+ * @bssid: bssid
+ * @sa: source addr
+ * @ssid_len: ssid length
+ * @ssid: ssid
+ * @is_ht: is HT
+ * @is_vht: is VHT
+ * @is_he: is HE
+ * @is_eht: is EHT
+ * @is_reassoc: is reassociation request
+ *
+ * Return : void
+ */
+void lim_cp_stats_cstats_log_assoc_req_evt(struct pe_session *pe_session,
+					   enum cstats_dir dir, uint8_t *bssid,
+					   uint8_t *sa, uint8_t ssid_len,
+					   uint8_t *ssid, bool is_ht,
+					   bool is_vht, bool is_he,
+					   bool is_eht, bool is_reassoc);
+#else
+static inline void
+lim_cp_stats_cstats_log_assoc_resp_evt(struct pe_session *session_entry,
+				       enum cstats_dir dir,
+				       uint16_t status_code, uint16_t aid,
+				       uint8_t *bssid, uint8_t *da,
+				       bool is_ht, bool is_vht, bool is_he,
+				       bool is_eht, bool is_reassoc)
+{
+}
+
+static inline void
+lim_cp_stats_cstats_log_auth_evt(struct pe_session *pe_session,
+				 enum cstats_dir dir, uint16_t algo,
+				 uint16_t seq, uint16_t status)
+{
+}
+
+static inline void
+lim_cp_stats_cstats_log_deauth_evt(struct pe_session *pe_session,
+				   enum cstats_dir dir, uint16_t reasonCode)
+{
+}
+
+static inline void
+lim_cp_stats_cstats_log_disassoc_evt(struct pe_session *pe_session,
+				     enum cstats_dir dir, uint16_t reasonCode)
+{
+}
+
+static inline void
+lim_cp_stats_cstats_log_assoc_req_evt(struct pe_session *pe_session,
+				      enum cstats_dir dir, uint8_t *bssid,
+				      uint8_t *sa, uint8_t ssid_len,
+				      uint8_t *ssid, bool is_ht,
+				      bool is_vht, bool is_he,
+				      bool is_eht, bool is_reassoc)
+{
+}
+#endif /* WLAN_CHIPSET_STATS */
 #endif /* __LIM_UTILS_H */