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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux