diff --git a/os_if/linux/cp_stats/inc/wlan_cfg80211_mc_cp_stats.h b/os_if/linux/cp_stats/inc/wlan_cfg80211_mc_cp_stats.h index 4450e7fe46cd..47150a0ef574 100644 --- a/os_if/linux/cp_stats/inc/wlan_cfg80211_mc_cp_stats.h +++ b/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__ */ diff --git a/os_if/linux/cp_stats/src/wlan_cfg80211_mc_cp_stats.c b/os_if/linux/cp_stats/src/wlan_cfg80211_mc_cp_stats.c index 7873958670f6..8b7bb1fa9283 100644 --- a/os_if/linux/cp_stats/src/wlan_cfg80211_mc_cp_stats.c +++ b/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); +} diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h index afbfd2f369fd..065c5a8c6ba2 100644 --- a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h +++ b/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__ */ diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c index cff2ec1f6210..231425df6ebc 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c +++ b/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 diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c index 07e30070f9c2..d364ee4837d6 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c +++ b/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)); +} +