[PATCH net-next v18 04/14] netdev: netdevice devmem allocator

Jakub Kicinski kuba at kernel.org
Tue Aug 6 20:47:08 UTC 2024


On Mon,  5 Aug 2024 21:25:17 +0000 Mina Almasry wrote:
> +struct net_iov *
> +net_devmem_alloc_dmabuf(struct net_devmem_dmabuf_binding *binding)
> +{
> +	struct dmabuf_genpool_chunk_owner *owner;
> +	unsigned long dma_addr;
> +	struct net_iov *niov;
> +	ssize_t offset;
> +	ssize_t index;
> +
> +	dma_addr = gen_pool_alloc_owner(binding->chunk_pool, PAGE_SIZE,
> +					(void **)&owner);
> +	if (!dma_addr)
> +		return NULL;
> +
> +	offset = dma_addr - owner->base_dma_addr;
> +	index = offset / PAGE_SIZE;
> +	niov = &owner->niovs[index];
> +
> +	niov->dma_addr = 0;

Is the dma_addr not constant for a given niov for the entire lifetime
of the binding? Why flip it back and forth between its value and 0?


More information about the dri-devel mailing list