Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/net/core/netdev_queues.c
29280 views
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
3
#include <net/netdev_queues.h>
4
5
/**
6
* netdev_queue_get_dma_dev() - get dma device for zero-copy operations
7
* @dev: net_device
8
* @idx: queue index
9
*
10
* Get dma device for zero-copy operations to be used for this queue.
11
* When such device is not available or valid, the function will return NULL.
12
*
13
* Return: Device or NULL on error
14
*/
15
struct device *netdev_queue_get_dma_dev(struct net_device *dev, int idx)
16
{
17
const struct netdev_queue_mgmt_ops *queue_ops = dev->queue_mgmt_ops;
18
struct device *dma_dev;
19
20
if (queue_ops && queue_ops->ndo_queue_get_dma_dev)
21
dma_dev = queue_ops->ndo_queue_get_dma_dev(dev, idx);
22
else
23
dma_dev = dev->dev.parent;
24
25
return dma_dev && dma_dev->dma_mask ? dma_dev : NULL;
26
}
27
28
29