Patch "virtio_net: checksum offloading handling fix" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    virtio_net: checksum offloading handling fix

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     virtio_net-checksum-offloading-handling-fix.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6cef338d5e795b3a60c9b4e3881e21fe0e369809
Author: Heng Qi <hengqi@xxxxxxxxxxxxxxxxx>
Date:   Mon Jun 17 21:15:23 2024 +0800

    virtio_net: checksum offloading handling fix
    
    [ Upstream commit 604141c036e1b636e2a71cf6e1aa09d1e45f40c2 ]
    
    In virtio spec 0.95, VIRTIO_NET_F_GUEST_CSUM was designed to handle
    partially checksummed packets, and the validation of fully checksummed
    packets by the device is independent of VIRTIO_NET_F_GUEST_CSUM
    negotiation. However, the specification erroneously stated:
    
      "If VIRTIO_NET_F_GUEST_CSUM is not negotiated, the device MUST set flags
       to zero and SHOULD supply a fully checksummed packet to the driver."
    
    This statement is inaccurate because even without VIRTIO_NET_F_GUEST_CSUM
    negotiation, the device can still set the VIRTIO_NET_HDR_F_DATA_VALID flag.
    Essentially, the device can facilitate the validation of these packets'
    checksums - a process known as RX checksum offloading - removing the need
    for the driver to do so.
    
    This scenario is currently not implemented in the driver and requires
    correction. The necessary specification correction[1] has been made and
    approved in the virtio TC vote.
    [1] https://lists.oasis-open.org/archives/virtio-comment/202401/msg00011.html
    
    Fixes: 4f49129be6fa ("virtio-net: Set RXCSUM feature if GUEST_CSUM is available")
    Signed-off-by: Heng Qi <hengqi@xxxxxxxxxxxxxxxxx>
    Reviewed-by: Jiri Pirko <jiri@xxxxxxxxxx>
    Acked-by: Jason Wang <jasowang@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 32cddb633793d..61cc0ed1ddc13 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3818,8 +3818,16 @@ static int virtnet_probe(struct virtio_device *vdev)
 			dev->features |= dev->hw_features & NETIF_F_ALL_TSO;
 		/* (!csum && gso) case will be fixed by register_netdev() */
 	}
-	if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM))
-		dev->features |= NETIF_F_RXCSUM;
+
+	/* 1. With VIRTIO_NET_F_GUEST_CSUM negotiation, the driver doesn't
+	 * need to calculate checksums for partially checksummed packets,
+	 * as they're considered valid by the upper layer.
+	 * 2. Without VIRTIO_NET_F_GUEST_CSUM negotiation, the driver only
+	 * receives fully checksummed packets. The device may assist in
+	 * validating these packets' checksums, so the driver won't have to.
+	 */
+	dev->features |= NETIF_F_RXCSUM;
+
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
 	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6))
 		dev->features |= NETIF_F_GRO_HW;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux