Don't request outer UDP checksum if none was needed.
Instead, rely on offloads set by the tunnel encapsulation code and
inherited from the TSO frame.

Taking a step back, OVS carefully tracks when csum updates are necessary
by marking the packets as L4 checksum partial.
The packet_*complete_csum helpers are only called when a csum is to be
computed.

Replace the UDP checksum presence check with an assert.

Fixes: 2956a612651e ("dp-packet: Rework L4 checksum offloads.")
Signed-off-by: David Marchand <[email protected]>
---
 lib/dp-packet-gso.c | 1 -
 lib/packets.c       | 8 +-------
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/lib/dp-packet-gso.c b/lib/dp-packet-gso.c
index 58b4401f60..362bc8f66d 100644
--- a/lib/dp-packet-gso.c
+++ b/lib/dp-packet-gso.c
@@ -153,7 +153,6 @@ dp_packet_gso(struct dp_packet *p, struct dp_packet_batch 
**batches)
 
             tnl_hdr = dp_packet_l4(seg);
             tnl_hdr->udp_len = htons(dp_packet_l4_size(seg));
-            dp_packet_l4_checksum_set_partial(seg);
         }
 
         if (udp_tnl || gre_tnl) {
diff --git a/lib/packets.c b/lib/packets.c
index a0bb2ad482..e3e5bbc92c 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -2052,13 +2052,8 @@ packet_udp_complete_csum(struct dp_packet *p, bool inner)
         udp_sz = dp_packet_l4_size(p);
     }
 
-    ovs_assert(udp);
     ovs_assert(ip_hdr);
-
-    /* Skip csum calculation if the udp_csum is zero. */
-    if (!udp->udp_csum) {
-        goto out;
-    }
+    ovs_assert(udp && udp->udp_csum);
 
     udp->udp_csum = 0;
     if (IP_VER(((const struct ip_header *) ip_hdr)->ip_ihl_ver) == 4) {
@@ -2077,7 +2072,6 @@ packet_udp_complete_csum(struct dp_packet *p, bool inner)
         udp->udp_csum = htons(0xffff);
     }
 
-out:
     if (inner) {
         dp_packet_inner_l4_checksum_set_good(p);
     } else {
-- 
2.51.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to