[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.3 73/87] hw/net/net_tx_pkt: Fix virtio header without checks
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.3 73/87] hw/net/net_tx_pkt: Fix virtio header without checksum offloading |
Date: |
Wed, 10 Apr 2024 10:22:46 +0300 |
From: Akihiko Odaki <akihiko.odaki@daynix.com>
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>
diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
index 2e5f58b3c9..2134a18c4c 100644
--- a/hw/net/net_tx_pkt.c
+++ b/hw/net/net_tx_pkt.c
@@ -833,6 +833,7 @@ bool net_tx_pkt_send_custom(struct NetTxPkt *pkt, bool
offload,
if (offload || gso_type == VIRTIO_NET_HDR_GSO_NONE) {
if (!offload && pkt->virt_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {
+ pkt->virt_hdr.flags &= ~VIRTIO_NET_HDR_F_NEEDS_CSUM;
net_tx_pkt_do_sw_csum(pkt, &pkt->vec[NET_TX_PKT_L2HDR_FRAG],
pkt->payload_frags +
NET_TX_PKT_PL_START_FRAG - 1,
pkt->payload_len);
--
2.39.2
- [Stable-8.2.3 63/87] trans_rvv.c.inc: set vstart = 0 in int scalar move insns, (continued)
- [Stable-8.2.3 63/87] trans_rvv.c.inc: set vstart = 0 in int scalar move insns, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 62/87] target/riscv/vector_helper.c: set vstart = 0 in GEN_VEXT_VSLIDEUP_VX(), Michael Tokarev, 2024/04/10
- [Stable-8.2.3 65/87] target/riscv: always clear vstart in whole vec move insns, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 66/87] target/riscv/vector_helpers: do early exit when vstart >= vl, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 64/87] target/riscv/vector_helper.c: fix 'vmvr_v' memcpy endianess, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 67/87] target/riscv/vector_helper.c: optimize loops in ldst helpers, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 68/87] hw/intc: Update APLIC IDC after claiming iforce register, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 69/87] target/riscv: rvv: Remove the dependency of Zvfbfmin to Zfbfmin, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 70/87] target/riscv: Fix mode in riscv_tlb_fill, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 72/87] virtio-net: Fix vhost virtqueue notifiers for RSS, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 73/87] hw/net/net_tx_pkt: Fix virtio header without checksum offloading,
Michael Tokarev <=
- [Stable-8.2.3 71/87] target/riscv/kvm: fix timebase-frequency when using KVM acceleration, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 77/87] gitlab-ci/cirrus: switch from 'master' to 'latest', Michael Tokarev, 2024/04/10
- [Stable-8.2.3 76/87] migration/postcopy: Ensure postcopy_start() sets errp if it fails, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 75/87] target/hppa: Clear psw_n for BE on use_nullify_skip path, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 78/87] hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 74/87] tcg/optimize: Fix sign_mask for logical right-shift, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 79/87] target/arm: take HSTR traps of cp15 accesses to EL2, not EL1, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 80/87] hw/net/virtio-net: fix qemu set used ring flag even vhost started, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 81/87] block/virtio-blk: Fix memory leak from virtio_blk_zone_report, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 82/87] migration/postcopy: ensure preempt channel is ready before loading states, Michael Tokarev, 2024/04/10