mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
net: stmmac: Add GFP_DMA32 for rx buffers if no 64 capability
Use page_pool_alloc_pages instead of page_pool_dev_alloc_pages, which can give the gfp parameter, in the case of not supporting 64-bit width, using 32-bit address memory can reduce a copy from swiotlb. Signed-off-by: David Wu <david.wu@rock-chips.com> Signed-off-by: David S. Miller <davem@davemloft.net> Change-Id: I62bff35850cf62db1be7067f3050b27039ae5d75
This commit is contained in:
@@ -1282,13 +1282,17 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p,
|
||||
{
|
||||
struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
|
||||
struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
|
||||
gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN);
|
||||
|
||||
buf->page = page_pool_dev_alloc_pages(rx_q->page_pool);
|
||||
if (priv->dma_cap.addr64 <= 32)
|
||||
gfp |= GFP_DMA32;
|
||||
|
||||
buf->page = page_pool_alloc_pages(rx_q->page_pool, gfp);
|
||||
if (!buf->page)
|
||||
return -ENOMEM;
|
||||
|
||||
if (priv->sph) {
|
||||
buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool);
|
||||
buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
|
||||
if (!buf->sec_page)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -3603,6 +3607,10 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
|
||||
struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
|
||||
int len, dirty = stmmac_rx_dirty(priv, queue);
|
||||
unsigned int entry = rx_q->dirty_rx;
|
||||
gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN);
|
||||
|
||||
if (priv->dma_cap.addr64 <= 32)
|
||||
gfp |= GFP_DMA32;
|
||||
|
||||
len = DIV_ROUND_UP(priv->dma_buf_sz, PAGE_SIZE) * PAGE_SIZE;
|
||||
|
||||
@@ -3617,13 +3625,13 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
|
||||
p = rx_q->dma_rx + entry;
|
||||
|
||||
if (!buf->page) {
|
||||
buf->page = page_pool_dev_alloc_pages(rx_q->page_pool);
|
||||
buf->page = page_pool_alloc_pages(rx_q->page_pool, gfp);
|
||||
if (!buf->page)
|
||||
break;
|
||||
}
|
||||
|
||||
if (priv->sph && !buf->sec_page) {
|
||||
buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool);
|
||||
buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
|
||||
if (!buf->sec_page)
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user