Skip to content

Commit

Permalink
octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc
Browse files Browse the repository at this point in the history
CN10K platform requires physically contiguous memory for LMTST
operations which goes beyond a single page. Not having physically
contiguous memory will result in HW fetching transmit descriptors from
a wrong memory location.

Hence use DMA_ATTR_FORCE_CONTIGUOUS attribute while allocating
LMTST regions.

Signed-off-by: Geetha sowjanya <gakula@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Geetha sowjanya authored and David S. Miller committed Aug 22, 2021
1 parent 10df5a1 commit 73d33db
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/net/ethernet/marvell/octeontx2/af/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q,

qmem->entry_sz = entry_sz;
qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN;
qmem->base = dma_alloc_coherent(dev, qmem->alloc_sz,
&qmem->iova, GFP_KERNEL);
qmem->base = dma_alloc_attrs(dev, qmem->alloc_sz, &qmem->iova,
GFP_KERNEL, DMA_ATTR_FORCE_CONTIGUOUS);
if (!qmem->base)
return -ENOMEM;

Expand All @@ -84,9 +84,10 @@ static inline void qmem_free(struct device *dev, struct qmem *qmem)
return;

if (qmem->base)
dma_free_coherent(dev, qmem->alloc_sz,
qmem->base - qmem->align,
qmem->iova - qmem->align);
dma_free_attrs(dev, qmem->alloc_sz,
qmem->base - qmem->align,
qmem->iova - qmem->align,
DMA_ATTR_FORCE_CONTIGUOUS);
devm_kfree(dev, qmem);
}

Expand Down

0 comments on commit 73d33db

Please sign in to comment.