Browse Source

qcacmn: Add implementation of peer cp stats

Add change to define peer cp stats structure
and provide APIs to set/get peer cp stats fields
to/from within cp stats component

Change-Id: I2d1a8d166a3e0ce5992eb670c83f6f5d37441dd1
CRs-Fixed: 2236328
Naga 7 years ago
parent
commit
d8351b4740

+ 48 - 0
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_defs.h

@@ -98,10 +98,58 @@ struct vdev_ic_cp_stats {
  * as interface structure with user space application
  * make sure to align this structure with ieee80211_nodestats always
  *
+ *  @cs_rx_mgmt_rssi: rx mgmt rssi
  *  @cs_rx_mgmt: rx mgmt
+ *  @cs_rx_noprivacy: rx no privacy
+ *  @cs_rx_wepfail: rx wep failures
+ *  @cs_rx_ccmpmic: rx ccmp mic failures
+ *  @cs_rx_wpimic: rx wpi mic failures
+ *  @cs_rx_tkipicv: rx tkip icv
+ *  @cs_tx_mgmt: tx mgmt
+ *  @cs_is_tx_not_ok: tx failures
+ *  @cs_ps_discard: ps discard
+ *  @cs_rx_mgmt_rate: rx mgmt rate
+ *  @cs_tx_bytes_rate: tx rate
+ *  @cs_tx_data_rate: tx data rate
+ *  @cs_rx_bytes_rate: rx rate
+ *  @cs_rx_data_rate: rx data rate
+ *  @cs_tx_bytes_success_last: tx success count in last 1 sec
+ *  @cs_tx_data_success_last: tx data success count in last 1 sec
+ *  @cs_rx_bytes_last: rx rate
+ *  @cs_rx_data_last: rx data rate
+ *  @cs_psq_drops: psq drops
+ *  @cs_tx_dropblock: tx dropblock
+ *  @cs_tx_assoc: tx assoc success
+ *  @cs_tx_assoc_fail: tx assoc failure
  */
 struct peer_ic_cp_stats {
+	int8_t   cs_rx_mgmt_rssi;
 	uint32_t cs_rx_mgmt;
+	uint32_t cs_rx_noprivacy;
+	uint32_t cs_rx_wepfail;
+	uint32_t cs_rx_ccmpmic;
+	uint32_t cs_rx_wpimic;
+	uint32_t cs_rx_tkipicv;
+	uint32_t cs_tx_mgmt;
+	uint32_t cs_is_tx_not_ok;
+	uint32_t cs_ps_discard;
+	uint32_t cs_rx_mgmt_rate;
+#ifdef WLAN_ATH_SUPPORT_EXT_STAT
+	uint32_t cs_tx_bytes_rate;
+	uint32_t cs_tx_data_rate;
+	uint32_t cs_rx_bytes_rate;
+	uint32_t cs_rx_data_rate;
+	uint32_t cs_tx_bytes_success_last;
+	uint32_t cs_tx_data_success_last;
+	uint32_t cs_rx_bytes_last;
+	uint32_t cs_rx_data_last;
+#endif
+	uint32_t cs_psq_drops;
+#ifdef ATH_SUPPORT_IQUE
+	uint32_t cs_tx_dropblock;
+#endif
+	uint32_t cs_tx_assoc;
+	uint32_t cs_tx_assoc_fail;
 };
 
 #endif /* QCA_SUPPORT_CP_STATS */

+ 141 - 0
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_api.h

@@ -29,5 +29,146 @@
 #include <wlan_cp_stats_ic_defs.h>
 #include "../../core/src/wlan_cp_stats_defs.h"
 
+#define UCFG_PEER_CP_STATS_SET_FUNCS(field) \
+	static inline void \
+	ucfg_peer_cp_stats_##field##_inc(struct wlan_objmgr_peer *_peer, \
+					 uint32_t _val) \
+	{ \
+		struct peer_cp_stats *_peer_cs = \
+			wlan_cp_stats_get_peer_stats_obj(_peer); \
+		if (_peer_cs) { \
+			struct peer_ic_cp_stats *_peer_ics = \
+						_peer_cs->peer_stats; \
+			if (_peer_ics) { \
+				_peer_ics->cs_##field += _val;\
+			} \
+		} \
+	} \
+	static inline void \
+	ucfg_peer_cp_stats_##field##_dec(struct wlan_objmgr_peer *_peer, \
+					 uint32_t _val) \
+	{ \
+		struct peer_cp_stats *_peer_cs = \
+			wlan_cp_stats_get_peer_stats_obj(_peer); \
+		if (_peer_cs) { \
+			struct peer_ic_cp_stats *_peer_ics = \
+						_peer_cs->peer_stats; \
+			if (_peer_ics) { \
+				_peer_ics->cs_##field -= _val;\
+			} \
+		} \
+	} \
+	static inline void \
+	ucfg_peer_cp_stats_##field##_update(struct wlan_objmgr_peer *_peer, \
+					    uint32_t _val) \
+	{ \
+		struct peer_cp_stats *_peer_cs = \
+				wlan_cp_stats_get_peer_stats_obj(_peer); \
+		if (_peer_cs) { \
+			struct peer_ic_cp_stats *_peer_ics = \
+							_peer_cs->peer_stats; \
+			if (_peer_ics) { \
+				_peer_ics->cs_##field = _val;\
+			} \
+		} \
+	}
+
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_mgmt);
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_mgmt);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_mgmt_rate);
+UCFG_PEER_CP_STATS_SET_FUNCS(is_tx_not_ok);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_noprivacy);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_wepfail);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_tkipicv);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_wpimic);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_ccmpmic);
+UCFG_PEER_CP_STATS_SET_FUNCS(ps_discard);
+UCFG_PEER_CP_STATS_SET_FUNCS(psq_drops);
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_assoc);
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_assoc_fail);
+#ifdef ATH_SUPPORT_IQUE
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_dropblock);
+#endif
+#ifdef WLAN_ATH_SUPPORT_EXT_STAT
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_bytes_rate);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_bytes_rate);
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_data_rate);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_data_rate);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_bytes_last);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_data_last);
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_bytes_success_last);
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_data_success_last);
+#endif
+
+static inline
+void ucfg_peer_cp_stats_rx_mgmt_rssi_update(struct wlan_objmgr_peer *peer,
+					    int8_t rssi)
+{
+	struct peer_cp_stats *peer_cs;
+	struct peer_ic_cp_stats *peer_cps;
+
+	if (!peer)
+		return;
+
+	peer_cs = wlan_cp_stats_get_peer_stats_obj(peer);
+	if (!peer_cs)
+		return;
+
+	peer_cps = peer_cs->peer_stats;
+	if (peer_cps)
+		peer_cps->cs_rx_mgmt_rssi = rssi;
+}
+
+static inline
+int8_t ucfg_peer_cp_stats_rx_mgmt_rssi_get(struct wlan_objmgr_peer *peer)
+{
+	struct peer_cp_stats *peer_cs;
+	struct peer_ic_cp_stats *peer_cps;
+	int8_t val = -1;
+
+	if (!peer)
+		return val;
+
+	peer_cs = wlan_cp_stats_get_peer_stats_obj(peer);
+	if (!peer_cs)
+		return val;
+
+	peer_cps = peer_cs->peer_stats;
+	if (peer_cps)
+		val = peer_cps->cs_rx_mgmt_rssi;
+
+	return val;
+}
+
+#define UCFG_PEER_CP_STATS_GET_FUNCS(field) \
+	static inline uint32_t \
+	ucfg_peer_cp_stats_##field##_get(struct wlan_objmgr_peer *_peer) \
+	{ \
+		struct peer_cp_stats *_peer_cs = \
+				wlan_cp_stats_get_peer_stats_obj(_peer); \
+		struct peer_ic_cp_stats *_peer_ics; \
+		if (_peer_cs) { \
+			_peer_ics = _peer_cs->peer_stats; \
+			if (_peer_ics) \
+				return  _peer_ics->cs_##field; \
+		} \
+		return 0; \
+	}
+
+UCFG_PEER_CP_STATS_GET_FUNCS(rx_mgmt_rate);
+#ifdef ATH_SUPPORT_IQUE
+UCFG_PEER_CP_STATS_GET_FUNCS(tx_dropblock);
+#endif
+
+/**
+ * wlan_ucfg_get_peer_cp_stats() - ucfg API to get peer cp stats
+ * @peer_obj: pointer to peer object
+ * @peer_cps: pointer to peer cp stats object to populate
+ *
+ * Return: QDF_STATUS - Success or Failure
+ */
+QDF_STATUS wlan_ucfg_get_peer_cp_stats(struct wlan_objmgr_peer *peer,
+				       struct peer_ic_cp_stats *peer_cps);
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_IC_UCFG_API_H__ */

