Ver Fonte

qcacmn: Add changes for RDK statistics

Change API signature for dp_getrateindex to populate rate index
and add additional stats required for RDK.
Add QDF abstraction for EWMA average rssi

CRs-Fixed: 2397918
Change-Id: Id878971799c5df2ae60057a86b2769724ee0dcc5
Amir Patel há 6 anos atrás
pai
commit
78824b1d4e

+ 6 - 3
dp/cmn_dp_api/dp_ratetable.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019 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
@@ -3208,12 +3208,13 @@ enum DP_CMN_MODULATION_TYPE dp_getmodulation(
  * @nss - NSS 1...8
  * preamble - preamble
  * @bw - Transmission Bandwidth
+ * @rix: rate index to be populated
  *
  * return - rate in kbps
  */
 uint32_t
 dp_getrateindex(uint32_t gi, uint16_t mcs, uint8_t nss, uint8_t preamble,
-		uint8_t bw)
+		uint8_t bw, uint32_t *rix)
 {
 	uint32_t ratekbps = 0, res = RT_INVALID_INDEX; /* represents failure */
 	uint16_t rc;
@@ -3251,7 +3252,7 @@ dp_getrateindex(uint32_t gi, uint16_t mcs, uint8_t nss, uint8_t preamble,
 		break;
 	}
 	if (res >= DP_RATE_TABLE_SIZE)
-		return ratekbps;
+		goto done;
 
 	if (!gi) {
 		ratekbps = dp_11abgnratetable.info[res].userratekbps;
@@ -3268,6 +3269,8 @@ dp_getrateindex(uint32_t gi, uint16_t mcs, uint8_t nss, uint8_t preamble,
 			break;
 		}
 	}
+done:
+	*rix = res;
 
 	return ratekbps;
 }

+ 2 - 2
dp/cmn_dp_api/dp_ratetable.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019 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
@@ -166,7 +166,7 @@ enum DP_CMN_MODULATION_TYPE dp_getmodulation(
 
 uint32_t
 dp_getrateindex(uint32_t gi, uint16_t mcs, uint8_t nss, uint8_t preamble,
-		uint8_t bw);
+		uint8_t bw, uint32_t *rix);
 
 int dp_rate_idx_to_kbps(uint8_t rate_idx, uint8_t gintval);
 

+ 29 - 0
dp/inc/cdp_txrx_cmn_struct.h

@@ -38,6 +38,7 @@
 #include <cdp_txrx_mob_def.h>
 #endif /* CONFIG_WIN */
 #include <cdp_txrx_handle.h>
