diff options
author | Flavio Leitner <fbl@sysclose.org> | 2020-02-14 10:03:35 -0300 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2020-02-26 15:24:15 +0100 |
commit | 8c5163fe81ea05313eaefcd61cf036dd3fd2ae07 (patch) | |
tree | 7dd2e81cf3f42b8b8592b498a0850eb0c508a22d /lib/netdev.c | |
parent | 514950d37dabebbdfa40ddf87596a7293de2d87c (diff) | |
download | openvswitch-8c5163fe81ea05313eaefcd61cf036dd3fd2ae07.tar.gz |
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: 29cf9c1b3b9c ("userspace: Add TCP Segmentation Offload support")
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib/netdev.c')
-rw-r--r-- | lib/netdev.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/netdev.c b/lib/netdev.c index f95b19af4..a55f77961 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -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; |