aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/devmem.c
diff options
context:
space:
mode:
authorDragos Tatulea <[email protected]>2025-08-27 14:39:59 +0000
committerJakub Kicinski <[email protected]>2025-08-28 23:05:32 +0000
commit512c88fb0e884cbb4c495b8f3351a9185d1d50b1 (patch)
tree67ad862e10150b40a7c6efdf558b6a1a2c71819f /net/core/devmem.c
parentnet/mlx5e: add op for getting netdev DMA device (diff)
downloadkernel-512c88fb0e884cbb4c495b8f3351a9185d1d50b1.tar.gz
kernel-512c88fb0e884cbb4c495b8f3351a9185d1d50b1.zip
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 <[email protected]> Reviewed-by: Mina Almasry <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
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) {