Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Fixes: 50bfcaedd78e ("virtio_net: Update rss when set queue")
Signed-off-by: Brett Creeley <brett.creeley@amd.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://patch.msgid.link/20260416212121.29073-1-brett.creeley@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Brett Creeley and committed by
Jakub Kicinski
3bc06da8 d40831b0

+6
+6
drivers/net/virtio_net.c
··· 3759 3759 queue_pairs); 3760 3760 return -EINVAL; 3761 3761 } 3762 + 3763 + /* Keep max_tx_vq in sync so that a later RSS command does not 3764 + * revert queue_pairs to a stale value. 3765 + */ 3766 + if (vi->has_rss) 3767 + vi->rss_trailer.max_tx_vq = cpu_to_le16(queue_pairs); 3762 3768 succ: 3763 3769 vi->curr_queue_pairs = queue_pairs; 3764 3770 if (dev->flags & IFF_UP) {