Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7bd6f18 authored by Jinwei Chen's avatar Jinwei Chen Committed by snandini
Browse files

qcacmn: Support unaligned consistent memory prealloc

Support unaligned consistent memory prealloc

Change-Id: I7c014e4c13602de89d03e2f7c5efb39b5b376226
CRs-Fixed: 2761282
parent 00be65d3
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -2109,6 +2109,23 @@ void dp_set_max_page_size(struct qdf_mem_multi_page_t *pages,
#endif /* MAX_ALLOC_PAGE_SIZE */

#ifdef DP_MEM_PRE_ALLOC
/**
 * dp_desc_multi_pages_mem_alloc() - alloc memory over multiple pages
 * @soc: datapath soc handle
 * @desc_type: memory request source type
 * @pages: multi page information storage
 * @element_size: each element size
 * @element_num: total number of elements should be allocated
 * @memctxt: memory context
 * @cacheable: coherent memory or cacheable memory
 *
 * This function is a wrapper for memory allocation over multiple
 * pages, if dp prealloc method is registered, then will try prealloc
 * firstly. if prealloc failed, fall back to regular way over
 * qdf_mem_multi_pages_alloc().
 *
 * Return: None
 */
void dp_desc_multi_pages_mem_alloc(struct dp_soc *soc,
				   enum dp_desc_type desc_type,
				   struct qdf_mem_multi_page_t *pages,
@@ -2117,6 +2134,20 @@ void dp_desc_multi_pages_mem_alloc(struct dp_soc *soc,
				   qdf_dma_context_t memctxt,
				   bool cacheable);

/**
 * dp_desc_multi_pages_mem_free() - free multiple pages memory
 * @soc: datapath soc handle
 * @desc_type: memory request source type
 * @pages: multi page information storage
 * @memctxt: memory context
 * @cacheable: coherent memory or cacheable memory
 *
 * This function is a wrapper for multiple pages memory free,
 * if memory is got from prealloc pool, put it back to pool.
 * otherwise free by qdf_mem_multi_pages_free().
 *
 * Return: None
 */
void dp_desc_multi_pages_mem_free(struct dp_soc *soc,
				  enum dp_desc_type desc_type,
				  struct qdf_mem_multi_page_t *pages,
+1 −1
Original line number Diff line number Diff line
@@ -1441,7 +1441,7 @@ void dp_desc_multi_pages_mem_alloc(struct dp_soc *soc,
end:
	dp_info("%s desc_type %d element_size %d element_num %d cacheable %d",
		pages->is_mem_prealloc ? "pre-alloc" : "dynamic-alloc",
		desc_type, element_size, element_num, cacheable);
		desc_type, (int)element_size, element_num, cacheable);
}

void dp_desc_multi_pages_mem_free(struct dp_soc *soc,
+1 −0
Original line number Diff line number Diff line
@@ -2857,6 +2857,7 @@ dp_rx_pdev_attach(struct dp_pdev *pdev)
	rx_desc_pool = &soc->rx_desc_buf[mac_for_pdev];
	rx_sw_desc_weight = wlan_cfg_get_dp_soc_rx_sw_desc_weight(soc->wlan_cfg_ctx);

	rx_desc_pool->desc_type = DP_RX_DESC_BUF_TYPE;
	dp_rx_desc_pool_alloc(soc, mac_for_pdev,
			      rx_sw_desc_weight * rxdma_entries,
			      rx_desc_pool);
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc, uint32_t pool_id,
	desc_size = sizeof(*rx_desc_elem);
	rx_desc_pool->elem_size = desc_size;
	if (!dp_is_soc_reinit(soc)) {
		dp_desc_multi_pages_mem_alloc(soc, DP_RX_DESC_BUF_TYPE,
		dp_desc_multi_pages_mem_alloc(soc, rx_desc_pool->desc_type,
					      &rx_desc_pool->desc_pages,
					      desc_size, num_elem, 0, true);
		if (!rx_desc_pool->desc_pages.num_pages) {
@@ -164,7 +164,7 @@ void dp_rx_desc_pool_free(struct dp_soc *soc,
{
	if (qdf_unlikely(!(rx_desc_pool->desc_pages.cacheable_pages)))
		return;
	dp_desc_multi_pages_mem_free(soc, DP_RX_DESC_BUF_TYPE,
	dp_desc_multi_pages_mem_free(soc, rx_desc_pool->desc_type,
				     &rx_desc_pool->desc_pages, 0, true);
}
#else
+1 −0
Original line number Diff line number Diff line
@@ -2016,6 +2016,7 @@ dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev, int ring_id) {
	dp_info("Mon RX Status Pool[%d] entries=%d",
		ring_id, num_entries);

	rx_desc_pool->desc_type = DP_RX_DESC_STATUS_TYPE;
	status = dp_rx_desc_pool_alloc(soc, ring_id, num_entries + 1,
				       rx_desc_pool);
	if (!QDF_IS_STATUS_SUCCESS(status))
Loading