Bläddra i källkod

qcacld-3.0: Modify timestamp value for MLO link switch log

For event EVENT_WLAN_MLO_LINK_STATUS, the Fw send the
fw_timestamp value in milliseconds for MLO link
switch connectivity log. However, the userspace
expects the fw_timestamp value in microseconds.

For connecting fail connectivity logging, connecting
fail reason code mismatch is observed between host
and userspace.

Modify the api wlan_connectivity_mld_link_status_event()
to send the fw_timestamp value in microseconds instead
on milliseconds.

Introduce wlan_diag_connect_fail_reason enum to
facilitate proper conversion of connect fail reason
code between host and userspace.

Change-Id: I92b4f294c0e4bc68c809fbf7d01ab950eca83ac9
CRs-Fixed: 3637399
Vijay Raj 1 år sedan
förälder
incheckning
eb8f76bea2

+ 51 - 9
components/cmn_services/logging/inc/wlan_connectivity_logging.h

@@ -283,6 +283,46 @@ enum wlan_bcn_rpt_measurement_mode {
 	MEASURE_MODE_RESERVED = 0xFF
 };
 
+/**
+ * enum wlan_diag_connect_fail_reason - WLAN diag connect fail reason code
+ * @WLAN_DIAG_UNSPECIFIC_REASON: Unspecific reason
+ * @WLAN_DIAG_NO_CANDIDATE_FOUND: No candidate found
+ * @WLAN_DIAG_ABORT_DUE_TO_NEW_REQ_RECVD: Aborted as new command is
+ * received.
+ * @WLAN_DIAG_BSS_SELECT_IND_FAILED: Failed BSS select indication
+ * @WLAN_DIAG_PEER_CREATE_FAILED: peer create failed
+ * @WLAN_DIAG_JOIN_FAILED: Failed in joining state
+ * @WLAN_DIAG_JOIN_TIMEOUT: Did not receive beacon or probe response after
+ * unicast probe request
+ * @WLAN_DIAG_AUTH_FAILED: Auth rejected by AP
+ * @WLAN_DIAG_AUTH_TIMEOUT: No Auth resp from AP
+ * @WLAN_DIAG_ASSOC_FAILED: Assoc rejected by AP
+ * @WLAN_DIAG_ASSOC_TIMEOUT: No Assoc resp from AP
+ * @WLAN_DIAG_HW_MODE_FAILURE: failed to change HW mode
+ * @WLAN_DIAG_SER_FAILURE: Failed to serialize command
+ * @WLAN_DIAG_SER_TIMEOUT: Serialization cmd timeout
+ * @WLAN_DIAG_GENERIC_FAILURE: Generic failure apart from above
+ * @WLAN_DIAG_VALID_CANDIDATE_CHECK_FAIL: Valid Candidate Check fail
+ */
+enum wlan_diag_connect_fail_reason {
+	WLAN_DIAG_UNSPECIFIC_REASON = 0,
+	WLAN_DIAG_NO_CANDIDATE_FOUND = 1,
+	WLAN_DIAG_ABORT_DUE_TO_NEW_REQ_RECVD,
+	WLAN_DIAG_BSS_SELECT_IND_FAILED,
+	WLAN_DIAG_PEER_CREATE_FAILED,
+	WLAN_DIAG_JOIN_FAILED,
+	WLAN_DIAG_JOIN_TIMEOUT,
+	WLAN_DIAG_AUTH_FAILED,
+	WLAN_DIAG_AUTH_TIMEOUT,
+	WLAN_DIAG_ASSOC_FAILED,
+	WLAN_DIAG_ASSOC_TIMEOUT,
+	WLAN_DIAG_HW_MODE_FAILURE,
+	WLAN_DIAG_SER_FAILURE,
+	WLAN_DIAG_SER_TIMEOUT,
+	WLAN_DIAG_GENERIC_FAILURE,
+	WLAN_DIAG_VALID_CANDIDATE_CHECK_FAIL,
+};
+
 /**
  * struct wlan_connectivity_log_diag_cmn - Structure for diag event
  * @bssid: bssid
@@ -340,8 +380,9 @@ struct wlan_diag_mlo_cmn_info {
 };
 
 #define DIAG_MLO_SETUP_VERSION 1
+#define DIAG_MLO_SETUP_VERSION_V2 2
 
-#define MAX_BANDS 3
+#define MAX_NUM_LINKS_PER_EVENT 3
 /**
  * struct wlan_diag_mlo_setup - MLO setup structure
  * @diag_cmn: Common diag info
@@ -353,10 +394,10 @@ struct wlan_diag_mlo_cmn_info {
  */
 struct wlan_diag_mlo_setup {
 	struct wlan_connectivity_log_diag_cmn diag_cmn;
-	uint32_t version:8;
-	uint32_t num_links:8;
-	uint32_t reserved:16;
-	struct wlan_diag_mlo_cmn_info mlo_cmn_info[MAX_BANDS];
+	uint8_t version;
+	uint8_t num_links;
+	uint16_t reserved;
+	struct wlan_diag_mlo_cmn_info mlo_cmn_info[MAX_NUM_LINKS_PER_EVENT];
 } qdf_packed;
 
 #define DIAG_MLO_RECONFIG_VERSION 1
