Ver código fonte

qcacmn: Add os_if implementation of peer cp stats

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

Change-Id: I81276cee57a8c28e52e82c0cbc7f58be7dbfa33e
CRs-Fixed: 2247228
Naga 7 anos atrás
pai
commit
c5e9342021

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

@@ -28,6 +28,17 @@
 
 #ifdef QCA_SUPPORT_CP_STATS
 #include <wlan_objmgr_cmn.h>
+#include <wlan_cp_stats_ic_defs.h>
+
+/**
+ * wlan_cfg80211_get_peer_cp_stats() - API to get peer stats object
+ * @peer_obj: peer object as input
+ * @peer_cp_stats: peer stats object to populate
+ *
+ * Return: 0 on success, negative value on failure
+ */
+int wlan_cfg80211_get_peer_cp_stats(struct wlan_objmgr_peer *peer_obj,
+				    struct peer_ic_cp_stats *peer_cp_stats);
 
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CFG80211_IC_CP_STATS_H__ */

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

@@ -22,3 +22,30 @@
  * This file provide definitions to cp stats supported cfg80211 cmd handlers
  */
 #include <wlan_cfg80211_ic_cp_stats.h>
+#include <wlan_cp_stats_ic_ucfg_api.h>
+#include <wlan_cfg80211.h>
+#include <qdf_util.h>
+
+int wlan_cfg80211_get_peer_cp_stats(struct wlan_objmgr_peer *peer_obj,
+				    struct peer_ic_cp_stats *peer_cp_stats)
+{
+	QDF_STATUS status;
+
+	if (!peer_obj) {
+		cfg80211_err("Invalid input, peer obj NULL");
+		return -EINVAL;
+	}
+
+	if (!peer_cp_stats) {
+		cfg80211_err("Invalid input, peer cp obj is NULL");
+		return -EINVAL;
+	}
+
+	status = wlan_ucfg_get_peer_cp_stats(peer_obj, peer_cp_stats);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		cfg80211_err("wlan_cfg80211_get_peer_cp_stats status: %d",
+			     status);
+	}
+
+	return qdf_status_to_os_return(status);
+}