+ 72 - 0
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_utils_api.h

@@ -29,5 +29,77 @@
 #ifdef QCA_SUPPORT_CP_STATS
 #include "wlan_cp_stats_ic_ucfg_api.h"
 
+#define PEER_CP_STATS_SET_FUNCS(field) \
+	static inline void \
+	peer_cp_stats_##field##_inc(struct wlan_objmgr_peer *_peer, \
+				    uint64_t _val) \
+	{ \
+		ucfg_peer_cp_stats_##field##_inc(_peer, _val); \
+	} \
+	static inline void \
+	peer_cp_stats_##field##_dec(struct wlan_objmgr_peer *_peer, \
+				    uint64_t _val) \
+	{ \
+		ucfg_peer_cp_stats_##field##_inc(_peer, _val); \
+	} \
+	static inline void \
+	peer_cp_stats_##field##_update(struct wlan_objmgr_peer *_peer, \
+				       uint64_t _val) \
+	{ \
+		ucfg_peer_cp_stats_##field##_update(_peer, _val); \
+	}
+
+PEER_CP_STATS_SET_FUNCS(rx_mgmt);
+PEER_CP_STATS_SET_FUNCS(tx_mgmt);
+PEER_CP_STATS_SET_FUNCS(rx_mgmt_rate);
+PEER_CP_STATS_SET_FUNCS(is_tx_not_ok);
+PEER_CP_STATS_SET_FUNCS(rx_noprivacy);
+PEER_CP_STATS_SET_FUNCS(rx_wepfail);
+PEER_CP_STATS_SET_FUNCS(rx_tkipicv);
+PEER_CP_STATS_SET_FUNCS(rx_wpimic);
+PEER_CP_STATS_SET_FUNCS(rx_ccmpmic);
+PEER_CP_STATS_SET_FUNCS(ps_discard);
+PEER_CP_STATS_SET_FUNCS(psq_drops);
+PEER_CP_STATS_SET_FUNCS(tx_assoc);
+PEER_CP_STATS_SET_FUNCS(tx_assoc_fail);
+#ifdef ATH_SUPPORT_IQUE
+PEER_CP_STATS_SET_FUNCS(tx_dropblock);
+#endif
+#ifdef WLAN_ATH_SUPPORT_EXT_STAT
+PEER_CP_STATS_SET_FUNCS(tx_bytes_rate);
+PEER_CP_STATS_SET_FUNCS(rx_bytes_rate);
+PEER_CP_STATS_SET_FUNCS(tx_data_rate);
+PEER_CP_STATS_SET_FUNCS(rx_data_rate);
+PEER_CP_STATS_SET_FUNCS(rx_bytes_last);
+PEER_CP_STATS_SET_FUNCS(rx_data_last);
+PEER_CP_STATS_SET_FUNCS(tx_bytes_success_last);
+PEER_CP_STATS_SET_FUNCS(tx_data_success_last);
+#endif
+
+#define PEER_CP_STATS_GET_FUNCS(field) \
+	static inline uint64_t \
+	peer_cp_stats_##field##_get(struct wlan_objmgr_peer *_peer) \
+	{ \
+		return ucfg_peer_cp_stats_##field##_get(_peer); \
+	}
+
+PEER_CP_STATS_GET_FUNCS(rx_mgmt_rate);
+#ifdef ATH_SUPPORT_IQUE
+PEER_CP_STATS_GET_FUNCS(tx_dropblock);
+#endif
+
+static inline void
+peer_cp_stats_rx_mgmt_rssi_update(struct wlan_objmgr_peer *peer,
+				  int8_t rssi)
+{
+	ucfg_peer_cp_stats_rx_mgmt_rssi_update(peer, rssi);
+}
+
+static inline int8_t
+peer_cp_stats_rx_mgmt_rssi_get(struct wlan_objmgr_peer *peer)
+{
+	return ucfg_peer_cp_stats_rx_mgmt_rssi_get(peer);
+}
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_IC_UTILS_API_H__ */

+ 27 - 0
umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_api.c

@@ -88,3 +88,30 @@ QDF_STATUS wlan_cp_stats_peer_cs_deinit(struct peer_cp_stats *peer_cs)
 	peer_cs->peer_stats = NULL;
 	return QDF_STATUS_SUCCESS;
 }
+
+QDF_STATUS wlan_ucfg_get_peer_cp_stats(struct wlan_objmgr_peer *peer,
+				       struct peer_ic_cp_stats *peer_cps)
+{
+	struct peer_cp_stats *peer_cs;
+
+	if (!peer) {
+		cp_stats_err("Invalid input fields, peer obj is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!peer_cps) {
+		cp_stats_err("Invalid input fields, peer cp obj is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	peer_cs = wlan_cp_stats_get_peer_stats_obj(peer);
+	if (peer_cs && peer_cs->peer_stats) {
+		wlan_cp_stats_peer_obj_lock(peer_cs);
+		qdf_mem_copy(peer_cps, peer_cs->peer_stats,
+			     sizeof(struct peer_ic_cp_stats));
+		wlan_cp_stats_peer_obj_unlock(peer_cs);
+		return QDF_STATUS_SUCCESS;
+	}
+
+	return QDF_STATUS_E_FAILURE;
+}