[PATCH net-next v18 05/14] page_pool: move dmaddr helpers to .c file

Jakub Kicinski kuba at kernel.org
Tue Aug 6 20:42:54 UTC 2024


On Mon,  5 Aug 2024 21:25:18 +0000 Mina Almasry wrote:
> +dma_addr_t page_pool_get_dma_addr_netmem(netmem_ref netmem)
> +{
> +	struct page *page = netmem_to_page(netmem);
> +
> +	dma_addr_t ret = page->dma_addr;
> +
> +	if (PAGE_POOL_32BIT_ARCH_WITH_64BIT_DMA)
> +		ret <<= PAGE_SHIFT;
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL(page_pool_get_dma_addr_netmem);

Get should stay in the header.

> +bool page_pool_set_dma_addr_netmem(netmem_ref netmem, dma_addr_t addr)
> +{
> +	struct page *page = netmem_to_page(netmem);
> +
> +	if (PAGE_POOL_32BIT_ARCH_WITH_64BIT_DMA) {
> +		page->dma_addr = addr >> PAGE_SHIFT;
> +
> +		/* We assume page alignment to shave off bottom bits,
> +		 * if this "compression" doesn't work we need to drop.
> +		 */
> +		return addr != (dma_addr_t)page->dma_addr << PAGE_SHIFT;
> +	}
> +
> +	page->dma_addr = addr;
> +	return false;
> +}
> +EXPORT_SYMBOL(page_pool_set_dma_addr_netmem);

Set should not be in the public (include/linux) header at all,
and should not be exported. net/core/page_pool_priv.h already
exists. Feel free to break this out of the series.


More information about the dri-devel mailing list