virtio_net: sync rss_trailer.max_tx_vq on queue_pairs change via VQ_PAIRS_SET
Subsystems (3)
PATCH 1/1 virtio_net: sync rss_trailer.max_tx_vq on queue_pairs change via VQ_PAIRS_SET
When netif_is_rxfh_configured() is true (i.e., the user has explicitly configured the RSS indirection table), virtnet_set_queues() skips the RSS update path and falls through to the VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command to change the number of queue pairs. However, it does not update vi->rss_trailer.max_tx_vq to reflect the new queue_pairs value.
This causes a mismatch between vi->curr_queue_pairs and vi->rss_trailer.max_tx_vq. Any subsequent RSS reconfiguration (e.g., via ethtool -X) calls virtnet_commit_rss_command(), which sends the stale max_tx_vq to the device, silently reverting the queue count.
Reproduction:
1. User configured RSS
ethtool -X eth0 equal 8
2. VQ_PAIRS_SET path; max_tx_vq stays 16
ethtool -L eth0 combined 12
3. RSS commit uses max_tx_vq=16 instead of 12
ethtool -X eth0 equal 4
Fix this by updating vi->rss_trailer.max_tx_vq after a successful VQ_PAIRS_SET command when RSS is enabled, keeping it in sync with curr_queue_pairs.
--- drivers/net/virtio_net.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/virtio_net.c +6 -0
@@ -3759,6 +3759,12 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs) queue_pairs);return -EINVAL ; } + +/* Keep max_tx_vq in sync so that a later RSS command does not +* revert queue_pairs to a stale value. +*/ +if (vi->has_rss) + vi->rss_trailer.max_tx_vq =cpu_to_le16 (queue_pairs); succ: vi->curr_queue_pairs = queue_pairs;if (dev->flags &IFF_UP ) {
Signature · 1 line
2.43.0
Paolo Abeni
maintainerQuoted 19 lines · Brett Creeley
When
netif_is_rxfh_configured()is true (i.e., the user has explicitly configured the RSS indirection table),virtnet_set_queues()skips the RSS update path and falls through to theVIRTIO_NET_CTRL_MQ_VQ_PAIRS_SETcommand to change the number of queue pairs. However, it does not updatevi->rss_trailer.max_tx_vqto reflect the newqueue_pairsvalue.This causes a mismatch between
vi->curr_queue_pairsandvi->rss_trailer.max_tx_vq. Any subsequent RSS reconfiguration (e.g., via ethtool -X) callsvirtnet_commit_rss_command(), which sends the stalemax_tx_vqto the device, silently reverting the queue count.Reproduction:
1. User configured RSS
ethtool -X eth0 equal 8
2.VQ_PAIRS_SETpath;max_tx_vqstays 16
ethtool -L eth0 combined 12
3. RSS commit uses max_tx_vq=16 instead of 12
ethtool -X eth0 equal 4
Quoted 7 lines
Fix this by updating
vi->rss_trailer.max_tx_vqafter a successfulVQ_PAIRS_SETcommand when RSS is enabled, keeping it in sync withcurr_queue_pairs.Fixes 50bfcaedd78e ("virtio_net: Update rss when set queue")Assisted-by Claude: claude-opus-4.6Signed-off-by Brett Creeley <[email protected]>
The patch LGTM, but waiting a little longer just in case the virtio crew has some comments.
/P
Quoted 24 lines · Paolo Abeni
Quoted 23 lines · Brett Creeley
When
netif_is_rxfh_configured()is true (i.e., the user has explicitly configured the RSS indirection table),virtnet_set_queues()skips the RSS update path and falls through to theVIRTIO_NET_CTRL_MQ_VQ_PAIRS_SETcommand to change the number of queue pairs. However, it does not updatevi->rss_trailer.max_tx_vqto reflect the newqueue_pairsvalue.This causes a mismatch between
vi->curr_queue_pairsandvi->rss_trailer.max_tx_vq. Any subsequent RSS reconfiguration (e.g., via ethtool -X) callsvirtnet_commit_rss_command(), which sends the stalemax_tx_vqto the device, silently reverting the queue count.Reproduction:
1. User configured RSS
ethtool -X eth0 equal 8
2.VQ_PAIRS_SETpath;max_tx_vqstays 16
ethtool -L eth0 combined 12
3. RSS commit uses max_tx_vq=16 instead of 12
ethtool -X eth0 equal 4Fix this by updating
vi->rss_trailer.max_tx_vqafter a successfulVQ_PAIRS_SETcommand when RSS is enabled, keeping it in sync withcurr_queue_pairs.
Quoted 8 lines
Quoted 3 lines
Fixes 50bfcaedd78e ("virtio_net: Update rss when set queue")Assisted-by Claude: claude-opus-4.6Signed-off-by Brett Creeley <[email protected]>The patch LGTM, but waiting a little longer just in case the virtio crew has some comments.
/P
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Thu, 16 Apr 2026 14:21:21 -0700 you wrote:
When
netif_is_rxfh_configured()is true (i.e., the user has explicitly configured the RSS indirection table),virtnet_set_queues()skips the RSS update path and falls through to theVIRTIO_NET_CTRL_MQ_VQ_PAIRS_SETcommand to change the number of queue pairs. However, it does not updatevi->rss_trailer.max_tx_vqto reflect the newqueue_pairsvalue.
Quoted 6 lines
This causes a mismatch between
vi->curr_queue_pairsandvi->rss_trailer.max_tx_vq. Any subsequent RSS reconfiguration (e.g., via ethtool -X) callsvirtnet_commit_rss_command(), which sends the stalemax_tx_vqto the device, silently reverting the queue count.[...]
Here is the summary with links:
- [net] virtio_net: sync rss_trailer.max_tx_vq on queue_pairs change via VQ_PAIRS_SET
https://git.kernel.org/netdev/net/c/3bc06da858ef
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html