瀏覽代碼

qcacmn: Add os_if implementation of atf peer cp stats

Add change to support get API for ATF peer cp stats from
within cp stats component

Change-Id: I1f7ed2e2d1c071df28f34f08d137be1302f61c36
CRs-Fixed: 2247228
Naga 6 年之前
父節點
當前提交
8703c9c98f

+ 33 - 0
os_if/linux/cp_stats/inc/wlan_cfg80211_ic_cp_stats.h

@@ -29,6 +29,9 @@
 #ifdef QCA_SUPPORT_CP_STATS
 #include <wlan_objmgr_cmn.h>
 #include <wlan_cp_stats_ic_defs.h>
+#ifdef WLAN_ATF_ENABLE
+#include <wlan_cp_stats_ic_atf_defs.h>
+#endif
 
 /**
  * wlan_cfg80211_get_peer_cp_stats() - API to get peer stats object
@@ -60,5 +63,35 @@ int wlan_cfg80211_get_vdev_cp_stats(struct wlan_objmgr_vdev *vdev_obj,
 int wlan_cfg80211_get_pdev_cp_stats(struct wlan_objmgr_pdev *pdev_obj,
 				    struct pdev_ic_cp_stats *pdev_cp_stats);
 
+#ifdef WLAN_ATF_ENABLE
+/**
+ * wlan_cfg80211_get_peer_atf_cp_stats() - API to get ATF peer stats object
+ * @peer_obj: peer object as input
+ * @atf_cp_stats: atf peer cp stats object to populate
+ *
+ * Return: 0 on success, negative value on failure
+ */
+int
+wlan_cfg80211_get_atf_peer_cp_stats(struct wlan_objmgr_peer *peer_obj,
+				    struct atf_peer_cp_stats *atf_cp_stats);
+
+/**
+ * wlan_cfg80211_get_peer_atf_cp_stats_from_mac() - API to get ATF peer
+ * stats object from peer mac address
+ * @vdev_obj: vdev object as input
+ * @mac: peer mac address as input
+ * @atf_cp_stats: atf peer cp stats object to populate
+ *
+ * API used from ucfg layer to get ATF peer cp stats object when only peer
+ * mac address is available
+ *
+ * Return: 0 on success, negative value on failure
+ */
+int wlan_cfg80211_get_atf_peer_cp_stats_from_mac(
+		struct wlan_objmgr_vdev *vdev_obj,
+		uint8_t *mac,
+		struct atf_peer_cp_stats *atf_cp_stats);
+#endif /* WLAN_ATF_ENABLE */
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CFG80211_IC_CP_STATS_H__ */

+ 59 - 0
os_if/linux/cp_stats/src/wlan_cfg80211_ic_cp_stats.c

@@ -99,3 +99,62 @@ int wlan_cfg80211_get_pdev_cp_stats(struct wlan_objmgr_pdev *pdev_obj,
 }
 
 qdf_export_symbol(wlan_cfg80211_get_pdev_cp_stats);
+
+#ifdef WLAN_ATF_ENABLE
+int
+wlan_cfg80211_get_atf_peer_cp_stats(struct wlan_objmgr_peer *peer_obj,
+				    struct atf_peer_cp_stats *atf_cp_stats)
+{
+	QDF_STATUS status;
+
+	if (!peer_obj) {
+		cfg80211_err("Invalid input, peer obj is NULL");
+		return -EINVAL;
+	}
+
+	if (!atf_cp_stats) {
+		cfg80211_err("Invalid input, ATF peer cp obj is NULL!");
+		return -EINVAL;
+	}
+
+	status = wlan_ucfg_get_atf_peer_cp_stats(peer_obj, atf_cp_stats);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		cfg80211_err("wlan_cfg80211_get_atf_peer_cp_stats status: %d",
+			     status);
+	}
+
+	return qdf_status_to_os_return(status);
+}
+
+int wlan_cfg80211_get_atf_peer_cp_stats_from_mac(
+		struct wlan_objmgr_vdev *vdev_obj,
+		uint8_t *mac,
+		struct atf_peer_cp_stats *atf_cp_stats)
+{
+	QDF_STATUS status;
+
+	if (!vdev_obj) {
+		cfg80211_err("Invalid input, vdev obj is NULL");
+		return -EINVAL;
+	}
+
+	if (!mac) {
+		cfg80211_err("Invalid input, peer mac is NULL");
+		return -EINVAL;
+	}
+
+	if (!atf_cp_stats) {
+		cfg80211_err("Invalid input, ATF peer cp stats obj is NULL");
+		return -EINVAL;
+	}
+
+	status = wlan_ucfg_get_atf_peer_cp_stats_from_mac(vdev_obj, mac,
+							  atf_cp_stats);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		cfg80211_err("wlan_cfg80211_get_cp_stats_from_mac status: %d",
+			     status);
+	}
+
+	return qdf_status_to_os_return(status);
+}
+#endif