Browse Source

qcacld-3.0: Update rx mpdu count in link layer stats rsp

Rx mpdu count received as part of peer link stats
event from firmware does not have the proper values.

Fix is to fetch the rx mpdu count from dp layer and
update the rx mpdu count before sending the stats to
HDD.

Change-Id: I945d32c7701f5f5c9bfbbaa6ab4576b94389c84c
CRs-Fixed: 2691648
Yeshwanth Sriram Guntuka 4 years ago
parent
commit
265174a512
2 changed files with 27 additions and 0 deletions
  1. 2 0
      core/mac/inc/sir_api.h
  2. 25 0
      core/wma/src/wma_utils.c

+ 2 - 0
core/mac/inc/sir_api.h

@@ -3368,6 +3368,8 @@ struct sir_set_ht_vht_cfg {
 #define WIFI_INVALID_PEER_ID            (-1)
 #define WIFI_INVALID_VDEV_ID            (-1)
 #define WIFI_MAX_AC                     (4)
+#define RATE_STAT_MCS_MASK              (0xFF00)
+#define RATE_STAT_GET_MCS_INDEX(x)      (((x) & RATE_STAT_MCS_MASK) >> 8)
 
 typedef struct {
 	uint32_t paramId;

+ 25 - 0
core/wma/src/wma_utils.c

@@ -65,6 +65,7 @@
 #include <wlan_mlme_api.h>
 #include <../../core/src/vdev_mgr_ops.h>
 #include "cdp_txrx_misc.h"
+#include <cdp_txrx_host_stats.h>
 
 /* MCS Based rate table */
 /* HT MCS parameters with Nss = 1 */
@@ -1612,6 +1613,10 @@ static int wma_unified_link_peer_stats_event_handler(void *handle,
 	size_t link_stats_results_size;
 	bool excess_data = false;
 	uint32_t buf_len = 0;
+	struct cdp_peer_stats *dp_stats;
+	void *dp_soc = cds_get_context(QDF_MODULE_ID_SOC);
+	QDF_STATUS status;
+	uint8_t mcs_index;
 
 	struct mac_context *mac = cds_get_context(QDF_MODULE_ID_PE);
 
@@ -1709,6 +1714,12 @@ static int wma_unified_link_peer_stats_event_handler(void *handle,
 
 	qdf_mem_copy(link_stats_results->results,
 		     &fixed_param->num_peers, peer_stats_size);
+	dp_stats = qdf_mem_malloc(sizeof(*dp_stats));
+	if (!dp_stats) {
+		WMA_LOGE("dp stats allocation failed");
+		qdf_mem_free(link_stats_results);
+		return -ENOMEM;
+	}
 
 	results = (uint8_t *) link_stats_results->results;
 	t_peer_stats = (uint8_t *) peer_stats;
@@ -1721,8 +1732,21 @@ static int wma_unified_link_peer_stats_event_handler(void *handle,
 			     t_peer_stats + next_peer_offset, peer_info_size);
 		next_res_offset += peer_info_size;
 
+		status = cdp_host_get_peer_stats(dp_soc,
+				       link_stats_results->ifaceId,
+				       (uint8_t *)&peer_stats->peer_mac_address,
+				       dp_stats);
+
 		/* Copy rate stats associated with this peer */
 		for (count = 0; count < peer_stats->num_rates; count++) {
+			mcs_index = RATE_STAT_GET_MCS_INDEX(rate_stats->rate);
+			if (QDF_IS_STATUS_SUCCESS(status)) {
+				if (rate_stats->rate && mcs_index < MAX_MCS)
+					rate_stats->rx_mpdu =
+					    dp_stats->rx.rx_mpdu_cnt[mcs_index];
+				else
+					rate_stats->rx_mpdu = 0;
+			}
 			rate_stats++;
 
 			qdf_mem_copy(results + next_res_offset,
@@ -1735,6 +1759,7 @@ static int wma_unified_link_peer_stats_event_handler(void *handle,
 		peer_stats++;
 	}
 
+	qdf_mem_free(dp_stats);
 	/* call hdd callback with Link Layer Statistics
 	 * vdev_id/ifacId in link_stats_results will be
 	 * used to retrieve the correct HDD context