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
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user