On Thu, Jul 4, 2019 at 4:46 PM Ilias Apalodimas <ilias.apalodi...@linaro.org> wrote: > diff --git a/drivers/net/ethernet/socionext/netsec.c > b/drivers/net/ethernet/socionext/netsec.c > index 5544a722543f..ada7626bf3a2 100644 > --- a/drivers/net/ethernet/socionext/netsec.c > > + dma_start = page_pool_get_dma_addr(page); > /* We allocate the same buffer length for XDP and non-XDP cases. > * page_pool API will map the whole page, skip what's needed for > * network payloads and/or XDP > */ > - *dma_handle = page_pool_get_dma_addr(page) + NETSEC_RXBUF_HEADROOM; > + *dma_handle = dma_start + NETSEC_RXBUF_HEADROOM; > /* Make sure the incoming payload fits in the page for XDP and non-XDP > * cases and reserve enough space for headroom + skb_shared_info > */ > *desc_len = PAGE_SIZE - NETSEC_RX_BUF_NON_DATA; > + dma_dir = page_pool_get_dma_dir(dring->page_pool); > + dma_sync_single_for_device(priv->dev, dma_start, PAGE_SIZE, dma_dir);
Should this maybe become part of the page_pool_*() interfaces? Basically in order to map a page from the pool, any driver would have to go through these exact steps, so you could make it a combined function call dma_addr_t page_pool_sync_for_device(dring->page_pool, page); Or even fold the page_pool_dev_alloc_pages() into it as well and make that return both the virtual and dma addresses. Arnd