qcacmn: Pre allocate pdev during attach

Pre-allocate pdev context as size exceeds dynamic allocation
threshold (4KB).

Change-Id: Ida866275ed1ddea5a9b6aa1cf114ccd226ed0f22
CRs-Fixed: 2825110
This commit is contained in:
Ananya Gupta
2020-11-26 23:31:19 +05:30
committed by snandini
parent 27378433c5
commit a660173209
4 changed files with 93 additions and 2 deletions

View File

@@ -1445,6 +1445,49 @@ dp_srng_configure_interrupt_thresholds(struct dp_soc *soc,
#endif
#ifdef DP_MEM_PRE_ALLOC
void *dp_context_alloc_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
size_t ctxt_size)
{
void *ctxt_mem;
if (!soc->cdp_soc.ol_ops->dp_prealloc_get_context) {
dp_warn("dp_prealloc_get_context null!");
goto dynamic_alloc;
}
ctxt_mem = soc->cdp_soc.ol_ops->dp_prealloc_get_context(ctxt_type);
if (ctxt_mem)
goto end;
dynamic_alloc:
dp_info("Pre-alloc of ctxt failed. Dynamic allocation");
ctxt_mem = qdf_mem_malloc(ctxt_size);
end:
return ctxt_mem;
}
void dp_context_free_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
void *vaddr)
{
QDF_STATUS status;
if (soc->cdp_soc.ol_ops->dp_prealloc_put_context) {
status = soc->cdp_soc.ol_ops->dp_prealloc_put_context(
DP_PDEV_TYPE,
vaddr);
} else {
dp_warn("dp_prealloc_get_context null!");
status = QDF_STATUS_E_NOSUPPORT;
}
if (QDF_IS_STATUS_ERROR(status)) {
dp_info("Context not pre-allocated");
qdf_mem_free(vaddr);
}
}
static inline
void *dp_srng_aligned_mem_alloc_consistent(struct dp_soc *soc,
struct dp_srng *srng,
@@ -4193,7 +4236,7 @@ static inline QDF_STATUS dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc,
struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
int nss_cfg;
pdev = qdf_mem_malloc(sizeof(*pdev));
pdev = dp_context_alloc_mem(soc, DP_PDEV_TYPE, sizeof(*pdev));
if (!pdev) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
FL("DP PDEV memory allocation failed"));
@@ -4544,7 +4587,7 @@ static void dp_pdev_detach(struct cdp_pdev *txrx_pdev, int force)
wlan_cfg_pdev_detach(pdev->wlan_cfg_ctx);
wlan_minidump_remove(pdev);
qdf_mem_free(pdev);
dp_context_free_mem(soc, DP_PDEV_TYPE, pdev);
}
/*