[PATCH net-next v9 1/5] net: devmem: rename tx_vec to vec in dmabuf binding

Bobby Eshleman
2026-01-10T02:19:01Z

From: Bobby Eshleman <bobbyeshleman@meta.com>

Rename the 'tx_vec' field in struct net_devmem_dmabuf_binding to 'vec'.
This field holds pointers to net_iov structures. The rename prepares for
reusing 'vec' for both TX and RX directions.

No functional change intended.

Reviewed-by: Mina Almasry <almasrymina@google.com>
Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com>
---
net/core/devmem.c | 22 +++++++++++-----------
net/core/devmem.h | 2 +-
2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/net/core/devmem.c b/net/core/devmem.c
index ec4217d6c0b4..05a9a9e7abb9 100644
--- a/net/core/devmem.c
+++ b/net/core/devmem.c
@@ -75,7 +75,7 @@ void __net_devmem_dmabuf_binding_free(struct work_struct *wq)
dma_buf_detach(binding->dmabuf, binding->attachment);
dma_buf_put(binding->dmabuf);
xa_destroy(&binding->bound_rxqs);
- kvfree(binding->tx_vec);
+ kvfree(binding->vec);
kfree(binding);
}

@@ -232,10 +232,10 @@ net_devmem_bind_dmabuf(struct net_device *dev,
}

if (direction == DMA_TO_DEVICE) {
- binding->tx_vec = kvmalloc_array(dmabuf->size / PAGE_SIZE,
- sizeof(struct net_iov *),
- GFP_KERNEL);
- if (!binding->tx_vec) {
+ binding->vec = kvmalloc_array(dmabuf->size / PAGE_SIZE,
+ sizeof(struct net_iov *),
+ GFP_KERNEL);
+ if (!binding->vec) {
err = -ENOMEM;
goto err_unmap;
}
@@ -249,7 +249,7 @@ net_devmem_bind_dmabuf(struct net_device *dev,
dev_to_node(&dev->dev));
if (!binding->chunk_pool) {
err = -ENOMEM;
- goto err_tx_vec;
+ goto err_vec;
}

virtual = 0;
@@ -295,7 +295,7 @@ net_devmem_bind_dmabuf(struct net_device *dev,
page_pool_set_dma_addr_netmem(net_iov_to_netmem(niov),
net_devmem_get_dma_addr(niov));
if (direction == DMA_TO_DEVICE)
- binding->tx_vec[owner->area.base_virtual / PAGE_SIZE + i] = niov;
+ binding->vec[owner->area.base_virtual / PAGE_SIZE + i] = niov;
}

virtual += len;
@@ -315,8 +315,8 @@ net_devmem_bind_dmabuf(struct net_device *dev,
gen_pool_for_each_chunk(binding->chunk_pool,
net_devmem_dmabuf_free_chunk_owner, NULL);
gen_pool_destroy(binding->chunk_pool);
-err_tx_vec:
- kvfree(binding->tx_vec);
+err_vec:
+ kvfree(binding->vec);
err_unmap:
dma_buf_unmap_attachment_unlocked(binding->attachment, binding->sgt,
direction);
@@ -363,7 +363,7 @@ struct net_devmem_dmabuf_binding *net_devmem_get_binding(struct sock *sk,
int err = 0;

binding = net_devmem_lookup_dmabuf(dmabuf_id);
- if (!binding || !binding->tx_vec) {
+ if (!binding || !binding->vec) {
err = -EINVAL;
goto out_err;
}
@@ -414,7 +414,7 @@ net_devmem_get_niov_at(struct net_devmem_dmabuf_binding *binding,
*off = virt_addr % PAGE_SIZE;
*size = PAGE_SIZE - *off;

- return binding->tx_vec[virt_addr / PAGE_SIZE];
+ return binding->vec[virt_addr / PAGE_SIZE];
}

/*** "Dmabuf devmem memory provider" ***/
diff --git a/net/core/devmem.h b/net/core/devmem.h
index 0b43a648cd2e..1ea6228e4f40 100644
--- a/net/core/devmem.h
+++ b/net/core/devmem.h
@@ -63,7 +63,7 @@ struct net_devmem_dmabuf_binding {
* address. This array is convenient to map the virtual addresses to
* net_iovs in the TX path.
*/
- struct net_iov **tx_vec;
+ struct net_iov **vec;

struct work_struct unbind_w;
};

--
2.47.3