Browse Source

qcacmn: Support channel utilization stats

Provide support for following channel utilization stats:
self_bss_util,obss_util,ap_rx_util,free_medium,
ap_tx_util,obss_rx_util,non_wifi_util

Change-Id: Ib1358988ae0b5794e70ba4348a78646e9d2a6cba
CRs-Fixed: 2298865
Debasis Das 6 years ago
parent
commit
72521f8c0a

+ 10 - 0
dp/inc/cdp_txrx_stats_struct.h

@@ -1086,6 +1086,11 @@ struct ol_ath_radiostats {
 	uint8_t     ap_stats_tx_cal_enable;
 	uint8_t     self_bss_util;
 	uint8_t     obss_util;
+	uint8_t     ap_rx_util;
+	uint8_t     free_medium;
+	uint8_t     ap_tx_util;
+	uint8_t     obss_rx_util;
+	uint8_t     non_wifi_util;
 	uint32_t    tgt_asserts;
 	int16_t     chan_nf;
 	int16_t     chan_nf_sec80;
@@ -1419,6 +1424,11 @@ enum _ol_ath_param_t {
 	OL_ATH_PARAM_CBS_CSA = 386,
 	OL_ATH_PARAM_TWICE_ANTENNA_GAIN = 387,
 	OL_ATH_PARAM_ACTIVITY_FACTOR = 388,
+	OL_ATH_PARAM_CHAN_AP_RX_UTIL = 389,
+	OL_ATH_PARAM_CHAN_FREE  = 390,
+	OL_ATH_PARAM_CHAN_AP_TX_UTIL = 391,
+	OL_ATH_PARAM_CHAN_OBSS_RX_UTIL = 392,
+	OL_ATH_PARAM_CHAN_NON_WIFI = 393,
 };
 
 /* Enumeration of PDEV Configuration parameter */

+ 15 - 19
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_dcs_defs.h

@@ -29,36 +29,32 @@
 
 /**
  * struct pdev_dcs_chan_stats - DCS statistics
- * @dcs_cck_phyerr: channel noise floor
- * @dcs_total_chan_util: total channel utilization
- * @dcs_tx_chan_util: tx channel utilization
- * @dcs_rx_chan_util: rx channel utilization
- * @dcs_self_bss_util: self BSS util
- * @dcs_other_bss_util: other BSS util
- * @dcs_wasted_chan_util: wasted chan util
- * @dcs_unused_chan_util: unused chan util
+ * @dcs_total_util: total channel utilization percentage
+ * @dcs_ap_tx_util: tx channel utilization percentage
+ * @dcs_ap_rx_util: rx channel utilization percentage
+ * @dcs_self_bss_util: self BSS utilization percentage
+ * @dcs_obss_util: other BSS utilization percentage
+ * @dcs_obss_rx_util: total Rx channel utilization percentage
+ * @dcs_free_medium: free medium percentage
+ * @dcs_non_wifi_util: non wifi utilization percentage
  * @dcs_ss_under_util: spatial stream under util
  * @dcs_sec_20_util: secondary 20MHz util
  * @dcs_sec_40_util: secondary 40Mhz util
  * @dcs_sec_80_util: secondary 80MHz util
- * @dcs_ofdm_phyerr: tx ofdm errors
- * @dcs_cck_phyerr: tx cck errors
  */
 struct pdev_dcs_chan_stats {
-	uint32_t dcs_chan_nf;
-	uint32_t dcs_total_chan_util;
-	uint32_t dcs_tx_chan_util;
-	uint32_t dcs_rx_chan_util;
+	uint32_t dcs_total_util;
+	uint32_t dcs_ap_tx_util;
+	uint32_t dcs_ap_rx_util;
 	uint32_t dcs_self_bss_util;
-	uint32_t dcs_other_bss_util;
-	uint32_t dcs_wasted_chan_util;
-	uint32_t dcs_unused_chan_util;
+	uint32_t dcs_obss_util;
+	uint32_t dcs_obss_rx_util;
+	uint32_t dcs_free_medium;
+	uint32_t dcs_non_wifi_util;
 	uint32_t dcs_ss_under_util;
 	uint32_t dcs_sec_20_util;
 	uint32_t dcs_sec_40_util;
 	uint32_t dcs_sec_80_util;
-	uint32_t dcs_ofdm_phyerr;
-	uint32_t dcs_cck_phyerr;
 };
 
 #endif /* QCA_SUPPORT_CP_STATS */

+ 2 - 2
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_defs.h

@@ -27,6 +27,7 @@
 
 #ifdef QCA_SUPPORT_CP_STATS
 
+#include <wlan_cp_stats_ic_dcs_defs.h>
 /**
  * struct pdev_rx_rssi - rx rssi information
  *
@@ -121,8 +122,6 @@ struct pdev_80211_stats {
 	uint32_t cs_rx_looplimit_start;
 	uint32_t cs_rx_looplimit_end;
 	uint8_t  cs_ap_stats_tx_cal_enable;
-	uint8_t  cs_self_bss_util;
-	uint8_t  cs_obss_util;
 	uint32_t cs_tgt_asserts;
 	int16_t  cs_chan_nf;
 	int16_t  cs_chan_nf_sec80;
@@ -142,6 +141,7 @@ struct pdev_80211_stats {
 
 	/* at places of copying required for scn-stats, copy till here only */
 	struct pdev_hw_stats hw_stats;
+	struct pdev_dcs_chan_stats chan_stats;
 };
 
 /**

+ 74 - 2
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_api.h

@@ -112,8 +112,6 @@ UCFG_PDEV_CP_STATS_SET_FUNCS(rx_clear_count);
 UCFG_PDEV_CP_STATS_SET_FUNCS(cycle_count);
 UCFG_PDEV_CP_STATS_SET_FUNCS(phy_err_count);
 UCFG_PDEV_CP_STATS_SET_FUNCS(chan_tx_pwr);
-UCFG_PDEV_CP_STATS_SET_FUNCS(self_bss_util);
-UCFG_PDEV_CP_STATS_SET_FUNCS(obss_util);
 
 #define UCFG_PDEV_CP_STATS_GET_FUNCS(field) \
 	static inline uint64_t \
@@ -139,6 +137,80 @@ UCFG_PDEV_CP_STATS_GET_FUNCS(wmi_tx_mgmt_completion_err);
 UCFG_PDEV_CP_STATS_GET_FUNCS(tgt_asserts);
 UCFG_PDEV_CP_STATS_GET_FUNCS(rx_phy_err);
 
+#define UCFG_PDEV_CHAN_STATS_SET_FUNCS(field) \
+	static inline void \
+	ucfg_pdev_chan_stats_##field##_inc(struct wlan_objmgr_pdev *_pdev, \
+					 uint64_t _val) \
+	{ \
+		struct pdev_cp_stats *_pdev_cs = \
+			wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+		if (_pdev_cs) { \
+			struct pdev_ic_cp_stats *_pdev_ic = \
+						_pdev_cs->pdev_stats; \
+			if (_pdev_ic) { \
+				_pdev_ic->stats.chan_stats.dcs_##field += _val;\
+			} \
+		} \
+	} \
+	static inline void \
+	ucfg_pdev_chan_stats_##field##_dec(struct wlan_objmgr_pdev *_pdev, \
+					 uint64_t _val) \
+	{ \
+		struct pdev_cp_stats *_pdev_cs = \
+			wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+		if (_pdev_cs) { \
+			struct pdev_ic_cp_stats *_pdev_ic = \
+						_pdev_cs->pdev_stats; \
+			if (_pdev_ic) { \
+				_pdev_ic->stats.chan_stats.dcs_##field -= _val;\
+			} \
+		} \
+	} \
+	static inline void \
+	ucfg_pdev_chan_stats_##field##_update(struct wlan_objmgr_pdev *_pdev, \
+					    uint64_t _val) \
+	{ \
+		struct pdev_cp_stats *_pdev_cs = \
+				wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+		if (_pdev_cs) { \
+			struct pdev_ic_cp_stats *_pdev_ic = \
+						_pdev_cs->pdev_stats; \
+			if (_pdev_ic) { \
+				_pdev_ic->stats.chan_stats.dcs_##field = _val;\
+			} \
+		} \
+	}
+
+UCFG_PDEV_CHAN_STATS_SET_FUNCS(self_bss_util);
+UCFG_PDEV_CHAN_STATS_SET_FUNCS(obss_util);
+UCFG_PDEV_CHAN_STATS_SET_FUNCS(obss_rx_util);
+UCFG_PDEV_CHAN_STATS_SET_FUNCS(ap_rx_util);
+UCFG_PDEV_CHAN_STATS_SET_FUNCS(ap_tx_util);
+UCFG_PDEV_CHAN_STATS_SET_FUNCS(free_medium);
+UCFG_PDEV_CHAN_STATS_SET_FUNCS(non_wifi_util);
+
+#define UCFG_PDEV_CHAN_STATS_GET_FUNCS(field) \
+	static inline uint8_t \
+	ucfg_pdev_chan_stats_##field##_get(struct wlan_objmgr_pdev *_pdev) \
+	{ \
+		struct pdev_cp_stats *_pdev_cs = \
+				wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+		struct pdev_ic_cp_stats *_pdev_ic; \
+		if (_pdev_cs) { \
+			_pdev_ic = _pdev_cs->pdev_stats; \
+			if (_pdev_ic) \
+				return _pdev_ic->stats.chan_stats.dcs_##field; \
+		} \
+		return 0; \
+	}
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(self_bss_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(obss_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(obss_rx_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(ap_rx_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(ap_tx_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(free_medium);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(non_wifi_util);
+
 static inline void ucfg_pdev_cp_stats_reset(struct wlan_objmgr_pdev *_pdev)
 {
 	struct pdev_cp_stats *pdev_cps = NULL;

+ 43 - 2
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_utils_api.h

@@ -325,8 +325,49 @@ PDEV_CP_STATS_SET_FUNCS(rx_clear_count);
 PDEV_CP_STATS_SET_FUNCS(cycle_count);
 PDEV_CP_STATS_SET_FUNCS(phy_err_count);
 PDEV_CP_STATS_SET_FUNCS(chan_tx_pwr);
-PDEV_CP_STATS_SET_FUNCS(self_bss_util);
-PDEV_CP_STATS_SET_FUNCS(obss_util);
+
+#define PDEV_CHAN_STATS_SET_FUNCS(field) \
+	static inline void \
+	pdev_chan_stats_##field##_inc(struct wlan_objmgr_pdev *_pdev, \
+				      uint8_t _val) \
+	{ \
+		ucfg_pdev_chan_stats_##field##_inc(_pdev, _val); \
+	} \
+	static inline void \
+	pdev_chan_stats_##field##_dec(struct wlan_objmgr_pdev *_pdev, \
+				      uint8_t _val) \
+	{ \
+		ucfg_pdev_chan_stats_##field##_dec(_pdev, _val); \
+	} \
+	static inline void \
+	pdev_chan_stats_##field##_update(struct wlan_objmgr_pdev *_pdev, \
+					 uint8_t _val) \
+	{ \
+		ucfg_pdev_chan_stats_##field##_update(_pdev, _val); \
+	}
+
+PDEV_CHAN_STATS_SET_FUNCS(self_bss_util);
+PDEV_CHAN_STATS_SET_FUNCS(obss_util);
+PDEV_CHAN_STATS_SET_FUNCS(obss_rx_util);
+PDEV_CHAN_STATS_SET_FUNCS(ap_rx_util);
+PDEV_CHAN_STATS_SET_FUNCS(ap_tx_util);
+PDEV_CHAN_STATS_SET_FUNCS(free_medium);
+PDEV_CHAN_STATS_SET_FUNCS(non_wifi_util);
+
+#define PDEV_CHAN_STATS_GET_FUNCS(field) \
+	static inline uint8_t \
+	pdev_chan_stats_##field##_get(struct wlan_objmgr_pdev *_pdev) \
+	{ \
+		return ucfg_pdev_chan_stats_##field##_get(_pdev); \
+	}
+
+PDEV_CHAN_STATS_GET_FUNCS(self_bss_util);
+PDEV_CHAN_STATS_GET_FUNCS(obss_util);
+PDEV_CHAN_STATS_GET_FUNCS(obss_rx_util);
+PDEV_CHAN_STATS_GET_FUNCS(ap_rx_util);
+PDEV_CHAN_STATS_GET_FUNCS(ap_tx_util);
+PDEV_CHAN_STATS_GET_FUNCS(free_medium);
+PDEV_CHAN_STATS_GET_FUNCS(non_wifi_util);
 
 #define PDEV_CP_STATS_GET_FUNCS(field) \
 	static inline uint64_t \