]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
virtio_net: Sync rss config to device when virtnet_probe
authorPhilo Lu <lulie@linux.alibaba.com>
Mon, 4 Nov 2024 08:57:05 +0000 (16:57 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 7 Nov 2024 11:40:10 +0000 (12:40 +0100)
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 <lulie@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Joe Damato <jdamato@fastly.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/virtio_net.c

index 545dda8ec07754145f895ec44a9b942d6e24ef20..b3232b8baa2569c00af761d0bcb8b008b78fd04d 100644 (file)
@@ -6584,6 +6584,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.