Browse Source

qcacmn: Add implementation of vdev ucast and mcast cp stats

Add change to define vdev ucast and mcast cp stats
structure and provide APIs of set/get cp stats fields
to/from within cp stats component

Change-Id: I341ca6188c052438e1fea4f9326428b59a1db660
CRs-Fixed: 2236328
Naga 7 years ago
parent
commit
6a72f69904

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

@@ -73,9 +73,37 @@ struct vdev_80211_stats {
  * used as interface structure with user space application
  * make sure to align this structure with ieee80211_mac_stats
  *
+ * @cs_rx_badkeyid: rx bad keyid
+ * @cs_rx_decryptok: rx decrypt success
+ * @cs_rx_wepfail: rx wep failures
+ * @cs_rx_tkipreplay: rx tkip replays
+ * @cs_rx_tkipformat: rx tkip format
+ * @cs_rx_tkipicv: rx tkip icv
+ * @cs_rx_ccmpreplay: rx ccmp replay
+ * @cs_rx_ccmpformat: rx ccmp format
+ * @cs_rx_ccmpmic: rx ccmp mic failures
+ * @cs_rx_wpireplay: rx wpi replay
+ * @cs_rx_wpimic: rx wpi mic failures
+ * @cs_rx_countermeasure: rx counter measures count
+ * @cs_retries: rx retries
+ * @cs_tx_mgmt: tx mgmt
  * @cs_rx_mgmt: rx mgmt
  */
 struct vdev_80211_mac_stats {
+	uint64_t cs_rx_badkeyid;
+	uint64_t cs_rx_decryptok;
+	uint64_t cs_rx_wepfail;
+	uint64_t cs_rx_tkipreplay;
+	uint64_t cs_rx_tkipformat;
+	uint64_t cs_rx_tkipicv;
+	uint64_t cs_rx_ccmpreplay;
+	uint64_t cs_rx_ccmpformat;
+	uint64_t cs_rx_ccmpmic;
+	uint64_t cs_rx_wpireplay;
+	uint64_t cs_rx_wpimic;
+	uint64_t cs_rx_countermeasure;
+	uint64_t cs_retries;
+	uint64_t cs_tx_mgmt;
 	uint64_t cs_rx_mgmt;
 };
 

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

@@ -29,6 +29,161 @@
 #include <wlan_cp_stats_ic_defs.h>
 #include "../../core/src/wlan_cp_stats_defs.h"
 
+#define UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(field) \
+	static inline void \
+	ucfg_vdev_ucast_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+					       uint64_t _val) \
+	{ \
+		struct vdev_cp_stats *_vdev_cs = \
+			wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+		if (_vdev_cs) { \
+			struct vdev_ic_cp_stats *_vdev_ics = \
+						_vdev_cs->vdev_stats; \
+			if (_vdev_ics) { \
+				_vdev_ics->ucast_stats.cs_##field += _val;\
+			} \
+		} \
+	} \
+	static inline void \
+	ucfg_vdev_ucast_cp_stats_##field##_dec(struct wlan_objmgr_vdev *_vdev, \
+					       uint64_t _val) \
+	{ \
+		struct vdev_cp_stats *_vdev_cs = \
+			wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+		if (_vdev_cs) { \
+			struct vdev_ic_cp_stats *_vdev_ics = \
+						_vdev_cs->vdev_stats; \
+			if (_vdev_ics) { \
+				_vdev_ics->ucast_stats.cs_##field -= _val;\
+			} \
+		} \
+	} \
+	static inline void ucfg_vdev_ucast_cp_stats_##field##_update( \
+			struct wlan_objmgr_vdev *_vdev, uint64_t _val) \
+	{ \
+		struct vdev_cp_stats *_vdev_cs = \
+			wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+		if (_vdev_cs) { \
+			struct vdev_ic_cp_stats *_vdev_ics = \
+						_vdev_cs->vdev_stats; \
+			if (_vdev_ics) { \
+				_vdev_ics->ucast_stats.cs_##field = _val;\
+			} \
+		} \
+	}
+
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_badkeyid);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_decryptok);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wepfail);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipicv);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipreplay);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipformat);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpmic);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpreplay);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpformat);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wpimic);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wpireplay);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_countermeasure);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_mgmt);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(tx_mgmt);
+
+#define UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(field) \
+	static inline uint64_t \
+	ucfg_vdev_ucast_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) \
+	{ \
+		struct vdev_cp_stats *_vdev_cs = \
+				wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+		struct vdev_ic_cp_stats *_vdev_ics; \
+		if (_vdev_cs) { \
+			_vdev_ics = _vdev_cs->vdev_stats; \
+			if (_vdev_ics) \
+				return  _vdev_ics->ucast_stats.cs_##field; \
+		} \
+			return 0; \
+	}
+
+UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(rx_decryptok);
+UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(rx_ccmpmic);
+UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(rx_ccmpreplay);
+UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(rx_wepfail);
+
+#define UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(field) \
+	static inline void \
+	ucfg_vdev_mcast_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+					       uint64_t _val) \
+	{ \
+		struct vdev_cp_stats *_vdev_cs = \
+			wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+		if (_vdev_cs) { \
+			struct vdev_ic_cp_stats *_vdev_ics = \
+						_vdev_cs->vdev_stats; \
+			if (_vdev_ics) { \
+				_vdev_ics->mcast_stats.cs_##field += _val;\
+			} \
+		} \
+	} \
+	static inline void \
+	ucfg_vdev_mcast_cp_stats_##field##_dec(struct wlan_objmgr_vdev *_vdev, \
+					       uint64_t _val) \
+	{ \
+		struct vdev_cp_stats *_vdev_cs = \
+			wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+		if (_vdev_cs) { \
+			struct vdev_ic_cp_stats *_vdev_ics = \
+						_vdev_cs->vdev_stats; \
+			if (_vdev_ics) { \
+				_vdev_ics->mcast_stats.cs_##field -= _val;\
+			} \
+		} \
+	} \
+	static inline void ucfg_vdev_mcast_cp_stats_##field##_update( \
+			struct wlan_objmgr_vdev *_vdev, uint64_t _val) { \
+		struct vdev_cp_stats *_vdev_cs = \
+			wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+		if (_vdev_cs) { \
+			struct vdev_ic_cp_stats *_vdev_ics = \
+						_vdev_cs->vdev_stats; \
+			if (_vdev_ics) { \
+				_vdev_ics->mcast_stats.cs_##field = _val;\
+			} \
+		} \
+	}
+
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_badkeyid);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_decryptok);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wepfail);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipicv);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipreplay);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipformat);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpmic);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpreplay);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpformat);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_countermeasure);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wpimic);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wpireplay);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(tx_mgmt);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_mgmt);
+
+#define UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(field) \
+	static inline uint64_t \
+	ucfg_vdev_mcast_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) \
+	{ \
+		struct vdev_cp_stats *_vdev_cs = \
+				wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+		struct vdev_ic_cp_stats *_vdev_ics; \
+		if (_vdev_cs) { \
+			_vdev_ics = _vdev_cs->vdev_stats; \
+			if (_vdev_ics) \
+				return _vdev_ics->mcast_stats.cs_##field; \
+		} \
+			return 0; \
+	}
+
+UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(rx_decryptok);
+UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(rx_ccmpmic);
+UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(rx_ccmpreplay);
+UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(rx_wepfail);
+
 #define UCFG_PEER_CP_STATS_SET_FUNCS(field) \
 	static inline void \
 	ucfg_peer_cp_stats_##field##_inc(struct wlan_objmgr_peer *_peer, \
