From 1cb97d19a1b8abc82b97dc8dc95b16f2498309a0 Mon Sep 17 00:00:00 2001 From: Philo Lu Date: Wed, 26 Feb 2025 22:49:14 +0900 Subject: [PATCH] virtio_net: Sync rss config to device when virtnet_probe BugLink: https://bugs.launchpad.net/bugs/2100292 [ Upstream commit dc749b7b06082ccaacc602e724445da19cd03e9f ] During virtnet_probe, default rss configuration is initialized, but was not committed to the device. This patch fix this by sending rss command after device ready in virtnet_probe. Otherwise, the actual rss configuration used by device can be different with that read by user from driver, which may confuse the user. If the command committing fails, driver rss will be disabled. Fixes: c7114b1249fa ("drivers/net/virtio_net: Added basic RSS support.") Signed-off-by: Philo Lu Signed-off-by: Xuan Zhuo Acked-by: Joe Damato Acked-by: Michael S. Tsirkin Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin [koichiroden: adjusted context due to missing commit: f8befdb21be0 ("virtio_net: Remove rtnl lock protection of command buffers")] Signed-off-by: Koichiro Den Signed-off-by: Stefan Bader --- drivers/net/virtio_net.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index b2a791a56ca8..50329ed9a33c 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -4898,6 +4898,15 @@ static int virtnet_probe(struct virtio_device *vdev) virtio_device_ready(vdev); + if (vi->has_rss || vi->has_rss_hash_report) { + if (!virtnet_commit_rss_command(vi)) { + dev_warn(&vdev->dev, "RSS disabled because committing failed.\n"); + dev->hw_features &= ~NETIF_F_RXHASH; + vi->has_rss_hash_report = false; + vi->has_rss = false; + } + } + _virtnet_set_queues(vi, vi->curr_queue_pairs); /* a random MAC address has been assigned, notify the device.