Jelajahi Sumber

qcacld-3.0: Add support for MLO get_station stats

As part of MLO stats feature, add support to process get_station
stats for all MLO vdevs and store them in the corresponding adapters.

Change-Id: I21034f7769290603f1540c84aed55cc0a39defcf
CRs-Fixed: 3181022
Aditya Kodukula 2 tahun lalu
induk
melakukan
4fa9c424ee

+ 87 - 35
components/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c

@@ -750,6 +750,40 @@ tgt_mc_cp_stats_extract_congestion_stats(struct wlan_objmgr_psoc *psoc,
 }
 #endif
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void
+update_ml_vdev_id_from_stats_event(struct wlan_objmgr_psoc *psoc,
+				   struct stats_event *ev,
+				   struct request_info *req,
+				   uint8_t *vdev_id)
+{
+	uint8_t i, j, t_vdev_id;
+
+	if (!wlan_vdev_mlme_get_is_mlo_vdev(psoc, req->vdev_id)) {
+		*vdev_id = req->vdev_id;
+		return;
+	}
+
+	for (i = 0; i < ev->num_summary_stats; i++) {
+		t_vdev_id = ev->vdev_summary_stats[i].vdev_id;
+		for (j = 0; j < req->ml_vdev_info.ml_vdev_count; j++) {
+			if (t_vdev_id == req->ml_vdev_info.ml_vdev_id[j]) {
+				*vdev_id = req->ml_vdev_info.ml_vdev_id[j];
+				break;
+			}
+		}
+	}
+}
+#else
+static void
+update_ml_vdev_id_from_stats_event(struct wlan_objmgr_psoc *psoc,
+				   struct stats_event *ev,
+				   struct request_info *req,
+				   uint8_t *vdev_id)
+{
+}
+#endif
+
 static void tgt_mc_cp_stats_extract_cca_stats(struct wlan_objmgr_psoc *psoc,
 						  struct stats_event *ev)
 {
@@ -829,7 +863,7 @@ static void tgt_mc_cp_stats_extract_vdev_summary_stats(
 					struct wlan_objmgr_psoc *psoc,
 					struct stats_event *ev)
 {
-	uint8_t i;
+	uint8_t i, vdev_id;
 	QDF_STATUS status;
 	struct wlan_objmgr_peer *peer = NULL;
 	struct request_info last_req = {0};
@@ -850,17 +884,19 @@ static void tgt_mc_cp_stats_extract_vdev_summary_stats(
 		return;
 	}
 
+	vdev_id = last_req.vdev_id;
+	update_ml_vdev_id_from_stats_event(psoc, ev, &last_req, &vdev_id);
 	for (i = 0; i < ev->num_summary_stats; i++) {
-		if (ev->vdev_summary_stats[i].vdev_id == last_req.vdev_id)
+		if (ev->vdev_summary_stats[i].vdev_id == vdev_id)
 			break;
 	}
 
 	if (i == ev->num_summary_stats) {
-		cp_stats_debug("vdev_id %d not found", last_req.vdev_id);
+		cp_stats_debug("vdev_id %d not found", vdev_id);
 		return;
 	}
 
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, last_req.vdev_id,
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
 						    WLAN_CP_STATS_ID);
 	if (!vdev) {
 		cp_stats_err("vdev is null");
@@ -910,7 +946,7 @@ static void tgt_mc_cp_stats_extract_vdev_chain_rssi_stats(
 					struct wlan_objmgr_psoc *psoc,
 					struct stats_event *ev)
 {
-	uint8_t i, j;
+	uint8_t i, j, vdev_id;
 	QDF_STATUS status;
 	struct request_info last_req = {0};
 	struct wlan_objmgr_vdev *vdev;
@@ -929,43 +965,38 @@ static void tgt_mc_cp_stats_extract_vdev_chain_rssi_stats(
 	}
 
 	for (i = 0; i < ev->num_chain_rssi_stats; i++) {
-		if (ev->vdev_chain_rssi[i].vdev_id == last_req.vdev_id)
-			break;
-	}
-
-	if (i == ev->num_chain_rssi_stats) {
-		cp_stats_debug("vdev_id %d not found", last_req.vdev_id);
-		return;
-	}
-
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, last_req.vdev_id,
-						    WLAN_CP_STATS_ID);
-	if (!vdev) {
-		cp_stats_err("vdev is null");
-		return;
-	}
+		vdev_id = last_req.vdev_id;
+		update_ml_vdev_id_from_stats_event(psoc, ev,
+						   &last_req, &vdev_id);
+		vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+							    WLAN_CP_STATS_ID);
+		if (!vdev) {
+			cp_stats_err("vdev is null");
+			return;
+		}
 
-	vdev_cp_stats_priv = wlan_cp_stats_get_vdev_stats_obj(vdev);
-	if (!vdev_cp_stats_priv) {
-		cp_stats_err("vdev cp stats object is null");
-		goto end;
-	}
+		vdev_cp_stats_priv = wlan_cp_stats_get_vdev_stats_obj(vdev);
+		if (!vdev_cp_stats_priv) {
+			cp_stats_err("vdev cp stats object is null");
+			wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
+			return;
+		}
 
-	wlan_cp_stats_vdev_obj_lock(vdev_cp_stats_priv);
-	vdev_mc_stats = vdev_cp_stats_priv->vdev_stats;
-	for (j = 0; j < MAX_NUM_CHAINS; j++) {
-		vdev_mc_stats->chain_rssi[j] =
+		wlan_cp_stats_vdev_obj_lock(vdev_cp_stats_priv);
+		vdev_mc_stats = vdev_cp_stats_priv->vdev_stats;
+		for (j = 0; j < MAX_NUM_CHAINS; j++) {
+			vdev_mc_stats->chain_rssi[j] =
 					ev->vdev_chain_rssi[i].chain_rssi[j];
-	}
-	wlan_cp_stats_vdev_obj_unlock(vdev_cp_stats_priv);
+		}
+		wlan_cp_stats_vdev_obj_unlock(vdev_cp_stats_priv);
 
-end:
-	wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
+	}
 }
 
 static void
