qcacmn: Support none 4k page size kernel

DP uses multi page allocation for tx/rx descriptor.
ID and offset mask of decriptor is based on 4096 which
couples with Kernel's MMU PAGE_SIZE. This cause trouble
when deploy driver on none-4K page size kernel.
Set qdf_dp_blockmem_size to 4096 so that DP won't
depend on kernel page size.

Change-Id: I17f5c10b394e8709e6b4b153f3dd094cf792787f
CRs-Fixed: 3235246
This commit is contained in:
Ming Jiang
2022-07-04 14:12:21 +08:00
committed by Madan Koyyalamudi
parent 1705770b9f
commit 53537c67e1
5 changed files with 15 additions and 10 deletions

View File

@@ -26,6 +26,8 @@
#define DP_PEER_WDS_COUNT_INVALID UINT_MAX #define DP_PEER_WDS_COUNT_INVALID UINT_MAX
#define DP_BLOCKMEM_SIZE 4096
/* Alignment for consistent memory for DP rings*/ /* Alignment for consistent memory for DP rings*/
#define DP_RING_BASE_ALIGN 32 #define DP_RING_BASE_ALIGN 32

View File

@@ -2779,24 +2779,24 @@ dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
* have been allocated to fit in one page across each * have been allocated to fit in one page across each
* iteration to index into the nbuf. * iteration to index into the nbuf.
*/ */
total_pages = (nr_descs * sizeof(*nf_info)) / PAGE_SIZE; total_pages = (nr_descs * sizeof(*nf_info)) / DP_BLOCKMEM_SIZE;
/* /*
* Add an extra page to store the remainder if any * Add an extra page to store the remainder if any
*/ */
if ((nr_descs * sizeof(*nf_info)) % PAGE_SIZE) if ((nr_descs * sizeof(*nf_info)) % DP_BLOCKMEM_SIZE)
total_pages++; total_pages++;
nf_info = qdf_mem_malloc(PAGE_SIZE); nf_info = qdf_mem_malloc(DP_BLOCKMEM_SIZE);
if (!nf_info) { if (!nf_info) {
dp_err("failed to allocate nbuf array"); dp_err("failed to allocate nbuf array");
DP_STATS_INC(dp_pdev, replenish.rxdma_err, num_req_buffers); DP_STATS_INC(dp_pdev, replenish.rxdma_err, num_req_buffers);
QDF_BUG(0); QDF_BUG(0);
return QDF_STATUS_E_NOMEM; return QDF_STATUS_E_NOMEM;
} }
nbuf_ptrs_per_page = PAGE_SIZE / sizeof(*nf_info); nbuf_ptrs_per_page = DP_BLOCKMEM_SIZE / sizeof(*nf_info);
for (page_idx = 0; page_idx < total_pages; page_idx++) { for (page_idx = 0; page_idx < total_pages; page_idx++) {
qdf_mem_zero(nf_info, PAGE_SIZE); qdf_mem_zero(nf_info, DP_BLOCKMEM_SIZE);
for (nr_nbuf = 0; nr_nbuf < nbuf_ptrs_per_page; nr_nbuf++) { for (nr_nbuf = 0; nr_nbuf < nbuf_ptrs_per_page; nr_nbuf++) {
/* /*

View File

@@ -24,8 +24,9 @@
#ifdef RX_DESC_MULTI_PAGE_ALLOC #ifdef RX_DESC_MULTI_PAGE_ALLOC
A_COMPILE_TIME_ASSERT(cookie_size_check, A_COMPILE_TIME_ASSERT(cookie_size_check,
PAGE_SIZE / sizeof(union dp_rx_desc_list_elem_t) <= (DP_BLOCKMEM_SIZE /
1 << DP_RX_DESC_PAGE_ID_SHIFT); sizeof(union dp_rx_desc_list_elem_t))
<= (1 << DP_RX_DESC_PAGE_ID_SHIFT));
/* /*
* dp_rx_desc_pool_is_allocated() - check if memory is allocated for the * dp_rx_desc_pool_is_allocated() - check if memory is allocated for the
@@ -68,7 +69,7 @@ QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc,
desc_size = sizeof(*rx_desc_elem); desc_size = sizeof(*rx_desc_elem);
rx_desc_pool->elem_size = desc_size; rx_desc_pool->elem_size = desc_size;
rx_desc_pool->desc_pages.page_size = DP_BLOCKMEM_SIZE;
dp_desc_multi_pages_mem_alloc(soc, rx_desc_pool->desc_type, dp_desc_multi_pages_mem_alloc(soc, rx_desc_pool->desc_type,
&rx_desc_pool->desc_pages, &rx_desc_pool->desc_pages,
desc_size, num_elem, 0, true); desc_size, num_elem, 0, true);

View File

@@ -99,6 +99,7 @@ QDF_STATUS dp_tx_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
desc_size = DP_TX_DESC_SIZE(sizeof(struct dp_tx_desc_s)); desc_size = DP_TX_DESC_SIZE(sizeof(struct dp_tx_desc_s));
tx_desc_pool = &((soc)->tx_desc[(pool_id)]); tx_desc_pool = &((soc)->tx_desc[(pool_id)]);
tx_desc_pool->desc_pages.page_size = DP_BLOCKMEM_SIZE;
dp_desc_multi_pages_mem_alloc(soc, DP_TX_DESC_TYPE, dp_desc_multi_pages_mem_alloc(soc, DP_TX_DESC_TYPE,
&tx_desc_pool->desc_pages, &tx_desc_pool->desc_pages,
desc_size, num_elem, desc_size, num_elem,

View File

@@ -49,9 +49,10 @@
*/ */
QDF_COMPILE_TIME_ASSERT(dp_tx_desc_size, QDF_COMPILE_TIME_ASSERT(dp_tx_desc_size,
((sizeof(struct dp_tx_desc_s)) <= ((sizeof(struct dp_tx_desc_s)) <=
(PAGE_SIZE >> DP_TX_DESC_ID_PAGE_OS)) && (DP_BLOCKMEM_SIZE >> DP_TX_DESC_ID_PAGE_OS)) &&
((sizeof(struct dp_tx_desc_s)) > ((sizeof(struct dp_tx_desc_s)) >
(PAGE_SIZE >> (DP_TX_DESC_ID_PAGE_OS + 1)))); (DP_BLOCKMEM_SIZE >> (DP_TX_DESC_ID_PAGE_OS + 1)))
);
#ifdef QCA_LL_TX_FLOW_CONTROL_V2 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
#define TX_DESC_LOCK_CREATE(lock) #define TX_DESC_LOCK_CREATE(lock)