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:
@@ -1122,6 +1122,9 @@ 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);
|
||||||
|
|
||||||
|
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,
|
||||||
void **base_vaddr_unaligned,
|
void **base_vaddr_unaligned,
|
||||||
qdf_dma_addr_t *paddr_unaligned,
|
qdf_dma_addr_t *paddr_unaligned,
|
||||||
|
@@ -2517,6 +2517,29 @@ QDF_STATUS dp_wds_ext_set_peer_rx(ol_txrx_soc_handle soc,
|
|||||||
#endif /* QCA_SUPPORT_WDS_EXTENDED */
|
#endif /* QCA_SUPPORT_WDS_EXTENDED */
|
||||||
|
|
||||||
#ifdef DP_MEM_PRE_ALLOC
|
#ifdef DP_MEM_PRE_ALLOC
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dp_context_alloc_mem() - allocate memory for DP context
|
||||||
|
* @soc: datapath soc handle
|
||||||
|
* @ctxt_type: DP context type
|
||||||
|
* @ctxt_size: DP context size
|
||||||
|
*
|
||||||
|
* Return: DP context address
|
||||||
|
*/
|
||||||
|
void *dp_context_alloc_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
|
||||||
|
size_t ctxt_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dp_context_free_mem() - Free memory of DP context
|
||||||
|
* @soc: datapath soc handle
|
||||||
|
* @ctxt_type: DP context type
|
||||||
|
* @vaddr: Address of context memory
|
||||||
|
*
|
||||||
|
* Return: None
|
||||||
|
*/
|
||||||
|
void dp_context_free_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
|
||||||
|
void *vaddr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dp_desc_multi_pages_mem_alloc() - alloc memory over multiple pages
|
* dp_desc_multi_pages_mem_alloc() - alloc memory over multiple pages
|
||||||
* @soc: datapath soc handle
|
* @soc: datapath soc handle
|
||||||
@@ -2563,6 +2586,20 @@ void dp_desc_multi_pages_mem_free(struct dp_soc *soc,
|
|||||||
bool cacheable);
|
bool cacheable);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
static inline
|
||||||
|
void *dp_context_alloc_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
|
||||||
|
size_t ctxt_size)
|
||||||
|
{
|
||||||
|
return qdf_mem_malloc(ctxt_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void dp_context_free_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
|
||||||
|
void *vaddr)
|
||||||
|
{
|
||||||
|
qdf_mem_free(vaddr);
|
||||||
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void dp_desc_multi_pages_mem_alloc(struct dp_soc *soc,
|
void dp_desc_multi_pages_mem_alloc(struct dp_soc *soc,
|
||||||
enum dp_desc_type desc_type,
|
enum dp_desc_type desc_type,
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -367,6 +367,14 @@ struct dp_rx_nbuf_frag_info {
|
|||||||
} virt_addr;
|
} virt_addr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum dp_ctxt - context type
|
||||||
|
* @DP_PDEV_TYPE: PDEV context
|
||||||
|
*/
|
||||||
|
enum dp_ctxt_type {
|
||||||
|
DP_PDEV_TYPE
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enum dp_desc_type - source type for multiple pages allocation
|
* enum dp_desc_type - source type for multiple pages allocation
|
||||||
* @DP_TX_DESC_TYPE: DP SW TX descriptor
|
* @DP_TX_DESC_TYPE: DP SW TX descriptor
|
||||||
|
Reference in New Issue
Block a user