@@ -376,6 +417,7 @@ struct wlan_diag_mlo_reconfig {
 } qdf_packed;
 
 #define DIAG_MLO_T2LM_STATUS_VERSION 1
+#define DIAG_MLO_T2LM_STATUS_VERSION_V2 2
 
 /**
  * struct wlan_diag_mlo_t2lm_status - MLO T2LM status diag event structure
@@ -387,10 +429,10 @@ struct wlan_diag_mlo_reconfig {
  */
 struct wlan_diag_mlo_t2lm_status {
 	struct wlan_connectivity_log_diag_cmn diag_cmn;
-	uint32_t version:8;
-	uint32_t num_links:8;
-	uint32_t reserved:16;
-	struct wlan_diag_mlo_cmn_info mlo_cmn_info[MAX_BANDS];
+	uint8_t version;
+	uint8_t num_links;
+	uint16_t reserved;
+	struct wlan_diag_mlo_cmn_info mlo_cmn_info[MAX_NUM_LINKS_PER_EVENT];
 } qdf_packed;
 
 #define DIAG_MLO_T2LM_REQ_RESP_VERSION 1

+ 9 - 4
components/cmn_services/logging/src/wlan_connectivity_logging.c

@@ -653,7 +653,7 @@ wlan_connectivity_mlo_setup_event(struct wlan_objmgr_vdev *vdev)
 
 	wlan_diag_event.diag_cmn.ktime_us = qdf_ktime_to_us(qdf_ktime_get());
 	wlan_diag_event.diag_cmn.timestamp_us = qdf_get_time_of_the_day_us();
