Browse Source

qcacmn: PPDU changes for DP Componentization

PPDU rate related change moved to data path layer

Change-Id: Id362da61336fb439e394437636af53c0c2c10988
y 6 years ago
parent
commit
db24745af8

+ 0 - 126
dp/cmn_dp_api/dp_ratetable.c

@@ -85,14 +85,12 @@ const struct DP_CMN_RATE_TABLE {
 	struct {
 		uint32_t validmodemask;
 		enum DP_CMN_MODULATION_TYPE phy;
-		uint32_t propmask;
 		uint32_t ratekbps;
 		uint32_t ratekbpssgi;
 		uint32_t ratekbpsdgi;
 		uint32_t ratekbpsqgi;
 		uint32_t ratekbpsdcm;
 		uint32_t userratekbps;
-		uint32_t dot11rate;
 		uint16_t ratecode;
 	} info[DP_RATE_TABLE_SIZE];
 } DP_CMN_RATE_TABLE;
@@ -3279,127 +3277,3 @@ int dp_rate_idx_to_kbps(uint8_t rate_idx, uint8_t gintval)
 }
 
 qdf_export_symbol(dp_rate_idx_to_kbps);
-
-/* dp_match_rate_to_nss - To determine mapping between rateindex and nss
- * @htflag - HT flags, for HT frames
- * @nss - NSS 1...8
- * @idx - index value
- *
- * return - 0 or 1 depending on success or failure
- */
-int dp_match_rate_to_nss(int htflag, int nss, int idx)
-{
-	int modemask = dp_11abgnratetable.info[idx].validmodemask;
-	int propmask = dp_11abgnratetable.info[idx].propmask;
-
-	if (htflag == 1) {
-		if (modemask == CCK_MODE_VALID_MASK ||
-		    modemask == OFDM_MODE_VALID_MASK)
-			return 0;
-	} else if (htflag == 2) {
-		if (modemask == HT20_MODE_VALID_MASK ||
-		    modemask == HT40_MODE_VALID_MASK) {
-			if (nss == 3 && propmask == RT_3SS_PROP)
-				return 0;
-			else if (nss == 2 && propmask == RT_2SS_PROP)
-				return 0;
-			else if (nss == 1 && propmask == RT_1SS_PROP)
-				return 0;
-		}
-	} else if (htflag == 3) {
-		if (modemask == VHT20_MODE_VALID_MASK ||
-		    modemask == VHT40_MODE_VALID_MASK ||
-		    modemask == VHT80_MODE_VALID_MASK) {
-			if (nss == 3 && propmask == RT_3SS_PROP)
-				return 0;
-			else if (nss == 2 && propmask == RT_2SS_PROP)
-				return 0;
-			else if (nss == 1 && propmask == RT_1SS_PROP)
-				return 0;
-		}
-	}
-
-	return 1;
-}
-
-/* dp_kbps_to_mcs - used to find mcs value from ratekbps
- * @kbps_rate - rate in kbps
- * @shortgi - short guard interval
- * @htflag - HT flags, for HT frames
- * @nss_val - NSS 1...8
- *
- * @return - mcs value
- */
-int dp_kbps_to_mcs(int kbps_rate, int shortgi, int htflag, int nss_val)
-{
-	int i;
-	int mcs_val1 = 1;
-	int mcs_val2 = 1;
-
-	if ((htflag < 0 || htflag > 3) ||
-	    (nss_val < 0 || nss_val > 3))
-		return QDF_STATUS_E_FAILURE;
-
-	if (shortgi == 0) {
-		for (i = 0 ; i < DP_RATE_TABLE_SIZE; i++) {
-			if (dp_11abgnratetable.info[i].ratekbps == kbps_rate) {
-				if (!htflag)
-					break;
-				if (!dp_match_rate_to_nss(htflag, nss_val, i))
-					break;
-			}
-		}
-		if (i == DP_RATE_TABLE_SIZE)
-			mcs_val1 = 0;
-		else
-			return dp_11abgnratetable.info[i].dot11rate;
-	} else {
-		for (i = 0 ; i < DP_RATE_TABLE_SIZE; i++) {
-			if (dp_11abgnratetable.info[i].ratekbpssgi ==
-					kbps_rate) {
-				if (!htflag)
-					break;
-				if (!dp_match_rate_to_nss(htflag, nss_val, i))
-					break;
-			}
-		}
-		if (i == DP_RATE_TABLE_SIZE)
-			mcs_val2 = 0;
-		else
-			return dp_11abgnratetable.info[i].dot11rate;
-	}
-
-	if (!mcs_val1) {
-		for (i = 0 ; i < DP_RATE_TABLE_SIZE; i++) {
-			if (dp_11abgnratetable.info[i].ratekbpssgi ==
-					kbps_rate) {
-				if (!htflag)
-					break;
-				if (!dp_match_rate_to_nss(htflag, nss_val, i))
-					break;
-			}
-		}
-		if (i == DP_RATE_TABLE_SIZE)
-			return QDF_STATUS_E_FAILURE;
-		else
-			return dp_11abgnratetable.info[i].dot11rate;
-	}
-
-	if (!mcs_val2) {
-		for (i = 0 ; i < DP_RATE_TABLE_SIZE; i++) {
-			if (dp_11abgnratetable.info[i].ratekbps == kbps_rate) {
-				if (!htflag)
-					break;
-				if (!dp_match_rate_to_nss(htflag, nss_val, i))
-					break;
-			}
-		}
-		if (i == DP_RATE_TABLE_SIZE)
-			return QDF_STATUS_E_FAILURE;
-		else
-			return dp_11abgnratetable.info[i].dot11rate;
-	}
-	return QDF_STATUS_E_FAILURE;
-}
-
-qdf_export_symbol(dp_kbps_to_mcs);

