Browse Source

qcacld-3.0: Add support for beacon report logging

Add support for beacon report request and beacon report
response connectivity logging.

Create api wlan_diag_log_beacon_rpt_req_event() to send
Beacon report request event logs and api
lim_beacon_report_response_event() to send beacon
report response event logs.

Change-Id: Ibd7a840dfb33b1f3d321113741725f487d5acebd
CRs-Fixed: 3370902
Vijay Raj 2 years ago
parent
commit
e224946712
2 changed files with 101 additions and 1 deletions
  1. 41 0
      core/mac/src/pe/lim/lim_send_management_frames.c
  2. 60 1
      core/mac/src/pe/rrm/rrm_api.c

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

@@ -5564,6 +5564,41 @@ returnAfterError:
 	return status_code;
 } /* End lim_send_link_report_action_frame. */
 
+#ifdef CONNECTIVITY_DIAG_EVENT
+/**
+ * lim_beacon_report_response_event() - Send Beacon Report Response log
+ * event
+ * @token: Dialog token
+ * @num_rpt: Number of Report element
+ * @vdev_id: vdev Id
+ */
+static void
+lim_beacon_report_response_event(uint8_t token, uint8_t num_rpt,
+				 uint8_t vdev_id)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(wlan_diag_event, struct wlan_diag_bcn_rpt);
+
+	qdf_mem_zero(&wlan_diag_event, sizeof(wlan_diag_event));
+
+	wlan_diag_event.diag_cmn.vdev_id = vdev_id;
+	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.version = DIAG_BCN_RPT_VERSION;
+	wlan_diag_event.subtype = WLAN_CONN_DIAG_BCN_RPT_RESP_EVENT;
+	wlan_diag_event.meas_token = token;
+	wlan_diag_event.num_rpt = num_rpt;
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_BCN_RPT);
+}
+#else
+static void
+lim_beacon_report_response_event(uint8_t token, uint8_t num_rpt,
+				 uint8_t vdev_id)
+{
+}
+#endif
+
 QDF_STATUS
 lim_send_radio_measure_report_action_frame(struct mac_context *mac,
 				uint8_t dialog_token,
@@ -5701,6 +5736,12 @@ lim_send_radio_measure_report_action_frame(struct mac_context *mac,
 			nStatus);
 	}
 
+	if (frm->MeasurementReport[0].type == SIR_MAC_RRM_BEACON_TYPE) {
+		lim_beacon_report_response_event(frm->MeasurementReport[0].token,
+						 num_report,
+						 wlan_vdev_get_id(pe_session->vdev));
+	}
+
 	pe_nofl_info("TX: %s seq_no:%d dialog_token:%d no. of APs:%d is_last_rpt:%d num_report: %d peer:"QDF_MAC_ADDR_FMT,
 		     frm->MeasurementReport[0].type == SIR_MAC_RRM_BEACON_TYPE ?
 		     "[802.11 BCN_RPT]" : "[802.11 RRM]",

+ 60 - 1
core/mac/src/pe/rrm/rrm_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -546,6 +546,54 @@ void rrm_get_country_code_from_connected_profile(struct mac_context *mac,
 	}
 }
 
+#ifdef CONNECTIVITY_DIAG_EVENT
+/**
+ * wlan_diag_log_beacon_rpt_req_event() - Send Beacon Report Request logging
+ * event.
+ * @token: Dialog token
+ * @mode: Measurement mode
+ * @op_class: operating class
+ * @chan: channel number
+ * @req_mode: Request mode
+ * @duration: The duration over which the Beacon report was measured
+ * @vdev_id: vdev Id
+ */
+static void
+wlan_diag_log_beacon_rpt_req_event(uint8_t token, uint8_t mode,
+				   uint8_t op_class, uint8_t chan,
+				   uint8_t req_mode, uint32_t duration,
+				   uint8_t vdev_id)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(wlan_diag_event, struct wlan_diag_bcn_rpt);
+
+	qdf_mem_zero(&wlan_diag_event, sizeof(wlan_diag_event));
+
+	wlan_diag_event.diag_cmn.vdev_id = vdev_id;
+	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.subtype = WLAN_CONN_DIAG_BCN_RPT_REQ_EVENT;
+	wlan_diag_event.version = DIAG_BCN_RPT_VERSION;
+
+	wlan_diag_event.meas_token = token;
+	wlan_diag_event.mode = mode;
+	wlan_diag_event.op_class = op_class;
+	wlan_diag_event.chan = chan;
+	wlan_diag_event.duration = duration;
+	wlan_diag_event.req_mode = req_mode;
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_BCN_RPT);
+}
+#else
+static void
+wlan_diag_log_beacon_rpt_req_event(uint8_t token, uint8_t mode,
+				   uint8_t op_class, uint8_t chan,
+				   uint8_t req_mode, uint32_t duration,
+				   uint8_t vdev_id)
+{
+}
+#endif
+
 #define ABS(x)      ((x < 0) ? -x : x)
 /* -------------------------------------------------------------------- */
 /**
@@ -582,6 +630,7 @@ rrm_process_beacon_report_req(struct mac_context *mac,
 	char ch_buf[RRM_CH_BUF_LEN];
 	char *tmp_buf = NULL;
 	uint8_t country[WNI_CFG_COUNTRY_CODE_LEN];
+	uint8_t req_mode;
 
 	if (!pe_session) {
 		pe_err("pe_session is NULL");
@@ -639,6 +688,16 @@ rrm_process_beacon_report_req(struct mac_context *mac,
 		     pBeaconReq->measurement_request.Beacon.meas_mode,
 		     measDuration, maxDuration, sign, maxMeasduration);
 
+	req_mode = (pBeaconReq->parallel << 0) | (pBeaconReq->enable << 1) |
+		   (pBeaconReq->request << 2) | (pBeaconReq->report << 3) |
+		   (pBeaconReq->durationMandatory << 4);
+
+	wlan_diag_log_beacon_rpt_req_event(pBeaconReq->measurement_token,
+					   pBeaconReq->measurement_request.Beacon.meas_mode,
+					   pBeaconReq->measurement_request.Beacon.regClass,
+					   pBeaconReq->measurement_request.Beacon.channel,
+					   req_mode, measDuration, wlan_vdev_get_id(pe_session->vdev));
+
 	if (measDuration == 0 &&
 	    pBeaconReq->measurement_request.Beacon.meas_mode !=
 	    eSIR_BEACON_TABLE) {