Offloading checksum with a virtio_net_hdr header works only for L4.
Remove false claim that IP checksum offloading is supported.

As a consequence, L3 checksum can be assumed to be correct when
preparing a L4 offload request.

Fixes: 3337e6d91c5b ("userspace: Enable L4 checksum offloading by default.")
Signed-off-by: David Marchand <[email protected]>
---
Note: this issue was first noticed while natting IP packets received from
a DPDK port (reporting that the packet IP checksum was correct) and
sending those packets to a tap netdev.

---
 lib/netdev-linux.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index c316238cd5..765a07e355 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -1061,8 +1061,7 @@ netdev_linux_construct_tap(struct netdev *netdev_)
 
     if (tap_supports_vnet_hdr
         && ioctl(netdev->tap_fd, TUNSETOFFLOAD, oflags) == 0) {
-        netdev_->ol_flags |= (NETDEV_TX_OFFLOAD_IPV4_CKSUM
-                              | NETDEV_TX_OFFLOAD_TCP_CKSUM
+        netdev_->ol_flags |= (NETDEV_TX_OFFLOAD_TCP_CKSUM
                               | NETDEV_TX_OFFLOAD_UDP_CKSUM);
 
         if (userspace_tso_enabled()) {
@@ -2510,13 +2509,11 @@ netdev_linux_set_ol(struct netdev *netdev_)
         char *string;
         uint32_t value;
     } t_list[] = {
-        {"tx-checksum-ipv4", NETDEV_TX_OFFLOAD_IPV4_CKSUM |
-                             NETDEV_TX_OFFLOAD_TCP_CKSUM |
+        {"tx-checksum-ipv4", NETDEV_TX_OFFLOAD_TCP_CKSUM |
                              NETDEV_TX_OFFLOAD_UDP_CKSUM},
         {"tx-checksum-ipv6", NETDEV_TX_OFFLOAD_TCP_CKSUM |
                              NETDEV_TX_OFFLOAD_UDP_CKSUM},
-        {"tx-checksum-ip-generic", NETDEV_TX_OFFLOAD_IPV4_CKSUM |
-                                   NETDEV_TX_OFFLOAD_TCP_CKSUM |
+        {"tx-checksum-ip-generic", NETDEV_TX_OFFLOAD_TCP_CKSUM |
                                    NETDEV_TX_OFFLOAD_UDP_CKSUM},
         {"tx-checksum-sctp", NETDEV_TX_OFFLOAD_SCTP_CKSUM},
         {"tx-tcp-segmentation", NETDEV_TX_OFFLOAD_TCP_TSO},
@@ -7203,13 +7200,6 @@ netdev_linux_prepend_vnet_hdr(struct dp_packet *b, int 
mtu)
         /* The packet has good L4 checksum. No need to validate again. */
         vnet->csum_start = vnet->csum_offset = (OVS_FORCE __virtio16) 0;
         vnet->flags = VIRTIO_NET_HDR_F_DATA_VALID;
-
-        /* It is possible that L4 is good but the IPv4 checksum isn't
-         * complete. For example in the case of UDP encapsulation of an ARP
-         * packet where the UDP checksum is 0. */
-        if (dp_packet_hwol_l3_csum_ipv4_ol(b)) {
-            dp_packet_ip_set_header_csum(b, false);
-        }
     } else if (dp_packet_hwol_tx_l4_checksum(b)) {
         /* The csum calculation is offloaded. */
         if (dp_packet_hwol_l4_is_tcp(b)) {
-- 
2.45.2

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

Reply via email to