+ 0 - 19
dp/cmn_dp_api/dp_ratetable.h

@@ -94,24 +94,6 @@ static inline int dp_ath_rate_out(int _i)
 #define VHT_INVALID_BCC_RATE  0
 #define NUM_HT_SPATIAL_STREAM 4
 
-#define RATE_PROP_LDPC 0x00000010
-#define RATE_PROP_1NSS 0x00000001
-#define RATE_PROP_2NSS 0x00000002
-#define RATE_PROP_3NSS 0x00000004
-#define RATE_PROP_STBC 0x00000020
-#define RATE_PROP_TXBF 0x00000040
-
-/* We have advanced 11n capabilities and they are enabled based on the MCS rate.
- * Enable LDPC by default for all MCS rates.
- * Enable STBC for one spatial stream rates.
- * Enable TXBF for (0-15) MCS rates.
- */
-#define RT_1SS_PROP    (RATE_PROP_1NSS | RATE_PROP_LDPC | RATE_PROP_STBC | \
-			RATE_PROP_TXBF)
-#define RT_2SS_PROP    (RATE_PROP_2NSS | RATE_PROP_LDPC | RATE_PROP_TXBF)
-#define RT_3SS_PROP    (RATE_PROP_3NSS | RATE_PROP_LDPC | RATE_PROP_TXBF)
-#define RT_PROP_DIS    (0)
-
 #define NUM_HT_RIX_PER_BW (NUM_HT_MCS * NUM_HT_SPATIAL_STREAM)
 #define NUM_VHT_RIX_PER_BW (NUM_VHT_MCS * NUM_SPATIAL_STREAMS)
 #define NUM_HE_RIX_PER_BW (NUM_HE_MCS * NUM_SPATIAL_STREAMS)
@@ -187,5 +169,4 @@ dp_getrateindex(uint16_t mcs, uint8_t nss, uint8_t preamble, uint8_t bw);
 
 int dp_rate_idx_to_kbps(uint8_t rate_idx, uint8_t gintval);
 
-int dp_kbps_to_mcs(int kbps_rate, int shortgi, int htflag, int nss_val);
 #endif /*_DP_RATES_H_*/

+ 2 - 0
dp/inc/cdp_txrx_stats_struct.h