+#include <cdp_txrx_stats_struct.h>
 
 #ifndef OL_TXRX_NUM_LOCAL_PEER_IDS
 /*
@@ -143,6 +144,7 @@
 #define FILTER_DATA_NULL		0x0008
 
 QDF_DECLARE_EWMA(tx_lag, 1024, 8)
+struct cdp_stats_cookie;
 
 /*
  * DP configuration parameters
@@ -1067,12 +1069,14 @@ enum cdp_stat_update_type {
  * @avg_sojourn_msdu: average sojourn msdu time
  * @sum_sojourn_msdu: sum sojourn msdu time
  * @num_msdu: number of msdus per ppdu
+ * @cookie: cookie to be used by upper layer
  */
 struct cdp_tx_sojourn_stats {
 	uint32_t ppdu_seq_id;
 	qdf_ewma_tx_lag avg_sojourn_msdu[CDP_DATA_TID_MAX];
 	uint32_t sum_sojourn_msdu[CDP_DATA_TID_MAX];
 	uint32_t num_msdus[CDP_DATA_TID_MAX];
+	struct cdp_stats_cookie *cookie;
 };
 
 /**
@@ -1119,6 +1123,8 @@ struct cdp_tx_sojourn_stats {
  * @tx_rate: Transmission Rate
  * @user_pos: user position
  * @mu_group_id: mu group id
+ * @rix: rate index
+ * @cookie: cookie to used by upper layer
  */
 struct cdp_tx_completion_ppdu_user {
 	uint32_t completion_status:8,
@@ -1173,6 +1179,8 @@ struct cdp_tx_completion_ppdu_user {
 	bool ack_rssi_valid;
 	uint32_t user_pos;
 	uint32_t mu_group_id;
+	uint32_t rix;
+	struct cdp_stats_cookie *cookie;
 };
 
 /**
@@ -1331,6 +1339,9 @@ struct cdp_tx_completion_msdu {
  * @channel: Channel informartion
  * @lsig_A: L-SIG in 802.11 PHY header
  * @frame_ctrl: frame control field
+ * @rix: rate index
+ * @rssi_chain: rssi chain per nss per bw
+ * @cookie: cookie to used by upper layer
  */
 struct cdp_rx_indication_ppdu {
 	uint32_t ppdu_id;
@@ -1338,6 +1349,7 @@ struct cdp_rx_indication_ppdu {
 		 num_mpdu:9,
 		 reserved:6;
 	uint32_t num_msdu;
+	uint32_t num_bytes;
 	uint16_t udp_msdu_count;
 	uint16_t tcp_msdu_count;
 	uint16_t other_msdu_count;
@@ -1363,6 +1375,7 @@ struct cdp_rx_indication_ppdu {
 				 ppdu_type:5;
 		};
 	} u;
+	uint32_t rix;
 	uint32_t lsig_a;
 	uint32_t rssi;
 	uint64_t timestamp;
@@ -1378,6 +1391,8 @@ struct cdp_rx_indication_ppdu {
 	uint8_t rx_ratecode;
 	uint8_t fcs_error_mpdus;
 	uint16_t frame_ctrl;
+	uint32_t rssi_chain[SS_COUNT][MAX_BW];
+	struct cdp_stats_cookie *cookie;
 };
 
 /**
@@ -1491,4 +1506,18 @@ enum cdp_dp_cfg {
 	cfg_dp_ce_classify_enable,
 	cfg_dp_disable_intra_bss_fwd,
 };
+
+/**
+ * struct cdp_peer_cookie - cookie used when creating peer
+ * @peer_id: peer id
+ * @mac_addr: MAC address of peer
+ * @cookie: cookie to be used by consumer
+ * @ctx: context passed to be used by consumer
+ */
+struct cdp_peer_cookie {
+	uint8_t peer_id;
+	uint8_t mac_addr[CDP_MAC_ADDR_LEN];
+	uint8_t cookie;
+	struct cdp_stats_cookie *ctx;
+};
 #endif

+ 2 - 0
dp/inc/cdp_txrx_stats_struct.h

@@ -360,6 +360,7 @@ struct cdp_tx_stats {
  * @bar_recv_cnt: Number of bar received
  * @rssi: RSSI of received signal
  * @last_rssi: Previous rssi
+ * @avg_rssi: Average rssi
  * @rx_rate: Rx rate
  * @last_rx_rate: Previous rx rate
  * @rnd_avg_rx_rate: Rounded average rx rate
@@ -417,6 +418,7 @@ struct cdp_rx_stats {
 	uint32_t bar_recv_cnt;
 	uint32_t rssi;
 	uint32_t last_rssi;
+	uint32_t avg_rssi;
 	uint32_t rx_rate;
 	uint32_t last_rx_rate;
 	uint32_t rnd_avg_rx_rate;

+ 3 - 1
dp/wifi3.0/dp_htt.c

@@ -130,6 +130,7 @@ dp_tx_rate_stats_update(struct dp_peer *peer,
 {
 	uint32_t ratekbps = 0;
 	uint32_t ppdu_tx_rate = 0;
+	uint32_t rix;
 
 	if (!peer || !ppdu)
 		return;
@@ -139,7 +140,8 @@ dp_tx_rate_stats_update(struct dp_peer *peer,
 				   ppdu->mcs,
 				   ppdu->nss,
 				   ppdu->preamble,
-				   ppdu->bw);
+				   ppdu->bw,
+				   &rix);
 
 	DP_STATS_UPD(peer, tx.last_tx_rate, ratekbps);
 

+ 3 - 1
dp/wifi3.0/dp_rx_mon_status.c

@@ -137,6 +137,7 @@ static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
 	uint32_t ratekbps = 0;
 	uint32_t ppdu_rx_rate = 0;
 	uint32_t nss = 0;
+	uint32_t rix;
 
 	if (!peer || !ppdu)
 		return;
@@ -150,7 +151,8 @@ static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
 				   ppdu->u.mcs,
 				   nss,
 				   ppdu->u.preamble,
-				   ppdu->u.bw);
+				   ppdu->u.bw,
+				   &rix);
 
 	if (!ratekbps)
 		return;

+ 10 - 0
qdf/inc/qdf_util.h

@@ -122,6 +122,16 @@ typedef __qdf_wait_queue_head_t qdf_wait_queue_head_t;
 #define qdf_ewma_tx_lag_read(tx_lag) \
 	 __qdf_ewma_tx_lag_read(tx_lag)
 
+#define qdf_ewma_rx_rssi __qdf_ewma_rx_rssi
+
+#define qdf_ewma_rx_rssi_init(rx_rssi) \
+	__qdf_ewma_rx_rssi_init(rx_rssi)
+
+#define qdf_ewma_rx_rssi_add(rx_rssi, value) \
+	__qdf_ewma_rx_rssi_add(rx_rssi, value)
+
+#define qdf_ewma_rx_rssi_read(rx_rssi) \
+	__qdf_ewma_rx_rssi_read(rx_rssi)
 /**
  * qdf_set_bit() - set bit in address
  * @nr: bit number to be set

+ 15 - 0
qdf/linux/src/i_qdf_util.h

@@ -172,11 +172,13 @@ static inline bool __qdf_is_macaddr_equal(struct qdf_mac_addr *mac_addr1,
 #define __QDF_DECLARE_EWMA(name, _factor, _weight)
 
 #define __qdf_ewma_tx_lag int
+#define __qdf_ewma_rx_rssi int
 #else
 #define __QDF_DECLARE_EWMA(name, _factor, _weight) \
 	DECLARE_EWMA(name, _factor, _weight)
 
 #define __qdf_ewma_tx_lag struct ewma_tx_lag
+#define __qdf_ewma_rx_rssi struct ewma_rx_rssi
 #endif
 
 #define __qdf_ffz(mask) (~(mask) == 0 ? -1 : ffz(mask))
@@ -253,6 +255,10 @@ static inline bool __qdf_is_macaddr_equal(struct qdf_mac_addr *mac_addr1,
 #define  __qdf_ewma_tx_lag_init(tx_lag)
 #define  __qdf_ewma_tx_lag_add(tx_lag, value)
 #define  __qdf_ewma_tx_lag_read(tx_lag)
+
+#define  __qdf_ewma_rx_rssi_init(rx_rssi)
+#define  __qdf_ewma_rx_rssi_add(rx_rssi, value)
+#define  __qdf_ewma_rx_rssi_read(rx_rssi)
 #else
 #define  __qdf_ewma_tx_lag_init(tx_lag) \
 	ewma_tx_lag_init(tx_lag)
@@ -262,6 +268,15 @@ static inline bool __qdf_is_macaddr_equal(struct qdf_mac_addr *mac_addr1,
 
 #define  __qdf_ewma_tx_lag_read(tx_lag) \
 	ewma_tx_lag_read(tx_lag)
+
+#define  __qdf_ewma_rx_rssi_init(rx_rssi) \
+	ewma_rx_rssi_init(rx_rssi)
+
+#define  __qdf_ewma_rx_rssi_add(rx_rssi, value) \
+	ewma_rx_rssi_add(rx_rssi, value)
+
+#define  __qdf_ewma_rx_rssi_read(rx_rssi) \
+	ewma_rx_rssi_read(rx_rssi)
 #endif
 
 #ifdef QCA_CONFIG_SMP