Skip to contentSkip to conversation

veth: use peer attributes to set peer real number of queues

PATCH Applied Eric Dumazet 3 participants 3 messages Oct 16 – Oct 20

Subsystems (2)
lore
Share & tools
lore

Eric Dumazet

author maintainer
#0 lore raw

PATCH 1/1 veth: use peer attributes to set peer real number of queues

veth_newlink() creates the peer from its own attributes (tbp), which come from the nested VETH_INFO_PEER ifinfomsg when present, so the peer num_tx_queues/num_rx_queues follow the peer IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES.

veth_init_queues(peer, ...) is then called with the attributes of the first device (tb) instead, so the decision to reduce the peer to a single real queue is based on the wrong device:

ip link add va type veth peer vb numtxqueues 4

	-> vb has 4 tx queues, but only 1 real tx queue.

ip link add va numtxqueues 4 type veth peer vb

	-> vb keeps nr_possible_cpus real tx queues.

Pass tbp, which is tb when no peer attributes were given.

Fixes 9d3684c24a52 ("veth: create by default nr_possible_cpus queues")
Cc Qiliang Yuan <[email protected]>
---
 drivers/net/veth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/veth.c +1 -1
index 38f263d4f06b406eaf0a801334272cd438386c14..ba8953fef979aac3868d39c8fb9b19becb47d8e9 100644
@@ -1924,7 +1924,7 @@ static int veth_newlink(struct net_device *dev,
 	priv = netdev_priv(peer);
 	rcu_assign_pointer(priv->peer, dev);
 	netdev_hold(dev, &priv->peer_tracker, GFP_KERNEL);
-	err = veth_init_queues(peer, tb);
+	err = veth_init_queues(peer, tbp);
 	if (err)
 		goto err_peer_queues;
 
Signature · 1 line
2.53.0
Tested-by Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Eric Dumazet

veth_newlink() creates the peer from its own attributes (tbp), which come from the nested VETH_INFO_PEER ifinfomsg when present, so the peer num_tx_queues/num_rx_queues follow the peer IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES.

veth_init_queues(peer, ...) is then called with the attributes of the first device (tb) instead, so the decision to reduce the peer to a single real queue is based on the wrong device:

ip link add va type veth peer vb numtxqueues 4

        -> vb has 4 tx queues, but only 1 real tx queue.
Quoted 8 lines

ip link add va numtxqueues 4 type veth peer vb

        -> vb keeps nr_possible_cpus real tx queues.

Pass tbp, which is tb when no peer attributes were given.

Fixes 9d3684c24a52 ("veth: create by default nr_possible_cpus queues")
Cc Qiliang Yuan <[email protected]>

Thanks.

#2 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Fri, 16 Oct 2026 18:03:51 +0200 you wrote:

veth_newlink() creates the peer from its own attributes (tbp), which come from the nested VETH_INFO_PEER ifinfomsg when present, so the peer num_tx_queues/num_rx_queues follow the peer IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES.

veth_init_queues(peer, ...) is then called with the attributes of the first device (tb) instead, so the decision to reduce the peer to a single real queue is based on the wrong device:

[...]

Here is the summary with links:
- [net-next] veth: use peer attributes to set peer real number of queues

    https://git.kernel.org/netdev/net-next/c/267bc3f113d8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html