qcacmn: Rx and Tx peer statistics update

 * Update the pkt_type counters correctly within the array bound
 * Add support for NSS counters on Tx side
 * Update ampdu flag in PPDU struct
 * Add support for ampdu flag in hal_ppdu struct

Change-Id: I79ea52727124ea4be4d82912cb2513ea58e2af10
diff --git a/dp/wifi3.0/dp_rx_mon_status.c b/dp/wifi3.0/dp_rx_mon_status.c
index 7da58c0..3a748af 100644
--- a/dp/wifi3.0/dp_rx_mon_status.c
+++ b/dp/wifi3.0/dp_rx_mon_status.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -86,6 +86,11 @@
 	cdp_rx_ppdu->num_msdu = (cdp_rx_ppdu->tcp_msdu_count +
 			cdp_rx_ppdu->udp_msdu_count +
 			cdp_rx_ppdu->other_msdu_count);
+
+	if (ppdu_info->com_info.mpdu_cnt_fcs_ok > 1)
+		cdp_rx_ppdu->is_ampdu = 1;
+	else
+		cdp_rx_ppdu->is_ampdu = 0;
 }
 #else
 static inline void
@@ -124,37 +129,44 @@
 		return;
 
 	DP_STATS_UPD(peer, rx.rssi, ppdu->rssi);
+
+	if ((preamble == DOT11_A) || (preamble == DOT11_B))
+		ppdu->u.nss = 1;
+
+	if (ppdu->u.nss)
+		DP_STATS_INC(peer, rx.nss[ppdu->u.nss - 1], num_msdu);
+
 	DP_STATS_INC(peer, rx.sgi_count[ppdu->u.gi], num_msdu);
 	DP_STATS_INC(peer, rx.bw[ppdu->u.bw], num_msdu);
 	DP_STATS_INCC(peer, rx.ampdu_cnt, num_msdu, ppdu->is_ampdu);
 	DP_STATS_INCC(peer, rx.non_ampdu_cnt, num_msdu, !(ppdu->is_ampdu));
 	DP_STATS_UPD(peer, rx.rx_rate, mcs);
 	DP_STATS_INCC(peer,
-			rx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu,
+			rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
 			((mcs >= MAX_MCS_11A) && (preamble == DOT11_A)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
 			((mcs < MAX_MCS_11A) && (preamble == DOT11_A)));
 	DP_STATS_INCC(peer,
-			rx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu,
+			rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
 			((mcs >= MAX_MCS_11B) && (preamble == DOT11_B)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
 			((mcs < MAX_MCS_11B) && (preamble == DOT11_B)));
 	DP_STATS_INCC(peer,
-			rx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu,
+			rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
 			((mcs >= MAX_MCS_11A) && (preamble == DOT11_N)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
 			((mcs < MAX_MCS_11A) && (preamble == DOT11_N)));
 	DP_STATS_INCC(peer,
-			rx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu,
+			rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
 			((mcs >= MAX_MCS_11AC) && (preamble == DOT11_AC)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
 			((mcs < MAX_MCS_11AC) && (preamble == DOT11_AC)));
 	DP_STATS_INCC(peer,
-			rx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu,
+			rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
 			((mcs >= (MAX_MCS - 1)) && (preamble == DOT11_AX)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,