]> git.ipfire.org Git - thirdparty/qemu.git/commit - hw/net/net_tx_pkt.c
hw/net/net_tx_pkt: Fix virtio header without checksum offloading
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Wed, 27 Mar 2024 08:42:56 +0000 (17:42 +0900)
committerJason Wang <jasowang@redhat.com>
Fri, 29 Mar 2024 06:59:07 +0000 (14:59 +0800)
commit89a8de364b51db8107d2a210314431885ac52238
treecdcd766321700b93740540653ae29c917ca73124
parentba6bb2ec953f10751f174b6f7da8fe7e5f008c08
hw/net/net_tx_pkt: Fix virtio header without checksum offloading

It is incorrect to have the VIRTIO_NET_HDR_F_NEEDS_CSUM set when
checksum offloading is disabled so clear the bit.

TCP/UDP checksum is usually offloaded when the peer requires virtio
headers because they can instruct the peer to compute checksum. However,
igb disables TX checksum offloading when a VF is enabled whether the
peer requires virtio headers because a transmitted packet can be routed
to it and it expects the packet has a proper checksum. Therefore, it
is necessary to have a correct virtio header even when checksum
offloading is disabled.

A real TCP/UDP checksum will be computed and saved in the buffer when
checksum offloading is disabled. The virtio specification requires to
set the packet checksum stored in the buffer to the TCP/UDP pseudo
header when the VIRTIO_NET_HDR_F_NEEDS_CSUM bit is set so the bit must
be cleared in that case.

Fixes: ffbd2dbd8e64 ("e1000e: Perform software segmentation for loopback")
Buglink: https://issues.redhat.com/browse/RHEL-23067
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/net/net_tx_pkt.c