qcacmn: Alloc/Dealloc the peer extended stats

Allocate/Deallocated the peer extended object in the
peer_create() and peer_del() paths respectively.

Change-Id: I3e93e1ec85aefb22d3fb40d1b01bbd07d660aff5
这个提交包含在:
Aniruddha Paul
2020-05-14 15:48:12 +05:30
提交者 snandini
父节点 e99b7c2a82
当前提交 b07ed991ec
修改 3 个文件,包含 115 行新增0 行删除

查看文件

@@ -5507,6 +5507,15 @@ dp_peer_create_wifi3(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
}
}
/*
* Allocate peer extended stats context. Fall through in
* case of failure as its not an implicit requirement to have
* this object for regular statistics updates.
*/
if (dp_peer_ext_stats_ctx_alloc(soc, peer) !=
QDF_STATUS_SUCCESS)
dp_warn("peer ext_stats ctx alloc failed");
/*
* In tx_monitor mode, filter may be set for unassociated peer
* when unassociated peer get associated peer need to
@@ -6220,6 +6229,11 @@ void dp_peer_unref_delete(struct dp_peer *peer)
peer, vdev, &peer->vdev->peer_list);
}
/*
* Deallocate the extended stats contenxt
*/
dp_peer_ext_stats_ctx_dealloc(soc, peer);
/* send peer destroy event to upper layer */
qdf_mem_copy(peer_cookie.mac_addr, peer->mac_addr.raw,
QDF_MAC_ADDR_SIZE);

查看文件

@@ -34,6 +34,10 @@
#include "dp_tx_capture.h"
#endif
#ifdef QCA_PEER_EXT_STATS
#include "dp_hist.h"
#endif
#ifdef FEATURE_WDS
static inline bool
dp_peer_ast_free_in_unmap_supported(struct dp_peer *peer,
@@ -3361,6 +3365,85 @@ dp_rx_sec_ind_handler(struct dp_soc *soc, uint16_t peer_id,
dp_peer_unref_del_find_by_id(peer);
}
#ifdef QCA_PEER_EXT_STATS
/*
* dp_peer_ext_stats_ctx_alloc() - Allocate peer ext
* stats content
* @soc: DP SoC context
* @peer: DP peer context
*
* Allocate the peer extended stats context
*
* Return: QDF_STATUS_SUCCESS if allocation is
* successful
*/
QDF_STATUS dp_peer_ext_stats_ctx_alloc(struct dp_soc *soc,
struct dp_peer *peer)
{
uint8_t tid, ctx_id;
if (!soc || !peer) {
dp_warn("Null soc%x or peer%x", soc, peer);
return QDF_STATUS_E_INVAL;
}
if (!wlan_cfg_is_peer_ext_stats_enabled(soc->wlan_cfg_ctx))
return QDF_STATUS_SUCCESS;
/*
* Allocate memory for peer extended stats.
*/
peer->pext_stats = qdf_mem_malloc(sizeof(struct cdp_peer_ext_stats));
if (!peer->pext_stats) {
dp_err("Peer extended stats obj alloc failed!!");
return QDF_STATUS_E_NOMEM;
}
for (tid = 0; tid < CDP_MAX_DATA_TIDS; tid++) {
for (ctx_id = 0; ctx_id < CDP_MAX_TXRX_CTX; ctx_id++) {
struct cdp_delay_tx_stats *tx_delay =
&peer->pext_stats->delay_stats[tid][ctx_id].tx_delay;
struct cdp_delay_rx_stats *rx_delay =
&peer->pext_stats->delay_stats[tid][ctx_id].rx_delay;
dp_hist_init(&tx_delay->tx_swq_delay,
CDP_HIST_TYPE_SW_ENQEUE_DELAY);
dp_hist_init(&tx_delay->hwtx_delay,
CDP_HIST_TYPE_HW_COMP_DELAY);
dp_hist_init(&rx_delay->to_stack_delay,
CDP_HIST_TYPE_REAP_STACK);
}
}
return QDF_STATUS_SUCCESS;
}
/*
* dp_peer_ext_stats_ctx_dealloc() - Dealloc the peer context
* @peer: DP peer context
*
* Free the peer extended stats context
*
* Return: Void
*/
void dp_peer_ext_stats_ctx_dealloc(struct dp_soc *soc, struct dp_peer *peer)
{
if (!peer) {
dp_warn("peer_ext dealloc failed due to NULL peer object");
return;
}
if (!wlan_cfg_is_peer_ext_stats_enabled(soc->wlan_cfg_ctx))
return;
if (!peer->pext_stats)
return;
qdf_mem_free(peer->pext_stats);
peer->pext_stats = NULL;
}
#endif
QDF_STATUS
dp_rx_delba_ind_handler(void *soc_handle, uint16_t peer_id,
uint8_t tid, uint16_t win_sz)

查看文件

@@ -383,4 +383,22 @@ dp_peer_update_80211_hdr(struct dp_vdev *vdev, struct dp_peer *peer)
}
#endif
#ifdef QCA_PEER_EXT_STATS
QDF_STATUS dp_peer_ext_stats_ctx_alloc(struct dp_soc *soc,
struct dp_peer *peer);
void dp_peer_ext_stats_ctx_dealloc(struct dp_soc *soc,
struct dp_peer *peer);
#else
static inline QDF_STATUS dp_peer_ext_stats_ctx_alloc(struct dp_soc *soc,
struct dp_peer *peer)
{
return QDF_STATUS_SUCCESS;
}
static inline void dp_peer_ext_stats_ctx_dealloc(struct dp_soc *soc,
struct dp_peer *peer)
{
}
#endif
#endif /* _DP_PEER_H_ */