OVS checks a netdev checksum offload capabilities before calling its
transmit helper.
Yet the OVS transmit preparation helper for DPDK drivers requests IP
checksum (setting RTE_MBUF_F_TX_IP_CSUM) regardless of the DPDK driver
support if some L4 checksum is requested.
This is problematic since net/virtio does support L4 checksum offload,
but does not support nor announce IP checksum offload and this DPDK
driver tx prepare helper (calling helper shared with other DPDK drivers)
clears the ip checksum in packet data if RTE_MBUF_F_TX_IP_CSUM is set.
The DPDK mbuf API mandates IP csum when TCP segmentation is requested.
However, IP csum is not required when TCP or other L4 checksum is
requested.
While most DPDK drivers implement both IP and L4 checksums (and this is
likely why the bug was never caught), let's avoid requesting an
unsupported offload.
Reported-at: https://issues.redhat.com/browse/FDP-1666
Link: https://git.dpdk.org/dpdk-stable/tree/drivers/net/virtio/virtio_rxtx.c?h=v24.11.2#n1742
Link: https://git.dpdk.org/dpdk-stable/tree/lib/net/rte_net.h?h=v24.11.2#n179
Fixes: 8b5fe2dc6080 ("userspace: Add Generic Segmentation Offloading.")
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
return false;
}
mbuf->ol_flags |= RTE_MBUF_F_TX_TCP_SEG;
- }
- /* If L4 checksum is requested, IPv4 should be requested as well. */
- if (mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK
- && mbuf->ol_flags & RTE_MBUF_F_TX_IPV4) {
- mbuf->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM;
+ /* DPDK API mandates IPv4 checksum when requesting TSO. */
+ if (IP_VER(ip->ip_ihl_ver) == 4) {
+ mbuf->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM;
+ }
}
return true;