mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
net: Proxy netdev_queue_get_dma_dev for leased queues
Extend netdev_queue_get_dma_dev to return the physical device of the real rxq for DMA in case the queue was leased. This allows memory providers like io_uring zero-copy or devmem to bind to the physically leased rxq via virtual devices such as netkit. Signed-off-by: David Wei <dw@davidwei.uk> Co-developed-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Link: https://patch.msgid.link/20260115082603.219152-7-daniel@iogearbox.net Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
0caa9a8dde
commit
804bf334d0
|
|
@ -9,16 +9,29 @@
|
||||||
* @dev: net_device
|
* @dev: net_device
|
||||||
* @idx: queue index
|
* @idx: queue index
|
||||||
*
|
*
|
||||||
* Get dma device for zero-copy operations to be used for this queue.
|
* Get dma device for zero-copy operations to be used for this queue. If the
|
||||||
|
* queue is leased to a physical queue, we retrieve the latter's dma device.
|
||||||
* When such device is not available or valid, the function will return NULL.
|
* When such device is not available or valid, the function will return NULL.
|
||||||
*
|
*
|
||||||
* Return: Device or NULL on error
|
* Return: Device or NULL on error
|
||||||
*/
|
*/
|
||||||
struct device *netdev_queue_get_dma_dev(struct net_device *dev, int idx)
|
struct device *netdev_queue_get_dma_dev(struct net_device *dev, int idx)
|
||||||
{
|
{
|
||||||
const struct netdev_queue_mgmt_ops *queue_ops = dev->queue_mgmt_ops;
|
const struct netdev_queue_mgmt_ops *queue_ops;
|
||||||
struct device *dma_dev;
|
struct device *dma_dev;
|
||||||
|
|
||||||
|
if (idx < dev->real_num_rx_queues) {
|
||||||
|
struct netdev_rx_queue *rxq = __netif_get_rx_queue(dev, idx);
|
||||||
|
|
||||||
|
if (rxq->lease) {
|
||||||
|
rxq = rxq->lease;
|
||||||
|
dev = rxq->dev;
|
||||||
|
idx = get_netdev_rx_queue_index(rxq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
queue_ops = dev->queue_mgmt_ops;
|
||||||
|
|
||||||
if (queue_ops && queue_ops->ndo_queue_get_dma_dev)
|
if (queue_ops && queue_ops->ndo_queue_get_dma_dev)
|
||||||
dma_dev = queue_ops->ndo_queue_get_dma_dev(dev, idx);
|
dma_dev = queue_ops->ndo_queue_get_dma_dev(dev, idx);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user