qcacmn: add size parameter for dp_prealloc_get_context

add size parameter for dp_prealloc_get_context.

Change-Id: I0171124cf35010e793c18d4c8f6916497f053f8d
CRs-Fixed: 3222817
This commit is contained in:
Jinwei Chen
2022-06-16 04:14:17 -07:00
committed by Madan Koyyalamudi
parent e6eb58971d
commit fdb2193820
2 changed files with 7 additions and 5 deletions

View File

@@ -1391,7 +1391,7 @@ struct ol_if_ops {
uint8_t *peer_mac_addr); uint8_t *peer_mac_addr);
#endif #endif
#ifdef DP_MEM_PRE_ALLOC #ifdef DP_MEM_PRE_ALLOC
void *(*dp_prealloc_get_context)(uint32_t ctxt_type); void *(*dp_prealloc_get_context)(uint32_t ctxt_type, size_t ctxt_size);
QDF_STATUS(*dp_prealloc_put_context)(uint32_t ctxt_type, void *vaddr); QDF_STATUS(*dp_prealloc_put_context)(uint32_t ctxt_type, void *vaddr);
void *(*dp_prealloc_get_consistent)(uint32_t *size, void *(*dp_prealloc_get_consistent)(uint32_t *size,

View File

@@ -1937,13 +1937,15 @@ void *dp_context_alloc_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
goto dynamic_alloc; goto dynamic_alloc;
} }
ctxt_mem = soc->cdp_soc.ol_ops->dp_prealloc_get_context(ctxt_type); ctxt_mem = soc->cdp_soc.ol_ops->dp_prealloc_get_context(ctxt_type,
ctxt_size);
if (ctxt_mem) if (ctxt_mem)
goto end; goto end;
dynamic_alloc: dynamic_alloc:
dp_info("Pre-alloc of ctxt failed. Dynamic allocation"); dp_info("Pre-alloc type %d, size %zu failed, need dynamic-alloc",
ctxt_type, ctxt_size);
ctxt_mem = qdf_mem_malloc(ctxt_size); ctxt_mem = qdf_mem_malloc(ctxt_size);
end: end:
return ctxt_mem; return ctxt_mem;
@@ -1959,12 +1961,12 @@ void dp_context_free_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
ctxt_type, ctxt_type,
vaddr); vaddr);
} else { } else {
dp_warn("dp_prealloc_get_context null!"); dp_warn("dp_prealloc_put_context null!");
status = QDF_STATUS_E_NOSUPPORT; status = QDF_STATUS_E_NOSUPPORT;
} }
if (QDF_IS_STATUS_ERROR(status)) { if (QDF_IS_STATUS_ERROR(status)) {
dp_info("Context not pre-allocated"); dp_info("Context type %d not pre-allocated", ctxt_type);
qdf_mem_free(vaddr); qdf_mem_free(vaddr);
} }
} }