ソースを参照

qcacld-3.0: Add rx rate info in connect_info debugfs

Currently in connect_info debugfs file, only tx rate info is presented.

Add rx_bit_rate to present rx rate info.

Change-Id: I24ceb287880a60896b49b69d40646b549fd9a3d1
CRs-Fixed: 2440285
Rajeev Kumar Sirasanagandla 6 年 前
コミット
e709bca3e5

+ 2 - 0
core/hdd/inc/wlan_hdd_assoc.h

@@ -156,6 +156,7 @@ struct hdd_conn_flag {
  * @rate_flags: rate flags for current connection
  * @freq: channel frequency
  * @txrate: txrate structure holds nss & datarate info
+ * @rxrate: rx rate info
  * @noise: holds noise information
  * @ht_caps: holds ht capabilities info
  * @vht_caps: holds vht capabilities info
@@ -192,6 +193,7 @@ struct hdd_connection_info {
 	uint32_t rate_flags;
 	uint32_t freq;
 	struct rate_info txrate;
+	struct rate_info rxrate;
 	int8_t noise;
 	struct ieee80211_ht_cap ht_caps;
 	struct ieee80211_vht_cap vht_caps;

+ 7 - 4
core/hdd/src/wlan_hdd_debugfs_connect.c

@@ -318,7 +318,7 @@ wlan_hdd_connect_info_debugfs(struct hdd_adapter *adapter, uint8_t *buf,
 	ssize_t length = 0;
 	struct hdd_station_ctx *hdd_sta_ctx;
 	struct hdd_connection_info *conn_info;
-	uint32_t bit_rate;
+	uint32_t tx_bit_rate, rx_bit_rate;
 	int ret_val;
 
 	hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
@@ -350,7 +350,8 @@ wlan_hdd_connect_info_debugfs(struct hdd_adapter *adapter, uint8_t *buf,
 	}
 
 	conn_info = &hdd_sta_ctx->conn_info;
-	bit_rate = cfg80211_calculate_bitrate(&conn_info->txrate);
+	tx_bit_rate = cfg80211_calculate_bitrate(&conn_info->txrate);
+	rx_bit_rate = cfg80211_calculate_bitrate(&conn_info->rxrate);
 
 	if (length >= buf_avail_len) {
 		hdd_err("No sufficient buf_avail_len");
@@ -364,7 +365,8 @@ wlan_hdd_connect_info_debugfs(struct hdd_adapter *adapter, uint8_t *buf,
 			    "freq = %u\n"
 			    "ch_width = %s\n"
 			    "signal = %ddBm\n"
-			    "bit_rate = %u\n"
+			    "tx_bit_rate = %u\n"
+			    "rx_bit_rate = %u\n"
 			    "last_auth_type = %s\n"
 			    "dot11mode = %s\n",
 			    conn_info->last_ssid.SSID.ssId,
@@ -374,7 +376,8 @@ wlan_hdd_connect_info_debugfs(struct hdd_adapter *adapter, uint8_t *buf,
 			    conn_info->freq,
 			    hdd_ch_width_str(conn_info->ch_width),
 			    conn_info->signal,
-			    bit_rate,
+			    tx_bit_rate,
+			    rx_bit_rate,
 			    hdd_auth_type_str(conn_info->last_auth_type),
 			    hdd_dot11_mode_str(conn_info->dot11mode));
 

+ 2 - 2
core/hdd/src/wlan_hdd_station_info.c

@@ -406,8 +406,8 @@ static void hdd_get_max_tx_bitrate(struct hdd_context *hdd_ctx,
 			tx_nss--;
 		}
 	}
-	if (hdd_report_max_rate(hdd_ctx->mac_handle, &sinfo,
-				tx_rate_flags, tx_mcs_index,
+	if (hdd_report_max_rate(hdd_ctx->mac_handle, &sinfo.txrate,
+				sinfo.signal, tx_rate_flags, tx_mcs_index,
 				my_tx_rate, tx_nss)) {
 		hdd_sta_ctx->cache_conn_info.max_tx_bitrate = sinfo.txrate;
 		hdd_debug("Reporting max tx rate flags %d mcs %d nss %d bw %d",

+ 86 - 74
core/hdd/src/wlan_hdd_stats.c

@@ -3935,11 +3935,12 @@ static int wlan_hdd_get_station_remote(struct wiphy *wiphy,
 	return status;
 }
 
-int hdd_report_max_rate(mac_handle_t mac_handle,
-			struct station_info *sinfo,
-			uint8_t tx_rate_flags,
-			uint8_t tx_mcs_index,
-			uint16_t my_tx_rate, uint8_t tx_nss)
+bool hdd_report_max_rate(mac_handle_t mac_handle,
+			 struct rate_info *rate,
+			 int8_t signal,
+			 uint8_t rate_flags,
+			 uint8_t mcs_index,
+			 uint16_t fw_rate, uint8_t nss)
 {
 	uint8_t i, j, rssidx;
 	uint16_t max_rate = 0;
@@ -3968,7 +3969,7 @@ int hdd_report_max_rate(mac_handle_t mac_handle,
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
 		hdd_err("HDD context is NULL");
-		return QDF_STATUS_E_FAILURE;
+		return false;
 	}
 
 	ucfg_mlme_stats_get_cfg_values(hdd_ctx->psoc,
@@ -3984,13 +3985,13 @@ int hdd_report_max_rate(mac_handle_t mac_handle,
 	} else if (ucfg_mlme_stats_is_link_speed_report_max_scaled(
 				hdd_ctx->psoc)) {
 		/* report the max possible speed with RSSI scaling */
-		if (sinfo->signal >= link_speed_rssi_high) {
+		if (signal >= link_speed_rssi_high) {
 			/* report the max possible speed */
 			rssidx = 0;
-		} else if (sinfo->signal >= link_speed_rssi_mid) {
+		} else if (signal >= link_speed_rssi_mid) {
 			/* report middle speed */
 			rssidx = 1;
-		} else if (sinfo->signal >= link_speed_rssi_low) {
+		} else if (signal >= link_speed_rssi_low) {
 			/* report middle speed */
 			rssidx = 2;
 		} else {
@@ -4011,7 +4012,7 @@ int hdd_report_max_rate(mac_handle_t mac_handle,
 					    operational_rates, &or_leng)) {
 		hdd_err("cfg get returned failure");
 		/*To keep GUI happy */
-		return 0;
+		return false;
 	}
 
 	for (i = 0; i < or_leng; i++) {
@@ -4036,7 +4037,7 @@ int hdd_report_max_rate(mac_handle_t mac_handle,
 						&er_leng)) {
 		hdd_err("cfg get returned failure");
 		/*To keep GUI happy */
-		return 0;
+		return false;
 	}
 
 	for (i = 0; i < er_leng; i++) {
@@ -4055,30 +4056,30 @@ int hdd_report_max_rate(mac_handle_t mac_handle,
 	 * Only if we are connected in non legacy mode and not reporting
 	 * actual speed
 	 */
-	if ((3 != rssidx) && !(tx_rate_flags & TX_RATE_LEGACY)) {
+	if ((3 != rssidx) && !(rate_flags & TX_RATE_LEGACY)) {
 		if (0 != ucfg_mlme_get_current_mcs_set(hdd_ctx->psoc,
 						       mcs_rates,
 						       &mcs_leng)) {
 			hdd_err("cfg get returned failure");
 			/*To keep GUI happy */
-			return 0;
+			return false;
 		}
 		rate_flag = 0;
 		supported_vht_mcs_rate = (struct index_vht_data_rate_type *)
-					  ((tx_nss == 1) ?
+					  ((nss == 1) ?
 					  &supported_vht_mcs_rate_nss1 :
 					  &supported_vht_mcs_rate_nss2);
 
-		if (tx_rate_flags & TX_RATE_VHT80)
+		if (rate_flags & TX_RATE_VHT80)
 			mode = 2;
-		else if ((tx_rate_flags & TX_RATE_VHT40) ||
-			 (tx_rate_flags & TX_RATE_HT40))
+		else if ((rate_flags & TX_RATE_VHT40) ||
+			 (rate_flags & TX_RATE_HT40))
 			mode = 1;
 		else
 			mode = 0;
 
 		/* VHT80 rate has separate rate table */
-		if (tx_rate_flags & (TX_RATE_VHT20 | TX_RATE_VHT40 |
+		if (rate_flags & (TX_RATE_VHT20 | TX_RATE_VHT40 |
 		    TX_RATE_VHT80)) {
 			stat = ucfg_mlme_cfg_get_vht_tx_mcs_map(hdd_ctx->psoc,
 								&vht_mcs_map);
@@ -4086,7 +4087,7 @@ int hdd_report_max_rate(mac_handle_t mac_handle,
 				hdd_err("failed to get tx_mcs_map");
 			vht_max_mcs = (enum data_rate_11ac_max_mcs)
 				(vht_mcs_map & DATA_RATE_11AC_MCS_MASK);
-			if (tx_rate_flags & TX_RATE_SGI)
+			if (rate_flags & TX_RATE_SGI)
 				rate_flag |= 1;
 
 			if (DATA_RATE_11AC_MAX_MCS_7 == vht_max_mcs) {
@@ -4099,31 +4100,30 @@ int hdd_report_max_rate(mac_handle_t mac_handle,
 
 			if (rssidx != 0) {
 				for (i = 0; i <= max_mcs_idx; i++) {
-					if (sinfo->signal <=
-						rssi_mcs_tbl[mode][i]) {
+					if (signal <= rssi_mcs_tbl[mode][i]) {
 						max_mcs_idx = i;
 						break;
 					}
 				}
 			}
 
-			if (tx_rate_flags & TX_RATE_VHT80) {
+			if (rate_flags & TX_RATE_VHT80) {
 				current_rate =
-				  supported_vht_mcs_rate[tx_mcs_index].
+				  supported_vht_mcs_rate[mcs_index].
 				  supported_VHT80_rate[rate_flag];
 				max_rate =
 				  supported_vht_mcs_rate[max_mcs_idx].
 					supported_VHT80_rate[rate_flag];
-			} else if (tx_rate_flags & TX_RATE_VHT40) {
+			} else if (rate_flags & TX_RATE_VHT40) {
 				current_rate =
-				  supported_vht_mcs_rate[tx_mcs_index].
+				  supported_vht_mcs_rate[mcs_index].
 				  supported_VHT40_rate[rate_flag];
 				max_rate =
 				  supported_vht_mcs_rate[max_mcs_idx].
 					supported_VHT40_rate[rate_flag];
-			} else if (tx_rate_flags & TX_RATE_VHT20) {
+			} else if (rate_flags & TX_RATE_VHT20) {
 				current_rate =
-				  supported_vht_mcs_rate[tx_mcs_index].
+				  supported_vht_mcs_rate[mcs_index].
 				  supported_VHT20_rate[rate_flag];
 				max_rate =
 				  supported_vht_mcs_rate[max_mcs_idx].
@@ -4135,22 +4135,20 @@ int hdd_report_max_rate(mac_handle_t mac_handle,
 				max_rate = current_rate;
 
 		} else {
-			if (tx_rate_flags & TX_RATE_HT40)
+			if (rate_flags & TX_RATE_HT40)
 				rate_flag |= 1;
-			if (tx_rate_flags & TX_RATE_SGI)
+			if (rate_flags & TX_RATE_SGI)
 				rate_flag |= 2;
 
 			supported_mcs_rate =
 				(struct index_data_rate_type *)
-				((tx_nss ==
-				  1) ? &supported_mcs_rate_nss1 :
+				((nss == 1) ? &supported_mcs_rate_nss1 :
 				 &supported_mcs_rate_nss2);
 
 			max_ht_idx = MAX_HT_MCS_IDX;
 			if (rssidx != 0) {
 				for (i = 0; i < MAX_HT_MCS_IDX; i++) {
-					if (sinfo->signal <=
-						rssi_mcs_tbl[mode][i]) {
+					if (signal <= rssi_mcs_tbl[mode][i]) {
 						max_ht_idx = i + 1;
 						break;
 					}
@@ -4179,67 +4177,64 @@ int hdd_report_max_rate(mac_handle_t mac_handle,
 				}
 				max_speed_mcs = 1;
 			}
-			if (tx_nss == 2)
+			if (nss == 2)
 				max_mcs_idx += MAX_HT_MCS_IDX;
 		}
 	}
 
-	else if (!(tx_rate_flags & TX_RATE_LEGACY)) {
-		max_rate = my_tx_rate;
+	else if (!(rate_flags & TX_RATE_LEGACY)) {
+		max_rate = fw_rate;
 		max_speed_mcs = 1;
-		max_mcs_idx = tx_mcs_index;
+		max_mcs_idx = mcs_index;
 	}
 	/* report a value at least as big as current rate */
-	if ((max_rate < my_tx_rate) || (0 == max_rate)) {
-		max_rate = my_tx_rate;
-		if (tx_rate_flags & TX_RATE_LEGACY) {
+	if ((max_rate < fw_rate) || (0 == max_rate)) {
+		max_rate = fw_rate;
+		if (rate_flags & TX_RATE_LEGACY) {
 			max_speed_mcs = 0;
 		} else {
 			max_speed_mcs = 1;
-			max_mcs_idx = tx_mcs_index;
+			max_mcs_idx = mcs_index;
 			}
 	}
 
-	if (tx_rate_flags & TX_RATE_LEGACY) {
-		sinfo->txrate.legacy = max_rate;
+	if (rate_flags & TX_RATE_LEGACY) {
+		rate->legacy = max_rate;
 
-		hdd_info("Reporting legacy rate %d",
-			 sinfo->txrate.legacy);
+		hdd_info("Reporting legacy rate %d", rate->legacy);
 	} else {
-		sinfo->txrate.mcs = max_mcs_idx;
-		sinfo->txrate.nss = tx_nss;
-		if (tx_rate_flags & TX_RATE_VHT80)
-			hdd_set_rate_bw(&sinfo->txrate, HDD_RATE_BW_80);
-		else if (tx_rate_flags & TX_RATE_VHT40)
-			hdd_set_rate_bw(&sinfo->txrate, HDD_RATE_BW_40);
-		else if (tx_rate_flags & TX_RATE_VHT20)
-			hdd_set_rate_bw(&sinfo->txrate, HDD_RATE_BW_20);
-
-		if (tx_rate_flags &
+		rate->mcs = max_mcs_idx;
+		rate->nss = nss;
+		if (rate_flags & TX_RATE_VHT80)
+			hdd_set_rate_bw(rate, HDD_RATE_BW_80);
+		else if (rate_flags & TX_RATE_VHT40)
+			hdd_set_rate_bw(rate, HDD_RATE_BW_40);
+		else if (rate_flags & TX_RATE_VHT20)
+			hdd_set_rate_bw(rate, HDD_RATE_BW_20);
+
+		if (rate_flags &
 		    (TX_RATE_HT20 | TX_RATE_HT40)) {
-			sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
-			if (tx_rate_flags & TX_RATE_HT40)
-				hdd_set_rate_bw(&sinfo->txrate,
+			rate->flags |= RATE_INFO_FLAGS_MCS;
+			if (rate_flags & TX_RATE_HT40)
+				hdd_set_rate_bw(rate,
 						HDD_RATE_BW_40);
-			else if (tx_rate_flags & TX_RATE_HT20)
-				hdd_set_rate_bw(&sinfo->txrate,
+			else if (rate_flags & TX_RATE_HT20)
+				hdd_set_rate_bw(rate,
 						HDD_RATE_BW_20);
 		} else {
-			sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS;
+			rate->flags |= RATE_INFO_FLAGS_VHT_MCS;
 		}
 
-		if (tx_rate_flags & TX_RATE_SGI) {
-			if (!
-			    (sinfo->txrate.
-			     flags & RATE_INFO_FLAGS_VHT_MCS))
-				sinfo->txrate.flags |=
-					RATE_INFO_FLAGS_MCS;
-			sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
+		if (rate_flags & TX_RATE_SGI) {
+			if (!(rate->flags & RATE_INFO_FLAGS_VHT_MCS))
+				rate->flags |= RATE_INFO_FLAGS_MCS;
+			rate->flags |= RATE_INFO_FLAGS_SHORT_GI;
 		}
 		linkspeed_dbg("Reporting MCS rate %d flags %x\n",
-			      sinfo->txrate.mcs, sinfo->txrate.flags);
+			      rate->mcs, rate->flags);
 	}
-	return 1;
+
+	return true;
 }
 
 /**
@@ -4519,12 +4514,26 @@ static int wlan_hdd_get_sta_stats(struct wiphy *wiphy,
 	hdd_set_rate_bw(&sinfo->txrate, HDD_RATE_BW_20);
 
 	if (!ucfg_mlme_stats_is_link_speed_report_actual(hdd_ctx->psoc)) {
-		if (!hdd_report_max_rate(mac_handle, sinfo,
-					 tx_rate_flags, tx_mcs_index,
-					 my_tx_rate, tx_nss)) {
+		bool tx_rate_calc;
+		bool rx_rate_calc;
+
+		tx_rate_calc = hdd_report_max_rate(mac_handle, &sinfo->txrate,
+						   sinfo->signal,
+						   tx_rate_flags,
+						   tx_mcs_index,
+						   my_tx_rate,
+						   tx_nss);
+
+		rx_rate_calc = hdd_report_max_rate(mac_handle, &sinfo->rxrate,
+						   sinfo->signal,
+						   rx_rate_flags,
+						   rx_mcs_index,
+						   my_rx_rate,
+						   rx_nss);
+
+		if (!tx_rate_calc || !rx_rate_calc)
 			/* Keep GUI happy */
 			return 0;
-		}
 	} else {
 
 		/* Fill TX stats */
@@ -4548,6 +4557,9 @@ static int wlan_hdd_get_sta_stats(struct wiphy *wiphy,
 	qdf_mem_copy(&sta_ctx->cache_conn_info.txrate,
 		     &sinfo->txrate, sizeof(sinfo->txrate));
 
+	qdf_mem_copy(&sta_ctx->conn_info.rxrate,
+		     &sinfo->rxrate, sizeof(sinfo->rxrate));
+
 	sinfo->filled |= HDD_INFO_TX_BITRATE |
 			 HDD_INFO_RX_BITRATE |
 			 HDD_INFO_TX_BYTES   |

+ 14 - 12
core/hdd/src/wlan_hdd_stats.h

@@ -470,18 +470,20 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *hdd_ctx);
  * to be sent to the userspace.
  *
  * @mac_handle: The mac handle
- * @sinfo: The station_info struct to be filled
- * @tx_rate_flags: The TX rate flags computed from tx rate
- * @tx_mcs_index; The TX mcs index computed from tx rate
- * @my_tx_rate: The tx_rate from fw stats
- * @tx_nss: The TX NSS from fw stats
- *
- * Return: 0 for success
+ * @rate: The station_info tx/rx rate to be filled
+ * @signal: signal from station_info
+ * @rate_flags: TX/RX rate flags computed from tx/rx rate
+ * @mcs_index; The TX/RX mcs index computed from tx/rx rate
+ * @fw_rate: The tx/rx rate from fw stats
+ * @nss: The TX/RX NSS from fw stats
+ *
+ * Return: True if fill is successful
  */
-int hdd_report_max_rate(mac_handle_t mac_handle,
-			struct station_info *sinfo,
-			uint8_t tx_rate_flags,
-			uint8_t tx_mcs_index,
-			uint16_t my_tx_rate, uint8_t tx_nss);
+bool hdd_report_max_rate(mac_handle_t mac_handle,
+			 struct rate_info *rate,
+			 int8_t signal,
+			 uint8_t rate_flags,
+			 uint8_t mcs_index,
+			 uint16_t fw_rate, uint8_t nss);
 
 #endif /* end #if !defined(WLAN_HDD_STATS_H) */