|
@@ -1445,6 +1445,49 @@ dp_srng_configure_interrupt_thresholds(struct dp_soc *soc,
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef DP_MEM_PRE_ALLOC
|
|
#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
|
|
static inline
|
|
void *dp_srng_aligned_mem_alloc_consistent(struct dp_soc *soc,
|
|
void *dp_srng_aligned_mem_alloc_consistent(struct dp_soc *soc,
|
|
struct dp_srng *srng,
|
|
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;
|
|
struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
|
|
int nss_cfg;
|
|
int nss_cfg;
|
|
|
|
|
|
- pdev = qdf_mem_malloc(sizeof(*pdev));
|
|
|
|
|
|
+ pdev = dp_context_alloc_mem(soc, DP_PDEV_TYPE, sizeof(*pdev));
|
|
if (!pdev) {
|
|
if (!pdev) {
|
|
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
|
|
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
|
|
FL("DP PDEV memory allocation failed"));
|
|
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_cfg_pdev_detach(pdev->wlan_cfg_ctx);
|
|
wlan_minidump_remove(pdev);
|
|
wlan_minidump_remove(pdev);
|
|
- qdf_mem_free(pdev);
|
|
|
|
|
|
+ dp_context_free_mem(soc, DP_PDEV_TYPE, pdev);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|