-	wlan_diag_event.version = DIAG_MLO_SETUP_VERSION;
+	wlan_diag_event.version = DIAG_MLO_SETUP_VERSION_V2;
 
 	if (!vdev->mlo_dev_ctx) {
 		logging_err("vdev: %d MLO dev ctx not found",
@@ -794,7 +794,7 @@ wlan_connectivity_t2lm_status_event(struct wlan_objmgr_vdev *vdev)
 
 	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_MLO_T2LM_STATUS_VERSION;
+	wlan_diag_event.version = DIAG_MLO_T2LM_STATUS_VERSION_V2;
 
 	for (dir = 0; dir < WLAN_T2LM_MAX_DIRECTION; dir++)
 		t2lm[dir].direction = WLAN_T2LM_INVALID_DIRECTION;
@@ -805,7 +805,8 @@ wlan_connectivity_t2lm_status_event(struct wlan_objmgr_vdev *vdev)
 		return;
 	}
 
-	for (i = 0; i < WLAN_MAX_ML_BSS_LINKS && i < MAX_BANDS; i++) {
+	for (i = 0;
+	     i < WLAN_MAX_ML_BSS_LINKS && i < MAX_NUM_LINKS_PER_EVENT; i++) {
 		if (qdf_is_macaddr_zero(&link_info->ap_link_addr) &&
 		    link_info->link_id == WLAN_INVALID_LINK_ID)
 			continue;
@@ -1133,7 +1134,11 @@ void wlan_connectivity_mld_link_status_event(struct wlan_objmgr_psoc *psoc,
 		wlan_convert_link_id_to_diag_band(&src->mld_addr,
 						  src->prev_link_bitmap);
 	wlan_diag_event.reason = src->reason_code;
-	wlan_diag_event.diag_cmn.fw_timestamp = src->fw_timestamp;
+	/*
+	 * FW timestamp received from FW in milliseconds and to be sent to
+	 * userspace in microseconds
+	 */
+	wlan_diag_event.diag_cmn.fw_timestamp = src->fw_timestamp * 1000;
 
 	WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event,
 				    EVENT_WLAN_MLO_LINK_STATUS);

+ 44 - 1
core/hdd/src/wlan_hdd_connectivity_logging.c

@@ -1299,6 +1299,48 @@ void wlan_hdd_start_connectivity_logging(struct hdd_context *hdd_ctx)
 #endif
 
 #ifdef CONNECTIVITY_DIAG_EVENT
+static enum wlan_diag_connect_fail_reason
+wlan_hdd_convert_con_fail_reason_to_diag_reason(
+				enum wlan_cm_connect_fail_reason reason)
+{
+	switch (reason) {
+	case CM_NO_CANDIDATE_FOUND:
+		return WLAN_DIAG_NO_CANDIDATE_FOUND;
+	case CM_ABORT_DUE_TO_NEW_REQ_RECVD:
+		return WLAN_DIAG_ABORT_DUE_TO_NEW_REQ_RECVD;
+	case CM_BSS_SELECT_IND_FAILED:
+		return WLAN_DIAG_BSS_SELECT_IND_FAILED;
+	case CM_PEER_CREATE_FAILED:
+		return WLAN_DIAG_PEER_CREATE_FAILED;
+	case CM_JOIN_FAILED:
+		return WLAN_DIAG_JOIN_FAILED;
+	case CM_JOIN_TIMEOUT:
+		return WLAN_DIAG_JOIN_TIMEOUT;
+	case CM_AUTH_FAILED:
+		return WLAN_DIAG_AUTH_FAILED;
+	case CM_AUTH_TIMEOUT:
+		return WLAN_DIAG_AUTH_TIMEOUT;
+	case CM_ASSOC_FAILED:
+		return WLAN_DIAG_ASSOC_FAILED;
+	case CM_ASSOC_TIMEOUT:
+		return WLAN_DIAG_ASSOC_TIMEOUT;
+	case CM_HW_MODE_FAILURE:
+		return WLAN_DIAG_HW_MODE_FAILURE;
+	case CM_SER_FAILURE:
+		return WLAN_DIAG_SER_FAILURE;
+	case CM_SER_TIMEOUT:
+		return WLAN_DIAG_SER_TIMEOUT;
+	case CM_GENERIC_FAILURE:
+		return WLAN_DIAG_GENERIC_FAILURE;
+	case CM_VALID_CANDIDATE_CHECK_FAIL:
+		return WLAN_DIAG_VALID_CANDIDATE_CHECK_FAIL;
+	default:
+		hdd_err("Invalid connect fail reason code");
+	}
+
+	return WLAN_DIAG_UNSPECIFIC_REASON;
+}
+
 void
 wlan_hdd_connectivity_fail_event(struct wlan_objmgr_vdev *vdev,
 				 struct wlan_cm_connect_resp *rsp)
@@ -1325,7 +1367,8 @@ wlan_hdd_connectivity_fail_event(struct wlan_objmgr_vdev *vdev,
 
 	wlan_diag_event.version = DIAG_CONN_VERSION;
 	wlan_diag_event.freq = rsp->freq;
-	wlan_diag_event.reason = rsp->reason;
+	wlan_diag_event.reason =
+	wlan_hdd_convert_con_fail_reason_to_diag_reason(rsp->reason);
 
 	WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_CONN);
 }