Browse Source

qcacmn: Define ucfg api to free stats_event

Define ucfg api to free stats_event, since it will be called from
osif and hdd.

Change-Id: Ifeea3e970ddca1ed508960c39a2a39f0ed755bd9
CRs-Fixed: 2231150
Naveen Rawat 7 years ago
parent
commit
1a9ee7dc49

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

@@ -68,11 +68,22 @@ int wlan_cfg80211_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev,
  * @macaddress: mac address
  * @rssi_info: stats structure within which rssi info will be populated
  *
+ * Call of this API must call wlan_cfg80211_mc_cp_stats_put_peer_rssi
+ * API when done with information provided by rssi_info.
  * Return: 0 on success, negative value on failure
  */
 int wlan_cfg80211_mc_cp_stats_get_peer_rssi(struct wlan_objmgr_vdev *vdev,
 					    uint8_t *macaddress,
 					    struct stats_event *rssi_info);
 
+/**
+ * wlan_cfg80211_mc_cp_stats_put_peer_rssi() - API to free rssi_info after user
+ * or caller is done with the buffer/information
+ * @rssi_info: structure which needs to be freed
+ *
+ * Return: None
+ */
+void wlan_cfg80211_mc_cp_stats_put_peer_rssi(struct stats_event *rssi_info);
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CFG80211_MC_CP_STATS_H__ */

+ 5 - 0
os_if/linux/cp_stats/src/wlan_cfg80211_mc_cp_stats.c

@@ -356,3 +356,8 @@ int wlan_cfg80211_mc_cp_stats_get_peer_rssi(struct wlan_objmgr_vdev *vdev,
 
 	return ret;
 }
+
+void wlan_cfg80211_mc_cp_stats_put_peer_rssi(struct stats_event *rssi_info)
+{
+	ucfg_mc_cp_stats_free_stats_resources(rssi_info);
+}

+ 9 - 0
umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h

@@ -176,5 +176,14 @@ QDF_STATUS ucfg_mc_cp_stats_get_pending_req(struct wlan_objmgr_psoc *psoc,
 					    enum stats_req_type type,
 					    struct request_info *info);
 
+/**
+ * ucfg_mc_cp_stats_free_stats_resources() - API to free buffers within stats_event
+ * structure
+ * @ev: strcture whose buffer are to freed
+ *
+ * Return: none
+ */
+void ucfg_mc_cp_stats_free_stats_resources(struct stats_event *ev);
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_MC_UCFG_API_H__ */

+ 1 - 1
umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c

@@ -210,7 +210,7 @@ end:
 		wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
 	if (peer)
 		wlan_objmgr_peer_release_ref(peer, WLAN_CP_STATS_ID);
-	ucfg_mc_cp_stats_free_stats_event(&ev);
+	ucfg_mc_cp_stats_free_stats_resources(&ev);
 }
 
 static QDF_STATUS

+ 8 - 0
umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c

@@ -531,3 +531,11 @@ QDF_STATUS ucfg_mc_cp_stats_get_pending_req(struct wlan_objmgr_psoc *psoc,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+void ucfg_mc_cp_stats_free_stats_resources(struct stats_event *ev)
+{
+	qdf_mem_free(ev->pdev_stats);
+	qdf_mem_free(ev->peer_stats);
+	qdf_mem_zero(ev, sizeof(*ev));
+}
+