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

Daniel Borkmann
2026-04-08T09:10:02Z

On 4/8/26 5:40 AM, Jakub Kicinski wrote:
> 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.

Ok, sounds good. Happy to adapt if you find something better and then I'll
work this into the series, and also integrate the things mentioned in my
cover letter reply (netkit nl dump + additional tests).

Thanks,
Daniel