Bladeren bron

qcacld-3.0: Add API to get station TX rate for EasyMesh SAP

EasyMesh application will get current TX rate information of connected
station. Add API to support it.

Change-Id: I6778e1ae18f3efe89930a5423455ebf3f8084a95
CRs-Fixed: 3406509
Bing Sun 2 jaren geleden
bovenliggende
commit
23dfd3c2f8
1 gewijzigde bestanden met toevoegingen van 35 en 0 verwijderingen
  1. 35 0
      core/hdd/src/wlan_hdd_son.c

+ 35 - 0
core/hdd/src/wlan_hdd_son.c

@@ -2353,10 +2353,42 @@ static QDF_STATUS hdd_son_get_node_info_sta(struct wlan_objmgr_vdev *vdev,
 	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 	node_info->tx_bitrate = cfg80211_calculate_bitrate(
 			&sta_ctx->cache_conn_info.max_tx_bitrate);
+	/* convert to Mbps */
+	node_info->tx_bitrate = qdf_do_div(node_info->tx_bitrate, 10);
 	hdd_debug("tx_bitrate %u", node_info->tx_bitrate);
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * hdd_son_get_peer_tx_rate() - Get peer tx rate from FW
+ * @vdev: pointer to object mgr vdev
+ * @peer_macaddr: peer mac address
+ *
+ * Return: tx rate in Kbps
+ */
+static uint32_t hdd_son_get_peer_tx_rate(struct wlan_objmgr_vdev *vdev,
+					 uint8_t *peer_macaddr)
+{
+	uint32_t tx_rate = 0;
+	struct stats_event *stats;
+	int retval = 0;
+
+	stats = wlan_cfg80211_mc_cp_stats_get_peer_stats(vdev,
+							 peer_macaddr,
+							 &retval);
+	if (retval || !stats) {
+		if (stats)
+			wlan_cfg80211_mc_cp_stats_free_stats_event(stats);
+		hdd_err("Unable to get peer tx rate from fw");
+		return tx_rate;
+	}
+
+	tx_rate = stats->peer_stats_info_ext->tx_rate;
+	wlan_cfg80211_mc_cp_stats_free_stats_event(stats);
+
+	return tx_rate;
+}
+
 static QDF_STATUS hdd_son_get_node_info_sap(struct wlan_objmgr_vdev *vdev,
 					    uint8_t *mac_addr,
 					    wlan_node_info *node_info)
@@ -2378,6 +2410,9 @@ static QDF_STATUS hdd_son_get_node_info_sap(struct wlan_objmgr_vdev *vdev,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	node_info->tx_bitrate = hdd_son_get_peer_tx_rate(vdev, mac_addr);
+	/* convert it to Mbps */
+	node_info->tx_bitrate = qdf_do_div(node_info->tx_bitrate, 1000);
 	node_info->max_chwidth =
 			hdd_chan_width_to_son_chwidth(sta_info->ch_width);
 	node_info->num_streams = sta_info->nss;