@@ -170,5 +325,15 @@ UCFG_PEER_CP_STATS_GET_FUNCS(tx_dropblock);
 QDF_STATUS wlan_ucfg_get_peer_cp_stats(struct wlan_objmgr_peer *peer,
 				       struct peer_ic_cp_stats *peer_cps);
 
+/**
+ * wlan_ucfg_get_vdev_cp_stats() - ucfg API to get vdev cp stats
+ * @vdev_obj: pointer to vdev object
+ * @vdev_cps: pointer to vdev cp stats object to populate
+ *
+ * Return: QDF_STATUS - Success or Failure
+ */
+QDF_STATUS wlan_ucfg_get_vdev_cp_stats(struct wlan_objmgr_vdev *vdev,
+				       struct vdev_ic_cp_stats *vdev_cps);
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_IC_UCFG_API_H__ */

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

@@ -101,5 +101,86 @@ peer_cp_stats_rx_mgmt_rssi_get(struct wlan_objmgr_peer *peer)
 	return ucfg_peer_cp_stats_rx_mgmt_rssi_get(peer);
 }
 
+#define VDEV_UCAST_CP_STATS_SET_FUNCS(field) \
+	static inline void \
+	vdev_ucast_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+					  uint64_t _val) \
+	{ \
+		ucfg_vdev_ucast_cp_stats_##field##_inc(_vdev, _val); \
+	} \
+	static inline void \
+	vdev_ucast_cp_stats_##field##_update(struct wlan_objmgr_vdev *_vdev, \
+					     uint64_t _val) \
+	{ \
+		ucfg_vdev_ucast_cp_stats_##field##_update(_vdev, _val); \
+	}
+
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_badkeyid);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_decryptok);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wepfail);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipicv);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipreplay);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipformat);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpmic);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpreplay);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpformat);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wpimic);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wpireplay);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_countermeasure);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_mgmt);
+VDEV_UCAST_CP_STATS_SET_FUNCS(tx_mgmt);
+
+#define VDEV_MCAST_CP_STATS_SET_FUNCS(field) \
+	static inline void \
+	vdev_mcast_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+					  uint64_t _val) \
+	{ \
+		ucfg_vdev_mcast_cp_stats_##field##_inc(_vdev, _val); \
+	} \
+	static inline void \
+	vdev_mcast_cp_stats_##field##_update(struct wlan_objmgr_vdev *_vdev, \
+					     uint64_t _val) \
+	{ \
+		ucfg_vdev_mcast_cp_stats_##field##_update(_vdev, _val); \
+	}
+
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_badkeyid);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_decryptok);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wepfail);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipicv);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipreplay);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipformat);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpmic);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpreplay);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpformat);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wpimic);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wpireplay);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_countermeasure);
+VDEV_MCAST_CP_STATS_SET_FUNCS(tx_mgmt);
+
+#define VDEV_UCAST_CP_STATS_GET_FUNCS(field) \
+	static inline uint64_t \
+	vdev_ucast_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) \
+	{ \
+		return ucfg_vdev_ucast_cp_stats_##field##_get(_vdev); \
+	}
+
+VDEV_UCAST_CP_STATS_GET_FUNCS(rx_wepfail);
+VDEV_UCAST_CP_STATS_GET_FUNCS(rx_decryptok);
+VDEV_UCAST_CP_STATS_GET_FUNCS(rx_ccmpmic);
+VDEV_UCAST_CP_STATS_GET_FUNCS(rx_ccmpreplay);
+
+#define VDEV_MCAST_CP_STATS_GET_FUNCS(field) \
+	static inline uint64_t \
+	vdev_mcast_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) \
+	{ \
+		return ucfg_vdev_mcast_cp_stats_##field##_get(_vdev); \
+	}
+
+VDEV_MCAST_CP_STATS_GET_FUNCS(rx_wepfail);
+VDEV_MCAST_CP_STATS_GET_FUNCS(rx_decryptok);
+VDEV_MCAST_CP_STATS_GET_FUNCS(rx_ccmpmic);
+VDEV_MCAST_CP_STATS_GET_FUNCS(rx_ccmpreplay);
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_IC_UTILS_API_H__ */

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

@@ -115,3 +115,31 @@ QDF_STATUS wlan_ucfg_get_peer_cp_stats(struct wlan_objmgr_peer *peer,
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+QDF_STATUS
+wlan_ucfg_get_vdev_cp_stats(struct wlan_objmgr_vdev *vdev,
+			    struct vdev_ic_cp_stats *vdev_cps)
+{
+	struct vdev_cp_stats *vdev_cs;
+
+	if (!vdev) {
+		cp_stats_err("Invalid input, vdev obj is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!vdev_cps) {
+		cp_stats_err("Invalid input, vdev cp obj is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	vdev_cs = wlan_cp_stats_get_vdev_stats_obj(vdev);
+	if (vdev_cs && vdev_cs->vdev_stats) {
+		wlan_cp_stats_vdev_obj_lock(vdev_cs);
+		qdf_mem_copy(vdev_cps, vdev_cs->vdev_stats,
+			     sizeof(*vdev_cps));
+		wlan_cp_stats_vdev_obj_unlock(vdev_cs);
+		return QDF_STATUS_SUCCESS;
+	}
+
+	return QDF_STATUS_E_FAILURE;
+}