]> git.ipfire.org Git - thirdparty/qemu.git/commit
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)
committerMichael Tokarev <mjt@tls.msk.ru>
Sun, 31 Mar 2024 19:13:04 +0000 (22:13 +0300)
commitd3e9e0fb29d35bb1a97cf348a99d82b29bae5d86
treecae8a3e8bf9f2695f23d79b1c5654a3587041cc9
parent12e4886108358b36050acc243b17a0a5e07c184e
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>
(cherry picked from commit 89a8de364b51db8107d2a210314431885ac52238)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/net/net_tx_pkt.c