Print this page
16884 viona TSO should better handle csum offloads
        
*** 34,43 ****
--- 34,44 ----
   * http://www.illumos.org/license/CDDL.
   *
   * Copyright 2015 Pluribus Networks Inc.
   * Copyright 2019 Joyent, Inc.
   * Copyright 2024 Oxide Computer Company
+  * Copyright 2024 MNX Cloud, Inc.
   */
  
  
  #include <sys/types.h>
  #include <sys/smt.h>
*** 382,394 ****
          /*
           * We ignore hdr_len because the spec says it can't be
           * trusted. Besides, our own stack will determine the header
           * boundary.
           */
!         if ((link->l_cap_csum & HCKSUM_INET_PARTIAL) != 0 &&
!             (hdr->vrh_gso_type & VIRTIO_NET_HDR_GSO_TCPV4) != 0 &&
              ftype == ETHERTYPE_IP) {
                  uint16_t        *cksump;
                  uint32_t        cksum;
                  ipaddr_t        src = ipha->ipha_src;
                  ipaddr_t        dst = ipha->ipha_dst;
  
--- 383,395 ----
          /*
           * We ignore hdr_len because the spec says it can't be
           * trusted. Besides, our own stack will determine the header
           * boundary.
           */
!         if ((hdr->vrh_gso_type & VIRTIO_NET_HDR_GSO_TCPV4) != 0 &&
              ftype == ETHERTYPE_IP) {
+                 if ((link->l_cap_csum & HCKSUM_INET_PARTIAL) != 0) {
                          uint16_t        *cksump;
                          uint32_t        cksum;
                          ipaddr_t        src = ipha->ipha_src;
                          ipaddr_t        dst = ipha->ipha_dst;
  
*** 409,418 ****
--- 410,420 ----
                          cksum = IP_TCP_CSUM_COMP;
                          cksum += (dst >> 16) + (dst & 0xFFFF) +
                              (src >> 16) + (src & 0xFFFF);
                          cksum = (cksum & 0xFFFF) + (cksum >> 16);
                          *(cksump) = (cksum & 0xFFFF) + (cksum >> 16);
+                 }
  
                  /*
                   * Since viona is a "legacy device", the data stored
                   * by the driver will be in the guest's native endian
                   * format (see sections 2.4.3 and 5.1.6.1 of the