Re: [PATCH v2 net] octeontx2-af: allocate qmem from page allocator to avoid CMA

From: Ratheesh Kannoth

Date: Thu Aug 27 2026 - 01:54:29 EST


On 2026-08-25 at 10:26:16, Ratheesh Kannoth (rkannoth@xxxxxxxxxxx) wrote:
> qmem_alloc() uses dma_alloc_attrs() with DMA_ATTR_FORCE_CONTIGUOUS so
> CN10K LMTST regions get physically contiguous DMA memory across page
> boundaries. On platforms with CMA enabled, that attribute causes
> allocations to be drawn from the CMA pool. qmem is used for NIX and
> NPA queue contexts, admin queues, and LMTST regions, so the footprint
> grows with the number of enabled interfaces and is difficult to
> provision in CMA.
>
> Add otx2_dma_alloc_coherent() and otx2_dma_free_coherent() helpers
> that allocate compound pages with __get_free_pages(__GFP_COMP),
> DMA-map them with dma_map_page(), and retry with GFP_DMA32 when the
> physical address exceeds the device DMA mask. Switch qmem_alloc()
> and qmem_free() to use them instead of
> dma_alloc_attrs()/dma_free_attrs().
>
> Fixes: 73d33dbc0723 ("octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc")
> Signed-off-by: Ratheesh Kannoth <rkannoth@xxxxxxxxxxx>

Will address sashiko comments in v3

pw-bot: changes-requested