2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

userspace TSO: Include UDP checksum offload.

Virtio doesn't expose flags to control which protocols checksum
offload needs to be enabled or disabled. This patch checks if the
NIC supports UDP checksum offload and active it when TSO is enabled.

Reported-by: Ilya Maximets <i.maximets@ovn.org>
Fixes: 29cf9c1b3b ("userspace: Add TCP Segmentation Offload support")
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Flavio Leitner
2020-02-14 10:03:35 -03:00
committed by Ilya Maximets
parent 514950d37d
commit 8c5163fe81
4 changed files with 35 additions and 11 deletions

View File

@@ -791,6 +791,8 @@ static bool
netdev_send_prepare_packet(const uint64_t netdev_flags,
struct dp_packet *packet, char **errormsg)
{
uint64_t l4_mask;
if (dp_packet_hwol_is_tso(packet)
&& !(netdev_flags & NETDEV_TX_OFFLOAD_TCP_TSO)) {
/* Fall back to GSO in software. */
@@ -798,11 +800,25 @@ netdev_send_prepare_packet(const uint64_t netdev_flags,
return false;
}
if (dp_packet_hwol_l4_mask(packet)
&& !(netdev_flags & NETDEV_TX_OFFLOAD_TCP_CKSUM)) {
/* Fall back to L4 csum in software. */
VLOG_ERR_BUF(errormsg, "No L4 checksum support");
l4_mask = dp_packet_hwol_l4_mask(packet);
if (l4_mask) {
if (dp_packet_hwol_l4_is_tcp(packet)) {
if (!(netdev_flags & NETDEV_TX_OFFLOAD_TCP_CKSUM)) {
/* Fall back to TCP csum in software. */
VLOG_ERR_BUF(errormsg, "No TCP checksum support");
return false;
}
} else if (dp_packet_hwol_l4_is_udp(packet)) {
if (!(netdev_flags & NETDEV_TX_OFFLOAD_UDP_CKSUM)) {
/* Fall back to UDP csum in software. */
VLOG_ERR_BUF(errormsg, "No UDP checksum support");
return false;
}
} else {
VLOG_ERR_BUF(errormsg, "No L4 checksum support: mask: %"PRIu64,
l4_mask);
return false;
}
}
return true;