Forráskód Böngészése

qcacld-3.0: Add change to get per vdev tx power

Add change to get txpower per vdev in vdev extended
stats from firmware. If per vdev tx power is set
then get it from extended stats received from
firmware. Otherwise, get pdev tx power.

Change-Id: I62b4516ee2951ef3e71600575e7e69a5213fdb40
CRs-Fixed: 3495828
Shailendra Singh 1 éve
szülő
commit
dc45a92479

+ 2 - 0
components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h

@@ -445,10 +445,12 @@ struct pmf_bcn_protect_stats {
  * struct vdev_summary_extd_stats - vdev summary extended stats
  * @vdev_id: vdev_id of the event
  * @is_mlo_vdev_active: is the mlo vdev currently active
+ * @vdev_tx_power: vdev tx power
  */
 struct vdev_summary_extd_stats {
 	uint8_t vdev_id;
 	bool is_mlo_vdev_active;
+	uint32_t vdev_tx_power;
 };
 
 /**

+ 81 - 13
components/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c

@@ -125,7 +125,6 @@ static void tgt_mc_cp_stats_extract_tx_power(struct wlan_objmgr_psoc *psoc,
 	struct wlan_objmgr_vdev *vdev = NULL;
 	struct pdev_mc_cp_stats *pdev_mc_stats;
 	struct pdev_cp_stats *pdev_cp_stats_priv;
-	bool pending = false;
 
 	if (!ev->pdev_stats)
 		return;
@@ -180,17 +179,6 @@ static void tgt_mc_cp_stats_extract_tx_power(struct wlan_objmgr_psoc *psoc,
 			ev->pdev_stats[pdev_id].max_pwr;
 
 	wlan_cp_stats_pdev_obj_unlock(pdev_cp_stats_priv);
-	if (is_station_stats)
-		goto end;
-
-	if (mac_id == ev->mac_seq_num) {
-		ucfg_mc_cp_stats_reset_pending_req(psoc,
-						   TYPE_CONNECTION_TX_POWER,
-						   &last_req,
-						   &pending);
-		if (last_req.u.get_tx_power_cb && pending)
-			last_req.u.get_tx_power_cb(max_pwr, last_req.cookie);
-	}
 
 end:
 	if (vdev)
@@ -1216,6 +1204,86 @@ end:
 	return QDF_STATUS_E_NULL_VALUE;
 }
 
+static QDF_STATUS
+tgt_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev, int *dbm)
+{
+	struct wlan_objmgr_pdev *pdev;
+	struct pdev_mc_cp_stats *pdev_mc_stats;
+	struct pdev_cp_stats *pdev_cp_stats_priv;
+	struct vdev_mc_cp_stats *vdev_mc_stats;
+	struct vdev_cp_stats *vdev_cp_stat;
+	uint32_t vdev_power = 0;
+
+	vdev_cp_stat = wlan_cp_stats_get_vdev_stats_obj(vdev);
+	if (vdev_cp_stat) {
+		wlan_cp_stats_vdev_obj_lock(vdev_cp_stat);
+		vdev_mc_stats = vdev_cp_stat->vdev_stats;
+		vdev_power = vdev_mc_stats->vdev_extd_stats.vdev_tx_power;
+		wlan_cp_stats_vdev_obj_unlock(vdev_cp_stat);
+		if (vdev_power) {
+			*dbm = vdev_power;
+			return QDF_STATUS_SUCCESS;
+		}
+	}
+
+	pdev = wlan_vdev_get_pdev(vdev);
+	pdev_cp_stats_priv = wlan_cp_stats_get_pdev_stats_obj(pdev);
+	if (!pdev_cp_stats_priv) {
+		cp_stats_err("pdev cp stats object is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	wlan_cp_stats_pdev_obj_lock(pdev_cp_stats_priv);
+	pdev_mc_stats = pdev_cp_stats_priv->pdev_stats;
+	*dbm = pdev_mc_stats->max_pwr;
+	wlan_cp_stats_pdev_obj_unlock(pdev_cp_stats_priv);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static void
+tgt_mc_cp_stats_extract_vdev_and_extd_stats(struct wlan_objmgr_psoc *psoc,
+					    struct stats_event *ev)
+{
+	QDF_STATUS status;
+	struct request_info last_req = {0};
+	bool pending = false;
+	int32_t max_pwr = 0;
+	struct wlan_objmgr_vdev *vdev = NULL;
+
+	status = ucfg_mc_cp_stats_get_pending_req(psoc,
+						  TYPE_CONNECTION_TX_POWER,
+						  &last_req);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		cp_stats_err("ucfg_mc_cp_stats_get_pending_req failed");
+		return;
+	}
+
+	if (ev->pdev_stats)
+		tgt_mc_cp_stats_extract_tx_power(psoc, ev, false);
+	else if (ev->vdev_extd_stats)
+		tgt_mc_cp_stats_extract_vdev_extd_stats(psoc, ev);
+
+	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;
+	}
+	tgt_mc_cp_stats_get_tx_power(vdev, &max_pwr);
+
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
+
+	if (tgt_mc_cp_stats_is_last_event(ev, TYPE_CONNECTION_TX_POWER)) {
+		ucfg_mc_cp_stats_reset_pending_req(psoc,
+						   TYPE_CONNECTION_TX_POWER,
+						   &last_req,
+						   &pending);
+		if (last_req.u.get_tx_power_cb && pending)
+			last_req.u.get_tx_power_cb(max_pwr, last_req.cookie);
+	}
+}
+
 static void
 tgt_mc_cp_stats_send_raw_station_stats(struct wlan_objmgr_psoc *psoc,
 				       struct request_info *last_req)
@@ -1374,7 +1442,7 @@ QDF_STATUS tgt_mc_cp_stats_process_stats_event(struct wlan_objmgr_psoc *psoc,
 					       struct stats_event *ev)
 {
 	if (ucfg_mc_cp_stats_is_req_pending(psoc, TYPE_CONNECTION_TX_POWER))
-		tgt_mc_cp_stats_extract_tx_power(psoc, ev, false);
+		tgt_mc_cp_stats_extract_vdev_and_extd_stats(psoc, ev);
 
 	if (ucfg_mc_cp_stats_is_req_pending(psoc, TYPE_PEER_STATS))
 		tgt_mc_cp_stats_extract_peer_stats(psoc, ev, false);

+ 15 - 0
components/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c

@@ -810,6 +810,21 @@ QDF_STATUS ucfg_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev,
 	struct wlan_objmgr_pdev *pdev;
 	struct pdev_mc_cp_stats *pdev_mc_stats;
 	struct pdev_cp_stats *pdev_cp_stats_priv;
+	struct vdev_mc_cp_stats *vdev_mc_stats;
+	struct vdev_cp_stats *vdev_cp_stat;
+	uint32_t vdev_power = 0;
+
+	vdev_cp_stat = wlan_cp_stats_get_vdev_stats_obj(vdev);
+	if (vdev_cp_stat) {
+		wlan_cp_stats_vdev_obj_lock(vdev_cp_stat);
+		vdev_mc_stats = vdev_cp_stat->vdev_stats;
+		vdev_power = vdev_mc_stats->vdev_extd_stats.vdev_tx_power;
+		wlan_cp_stats_vdev_obj_unlock(vdev_cp_stat);
+		if (vdev_power) {
+			*dbm = vdev_power;
+			return QDF_STATUS_SUCCESS;
+		}
+	}
 
 	pdev = wlan_vdev_get_pdev(vdev);
 	pdev_cp_stats_priv = wlan_cp_stats_get_pdev_stats_obj(pdev);

+ 2 - 1
components/target_if/cp_stats/src/target_if_mc_cp_stats.c

@@ -904,6 +904,7 @@ target_if_cp_stats_extract_vdev_extd_stats(struct wmi_unified *wmi_hdl,
 		ev->vdev_extd_stats[i].vdev_id = stats[0].vdev_id;
 		ev->vdev_extd_stats[i].is_mlo_vdev_active =
 						stats[0].is_mlo_vdev_active;
+		ev->vdev_extd_stats[i].vdev_tx_power = stats[i].vdev_tx_power;
 	}
 
 	qdf_mem_free(stats);
@@ -1611,7 +1612,7 @@ static uint32_t get_stats_id(enum stats_req_type type)
 	default:
 		break;
 	case TYPE_CONNECTION_TX_POWER:
-		return WMI_REQUEST_PDEV_STAT;
+		return WMI_REQUEST_PDEV_STAT | WMI_REQUEST_VDEV_EXTD_STAT;
 	case TYPE_CONGESTION_STATS:
 		return WMI_REQUEST_PDEV_STAT | WMI_REQUEST_PDEV_EXTD_STAT;
 	case TYPE_PEER_STATS: