]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge branch 'netkit-support-for-io_uring-zero-copy-and-af_xdp'
authorJakub Kicinski <kuba@kernel.org>
Fri, 10 Apr 2026 01:24:34 +0000 (18:24 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 10 Apr 2026 01:24:35 +0000 (18:24 -0700)
Daniel Borkmann says:

====================
netkit: Support for io_uring zero-copy and AF_XDP

Containers use virtual netdevs to route traffic from a physical netdev
in the host namespace. They do not have access to the physical netdev
in the host and thus can't use memory providers or AF_XDP that require
reconfiguring/restarting queues in the physical netdev.

This patchset adds the concept of queue leasing to virtual netdevs that
allow containers to use memory providers and AF_XDP at native speed.
Leased queues are bound to a real queue in a physical netdev and act
as a proxy.

Memory providers and AF_XDP operations take an ifindex and queue id,
so containers would pass in an ifindex for a virtual netdev and a queue
id of a leased queue, which then gets proxied to the underlying real
queue.

We have implemented support for this concept in netkit and tested the
latter against Nvidia ConnectX-6 (mlx5) as well as Broadcom BCM957504
(bnxt_en) 100G NICs. For more details see the individual patches.
====================

Link: https://patch.msgid.link/20260402231031.447597-1-daniel@iogearbox.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1  2 
net/core/netdev_rx_queue.c
net/xdp/xsk.c

index 05fd2875d72591483e99fffec56e84048c9f8e77,1d6e7e47bf0a775a1fbb8413ecde1ac287ab26c6..469319451ba29e597f27bd0d0d851f42d7aeaa0b
@@@ -117,15 -211,6 +211,9 @@@ static int __netif_mp_open_rxq(struct n
        struct netdev_rx_queue *rxq;
        int ret;
  
-       if (rxq_idx >= dev->real_num_rx_queues) {
-               NL_SET_ERR_MSG(extack, "rx queue index out of range");
-               return -ERANGE;
-       }
-       rxq_idx = array_index_nospec(rxq_idx, dev->real_num_rx_queues);
 +      if (!qops)
 +              return -EOPNOTSUPP;
 +
        if (dev->cfg->hds_config != ETHTOOL_TCP_DATA_SPLIT_ENABLED) {
                NL_SET_ERR_MSG(extack, "tcp-data-split is disabled");
                return -EINVAL;
diff --cc net/xdp/xsk.c
index c8ef9e427c9cd5bc1ae717c9d3ae458367807552,fe1c7899455e7719a0d0285ed535cd5ceb560d18..60be6561f48657362249e875839a514b02f07215
@@@ -334,11 -382,9 +382,10 @@@ static int xsk_rcv_check(struct xdp_soc
  {
        if (!xsk_is_bound(xs))
                return -ENXIO;
-       if (xs->dev != xdp->rxq->dev || xs->queue_id != xdp->rxq->queue_index)
+       if (!xsk_dev_queue_valid(xs, xdp->rxq))
                return -EINVAL;
 -      if (len > xsk_pool_get_rx_frame_size(xs->pool) && !xs->sg) {
 +
 +      if (len > __xsk_pool_get_rx_frame_size(xs->pool) && !xs->sg) {
                xs->rx_dropped++;
                return -ENOSPC;
        }