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

From: Jakub Kicinski <[email-masked]>
Date: Tue, 6 Aug 2024 13:47:08 -0700

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?