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

From
Jakub Kicinski <kuba@kernel.org>
Date
2024-08-06 20:47:11
Also in
bpf, dri-devel, linux-alpha, linux-arch, linux-doc, linux-kselftest, linux-media, linux-mips, lkml, netdev, sparclinux
Reply to
Mina Almasry, 2024-08-05
On Mon,  5 Aug 2024 21:25:17 +0000 Mina Almasry wrote:
quoted hunk ↗ jump to hunk
+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?
Thread (41 messages) 41 messages, 3 authors, last reply 2024-08-13
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help