Re: [PATCH net-next v11 03/14] net: Add lease info to queue-get response

Jakub Kicinski
2026-04-08T03:40:19Z

On Fri, 3 Apr 2026 01:10:20 +0200 Daniel Borkmann wrote:
> +struct netdev_rx_queue *
> +__netif_get_rx_queue_lease(struct net_device **dev, unsigned int *rxq_idx,
> + enum netif_lease_dir dir)
> +{
> + struct net_device *orig_dev = *dev;
> + struct netdev_rx_queue *rxq = __netif_get_rx_queue(orig_dev, *rxq_idx);
> +
> + if (rxq->lease) {
> + if (!netif_lease_dir_ok(orig_dev, dir))
> + return NULL;
> + rxq = rxq->lease;
> + *rxq_idx = get_netdev_rx_queue_index(rxq);
> + *dev = rxq->dev;
> + }
> + return rxq;
> +}
> +
> +struct netdev_rx_queue *
> +netif_get_rx_queue_lease_locked(struct net_device **dev, unsigned int *rxq_idx)
> +{
> + struct net_device *orig_dev = *dev;
> + struct netdev_rx_queue *rxq;
> +
> + /* Locking order is always from the virtual to the physical device
> + * see netdev_nl_queue_create_doit().
> + */
> + netdev_ops_assert_locked(orig_dev);
> + rxq = __netif_get_rx_queue_lease(dev, rxq_idx, NETIF_VIRT_TO_PHYS);
> + if (rxq && orig_dev != *dev)
> + netdev_lock(*dev);
> + return rxq;
> +}
> +
> +void netif_put_rx_queue_lease_locked(struct net_device *orig_dev,
> + struct net_device *dev)
> +{
> + if (orig_dev != dev)
> + netdev_unlock(dev);
> +}

Pretty sure I already complained about these ugly helpers.
I'll try to find the time tomorrow to come up with something better.