Browse Source

qcacld-3.0: Add support for Neighbor report Logging

In api cm_roam_stats_print_11kv_info(), neighbor report
logging was not supported.

Add support for Neighbor report connectivity logging
through api cm_roam_neigh_rpt_req_event() for Neighbor
report request event and api cm_roam_neigh_rpt_resp_event()
for Neighbor report response event.

Change-Id: If9d93584d4030f76b5175d361dfd34fce3b5b5b1
CRs-Fixed: 3370797
Vijay Raj 2 years ago
parent
commit
0a934e2617

+ 47 - 0
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.c

@@ -6699,6 +6699,53 @@ cm_roam_btm_query_event(struct wmi_neighbor_report_data *btm_data,
 	return status;
 }
 
+void
+cm_roam_neigh_rpt_req_event(struct wmi_neighbor_report_data *neigh_rpt,
+			    struct wlan_objmgr_vdev *vdev)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(wlan_diag_event, struct wlan_diag_nbr_rpt);
+
+	qdf_mem_zero(&wlan_diag_event, sizeof(wlan_diag_event));
+
+	populate_diag_cmn(&wlan_diag_event.diag_cmn, wlan_vdev_get_id(vdev),
+			  (uint64_t)neigh_rpt->timestamp, NULL);
+
+	wlan_diag_event.subtype = WLAN_CONN_DIAG_NBR_RPT_REQ_EVENT;
+	wlan_diag_event.version = DIAG_NBR_RPT_VERSION;
+	wlan_diag_event.token = neigh_rpt->req_token;
+
+	wlan_vdev_mlme_get_ssid(vdev, wlan_diag_event.ssid,
+				(uint8_t *)&wlan_diag_event.ssid_len);
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_NBR_RPT);
+}
+
+void
+cm_roam_neigh_rpt_resp_event(struct wmi_neighbor_report_data *neigh_rpt,
+			     uint8_t vdev_id)
+{
+	uint8_t i;
+
+	WLAN_HOST_DIAG_EVENT_DEF(wlan_diag_event, struct wlan_diag_nbr_rpt);
+
+	qdf_mem_zero(&wlan_diag_event, sizeof(wlan_diag_event));
+
+	populate_diag_cmn(&wlan_diag_event.diag_cmn, vdev_id,
+			  (uint64_t)neigh_rpt->timestamp, NULL);
+
+	wlan_diag_event.subtype = WLAN_CONN_DIAG_NBR_RPT_RESP_EVENT;
+	wlan_diag_event.version = DIAG_NBR_RPT_VERSION;
+	wlan_diag_event.token = neigh_rpt->resp_token;
+	wlan_diag_event.num_freq = neigh_rpt->num_freq;
+
+	for (i = 0; i < neigh_rpt->num_freq; i++)
+		wlan_diag_event.freq[i] = neigh_rpt->freq[i];
+
+	wlan_diag_event.num_rpt = neigh_rpt->num_rpt;
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_NBR_RPT);
+}
+
 #define WTC_BTM_RESPONSE_SUBCODE 0xFF
 static void
 cm_roam_wtc_btm_event(struct wmi_roam_trigger_info *trigger_info,

+ 32 - 0
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.h

@@ -624,6 +624,26 @@ QDF_STATUS
 cm_roam_beacon_loss_disconnect_event(struct wlan_objmgr_psoc *psoc,
 				     struct qdf_mac_addr bssid,
 				     uint8_t vdev_id);
+
+/**
+ * cm_roam_neigh_rpt_req_event() - Send Neighbor Report request logging
+ * event
+ * @neigh_rpt: Neighbor Report parameter
+ * @vdev: vdev pointer
+ */
+void
+cm_roam_neigh_rpt_req_event(struct wmi_neighbor_report_data *neigh_rpt,
+			    struct wlan_objmgr_vdev *vdev);
+
+/**
+ * cm_roam_neigh_rpt_resp_event() - Send Neighbor Report response logging
+ * event
+ * @neigh_rpt: Neighbor Report parameter
+ * @vdev_id: vdev id
+ */
+void
+cm_roam_neigh_rpt_resp_event(struct wmi_neighbor_report_data *neigh_rpt,
+			     uint8_t vdev_id);
 #else
 static inline QDF_STATUS
 cm_roam_mgmt_frame_event(struct roam_frame_info *frame_data,
@@ -662,5 +682,17 @@ cm_roam_beacon_loss_disconnect_event(struct wlan_objmgr_psoc *psoc,
 {
 	return QDF_STATUS_E_NOSUPPORT;
 }
+
+static inline void
+cm_roam_neigh_rpt_req_event(struct wmi_neighbor_report_data *neigh_rpt,
+			    struct wlan_objmgr_vdev *vdev)
+{
+}
+
+static inline void
+cm_roam_neigh_rpt_resp_event(struct wmi_neighbor_report_data *neigh_rpt,
+			     uint8_t vdev_id)
+{
+}
 #endif /* FEATURE_CONNECTIVITY_LOGGING */
 #endif /* _WLAN_CM_ROAM_OFFLOAD_H_ */

+ 24 - 3
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c

@@ -3063,6 +3063,7 @@ cm_roam_stats_print_roam_result(struct wlan_objmgr_psoc *psoc,
 
 /**
  * cm_roam_stats_print_11kv_info  - Print neighbor report/BTM related data
+ * @psoc: Pointer to psoc object
  * @neigh_rpt: Pointer to the extracted TLV structure
  * @vdev_id:   Vdev ID
  *
@@ -3072,7 +3073,8 @@ cm_roam_stats_print_roam_result(struct wlan_objmgr_psoc *psoc,
  * Return: none
  */
 static void
-cm_roam_stats_print_11kv_info(struct wmi_neighbor_report_data *neigh_rpt,
+cm_roam_stats_print_11kv_info(struct wlan_objmgr_psoc *psoc,
+			      struct wmi_neighbor_report_data *neigh_rpt,
 			      uint8_t vdev_id)
 {
 	char time[TIME_STRING_LEN], time1[TIME_STRING_LEN];
@@ -3080,6 +3082,7 @@ cm_roam_stats_print_11kv_info(struct wmi_neighbor_report_data *neigh_rpt,
 	uint8_t type = neigh_rpt->req_type, i;
 	uint16_t buf_left = ROAM_CHANNEL_BUF_SIZE, buf_cons;
 	uint8_t num_ch = neigh_rpt->num_freq;
+	struct wlan_objmgr_vdev *vdev;
 
 	if (!type)
 		return;
@@ -3113,6 +3116,18 @@ cm_roam_stats_print_11kv_info(struct wmi_neighbor_report_data *neigh_rpt,
 
 	if (type == WLAN_ROAM_11KV_REQ_TYPE_BTM)
 		cm_roam_btm_query_event(neigh_rpt, vdev_id);
+	else if (type == WLAN_ROAM_11KV_REQ_TYPE_NEIGH_RPT) {
+		vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+							WLAN_MLME_OBJMGR_ID);
+		if (!vdev) {
+			mlme_err("vdev pointer not found");
+			goto out;
+		}
+
+		cm_roam_neigh_rpt_req_event(neigh_rpt, vdev);
+
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
+	}
 
 	if (neigh_rpt->resp_time) {
 		mlme_get_converted_timestamp(neigh_rpt->resp_time, time1);
@@ -3121,11 +3136,16 @@ cm_roam_stats_print_11kv_info(struct wmi_neighbor_report_data *neigh_rpt,
 			       "BTM_REQ" : "NEIGH_RPT_RSP",
 			       vdev_id,
 			       (num_ch > 0) ? buf : "NO Ch update");
+
+		if (type == WLAN_ROAM_11KV_REQ_TYPE_NEIGH_RPT)
+			cm_roam_neigh_rpt_resp_event(neigh_rpt, vdev_id);
+
 	} else {
 		mlme_nofl_info("%s No response received from AP",
 			       (type == WLAN_ROAM_11KV_REQ_TYPE_BTM) ?
 			       "BTM" : "NEIGH_RPT");
 	}
+out:
 	qdf_mem_free(buf);
 }
 
@@ -3277,7 +3297,7 @@ cm_roam_handle_btm_stats(struct wlan_objmgr_psoc *psoc,
 	bool log_btm_frames_only = false;
 
 	if (stats_info->data_11kv[i].present)
-		cm_roam_stats_print_11kv_info(&stats_info->data_11kv[i],
+		cm_roam_stats_print_11kv_info(psoc, &stats_info->data_11kv[i],
 					      stats_info->vdev_id);
 
 	/*
@@ -3450,7 +3470,8 @@ cm_roam_stats_event_handler(struct wlan_objmgr_psoc *psoc,
 		 */
 
 		if (stats_info->data_11kv[0].present)
-			cm_roam_stats_print_11kv_info(&stats_info->data_11kv[0],
+			cm_roam_stats_print_11kv_info(psoc,
+						      &stats_info->data_11kv[0],
 						      stats_info->vdev_id);
 
 		if (stats_info->trigger[0].present &&