@@ -273,6 +273,7 @@ struct cdp_tx_stats {
  * @rx_wpimic: rx MIC check failed (WPI)
  * @rx_wepfail: rx wep processing failed
  * @rx_aggr: aggregation on rx
+ * @rx_discard: packets discard in rx
  */
 struct cdp_rx_stats {
 	struct cdp_pkt_info to_stack;
@@ -325,6 +326,7 @@ struct cdp_rx_stats {
 
 	/*add for peer updated for ppdu*/
 	uint32_t rx_aggr;
+	uint32_t rx_discard;
 };
 
 /* struct cdp_tx_ingress_stats - Tx ingress Stats

+ 43 - 2
dp/wifi3.0/dp_htt.c

@@ -29,6 +29,10 @@
 #include "qdf_mem.h"   /* qdf_mem_malloc,free */
 #include "cdp_txrx_cmn_struct.h"
 
+#ifdef FEATURE_PERPKT_INFO
+#include "dp_ratetable.h"
+#endif
+
 #define HTT_TLV_HDR_LEN HTT_T2H_EXT_STATS_CONF_TLV_HDR_SIZE
 
 #define HTT_HTC_PKT_POOL_INIT_SIZE 64
@@ -87,6 +91,38 @@ do {                                                             \
  * Return: None
  */
 #ifdef FEATURE_PERPKT_INFO
+static inline void
+dp_tx_rate_stats_update(struct dp_peer *peer,
+			struct cdp_tx_completion_ppdu_user *ppdu)
+{
+	uint32_t ratekbps = 0;
+	uint32_t ppdu_tx_rate = 0;
+
+	if (!peer || !ppdu)
+		return;
+
+	dp_peer_stats_notify(peer);
+
+	ratekbps = dp_getrateindex(ppdu->mcs,
+				   ppdu->nss,
+				   ppdu->preamble,
+				   ppdu->bw);
+
+	DP_STATS_UPD(peer, tx.last_tx_rate, ratekbps);
+
+	if (!ratekbps)
+		return;
+
+	dp_ath_rate_lpf(peer->stats.tx.avg_tx_rate, ratekbps);
+	ppdu_tx_rate = dp_ath_rate_out(peer->stats.tx.avg_tx_rate);
+	DP_STATS_UPD(peer, tx.rnd_avg_tx_rate, ppdu_tx_rate);
+
+	if (peer->vdev) {
+		peer->vdev->stats.tx.last_tx_rate = ratekbps;
+		peer->vdev->stats.tx.last_tx_rate_mcs = ppdu->mcs;
+	}
+}
+
 static void dp_tx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 		struct cdp_tx_completion_ppdu_user *ppdu, uint32_t ack_rssi)
 {
@@ -150,8 +186,13 @@ static void dp_tx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 	DP_STATS_INCC(peer,
 			tx.pkt_type[preamble].mcs_count[mcs], num_msdu,
 			((mcs < (MAX_MCS - 1)) && (preamble == DOT11_AX)));
-	dp_peer_stats_notify(peer);
-	DP_STATS_UPD(peer, tx.last_tx_rate, ppdu->tx_rate);
+
+	dp_tx_rate_stats_update(peer, ppdu);
+
+	if (peer->stats.tx.ucast.num)
+		peer->stats.tx.last_per = ((peer->stats.tx.ucast.num -
+					peer->stats.tx.tx_success.num) * 100) /
+					peer->stats.tx.ucast.num;
 
 	if (soc->cdp_soc.ol_ops->update_dp_stats) {
 		soc->cdp_soc.ol_ops->update_dp_stats(pdev->ctrl_pdev,

+ 38 - 0
dp/wifi3.0/dp_rx_mon_status.c

@@ -28,6 +28,10 @@
 #include "dp_internal.h"
 #include "qdf_mem.h"   /* qdf_mem_malloc,free */
 
+#ifdef FEATURE_PERPKT_INFO
+#include "dp_ratetable.h"
+#endif
+
 /**
 * dp_rx_populate_cdp_indication_ppdu() - Populate cdp rx indication structure
 * @pdev: pdev ctx
@@ -125,6 +129,38 @@ dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev,
  * Return: None
  */
 #ifdef FEATURE_PERPKT_INFO
+static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
+					   struct cdp_rx_indication_ppdu *ppdu)
+{
+	uint32_t ratekbps = 0;
+	uint32_t ppdu_rx_rate = 0;
+	uint32_t nss = 0;
+
+	if (!peer || !ppdu)
+		return;
+
+	if (ppdu->u.nss == 0)
+		nss = 0;
+	else
+		nss = ppdu->u.nss - 1;
+
+	ratekbps = dp_getrateindex(ppdu->u.mcs,
+				   nss,
+				   ppdu->u.preamble,
+				   ppdu->u.bw);
+
+	if (!ratekbps)
+		return;
+
+	DP_STATS_UPD(peer, rx.last_rx_rate, ratekbps);
+	dp_ath_rate_lpf(peer->stats.rx.avg_rx_rate, ratekbps);
+	ppdu_rx_rate = dp_ath_rate_out(peer->stats.rx.avg_rx_rate);
+	DP_STATS_UPD(peer, rx.rnd_avg_rx_rate, ppdu_rx_rate);
+
+	if (peer->vdev)
+		peer->vdev->stats.rx.last_rx_rate = ratekbps;
+}
+
 static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 		struct cdp_rx_indication_ppdu *ppdu)
 {
@@ -200,6 +236,8 @@ static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 	dp_peer_stats_notify(peer);
 	DP_STATS_UPD(peer, rx.last_rssi, ppdu->rssi);
 
+	dp_rx_rate_stats_update(peer, ppdu);
+
 	if (soc->cdp_soc.ol_ops->update_dp_stats) {
 		soc->cdp_soc.ol_ops->update_dp_stats(pdev->ctrl_pdev,
 				&peer->stats, ppdu->peer_id,