summaryrefslogtreecommitdiff
path: root/net/core/devmem.c
diff options
context:
space:
mode:
authorDragos Tatulea <dtatulea@nvidia.com>2025-08-27 17:39:59 +0300
committerJakub Kicinski <kuba@kernel.org>2025-08-28 16:05:32 -0700
commit512c88fb0e884cbb4c495b8f3351a9185d1d50b1 (patch)
tree67ad862e10150b40a7c6efdf558b6a1a2c71819f /net/core/devmem.c
parentf1debf1a2ef44ca1baa15a0cc088cb2be1f95449 (diff)
net: devmem: pull out dma_dev out of net_devmem_bind_dmabuf
Fetch the DMA device before calling net_devmem_bind_dmabuf() and pass it on as a parameter. This is needed for an upcoming change which will read the DMA device per queue. This patch has no functional changes. Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com> Reviewed-by: Mina Almasry <almasrymina@google.com> Link: https://patch.msgid.link/20250827144017.1529208-7-dtatulea@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/devmem.c')
-rw-r--r--net/core/devmem.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/core/devmem.c b/net/core/devmem.c
index c58b24128727..d9de31a6cc7f 100644
--- a/net/core/devmem.c
+++ b/net/core/devmem.c
@@ -176,30 +176,28 @@ err_close_rxq:
struct net_devmem_dmabuf_binding *
net_devmem_bind_dmabuf(struct net_device *dev,
+ struct device *dma_dev,
enum dma_data_direction direction,
unsigned int dmabuf_fd, struct netdev_nl_sock *priv,
struct netlink_ext_ack *extack)
{
struct net_devmem_dmabuf_binding *binding;
static u32 id_alloc_next;
- struct device *dma_dev;
struct scatterlist *sg;
struct dma_buf *dmabuf;
unsigned int sg_idx, i;
unsigned long virtual;
int err;
- dmabuf = dma_buf_get(dmabuf_fd);
- if (IS_ERR(dmabuf))
- return ERR_CAST(dmabuf);
-
- dma_dev = netdev_queue_get_dma_dev(dev, 0);
if (!dma_dev) {
- err = -EOPNOTSUPP;
NL_SET_ERR_MSG(extack, "Device doesn't support DMA");
- goto err_put_dmabuf;
+ return ERR_PTR(-EOPNOTSUPP);
}
+ dmabuf = dma_buf_get(dmabuf_fd);
+ if (IS_ERR(dmabuf))
+ return ERR_CAST(dmabuf);
+
binding = kzalloc_node(sizeof(*binding), GFP_KERNEL,
dev_to_node(&dev->dev));
if (!binding) {