-tgt_mc_cp_stats_prepare_n_send_raw_station_stats(struct wlan_objmgr_psoc *psoc,
-						 struct request_info *last_req)
+tgt_mc_cp_stats_send_raw_station_stats(struct wlan_objmgr_psoc *psoc,
+				       struct request_info *last_req)
 {
 	/* station_stats to be given to userspace thread */
 	struct stats_event info = {0};
@@ -1067,6 +1098,27 @@ end:
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void
+tgt_mc_cp_stats_prepare_n_send_raw_station_stats(struct wlan_objmgr_psoc *psoc,
+						 struct request_info *last_req)
+{
+	uint8_t i;
+
+	for (i = 0; i < last_req->ml_vdev_info.ml_vdev_count; i++) {
+		last_req->vdev_id = last_req->ml_vdev_info.ml_vdev_id[i];
+		tgt_mc_cp_stats_send_raw_station_stats(psoc, last_req);
+	}
+}
+#else
+static void
+tgt_mc_cp_stats_prepare_n_send_raw_station_stats(struct wlan_objmgr_psoc *psoc,
+						 struct request_info *last_req)
+{
+	tgt_mc_cp_stats_send_raw_station_stats(psoc, last_req);
+}
+#endif
+
 static void tgt_mc_cp_stats_extract_station_stats(
 				struct wlan_objmgr_psoc *psoc,
 				struct stats_event *ev)

+ 1 - 1
core/hdd/src/wlan_hdd_stats.c

@@ -2006,7 +2006,7 @@ static void cache_station_stats_cb(struct stats_event *ev, void *cookie)
 {
 	struct hdd_adapter *adapter = cookie, *next_adapter = NULL;
 	struct hdd_context *hdd_ctx = adapter->hdd_ctx;
-	uint8_t vdev_id = adapter->vdev_id;
+	uint8_t vdev_id = ev->vdev_summary_stats->vdev_id;
 	wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DISPLAY_TXRX_STATS;
 
 	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,