]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
i40e: Add UDP segmentation offload support
authorJosh Hunt <johunt@akamai.com>
Fri, 11 Oct 2019 16:53:40 +0000 (12:53 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 30 Oct 2019 04:11:49 +0000 (21:11 -0700)
Based on a series from Alexander Duyck this change adds UDP segmentation
offload support to the i40e driver.

CC: Alexander Duyck <alexander.h.duyck@intel.com>
CC: Willem de Bruijn <willemb@google.com>
Signed-off-by: Josh Hunt <johunt@akamai.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_txrx.c

index 141575ada5889141bd6c639d6bdb0d08d2d73b75..b3d7edbb1389edf1c11d4b5aec9d03aa586c9625 100644 (file)
@@ -12931,6 +12931,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
                          NETIF_F_GSO_IPXIP6            |
                          NETIF_F_GSO_UDP_TUNNEL        |
                          NETIF_F_GSO_UDP_TUNNEL_CSUM   |
+                         NETIF_F_GSO_UDP_L4            |
                          NETIF_F_SCTP_CRC              |
                          NETIF_F_RXHASH                |
                          NETIF_F_RXCSUM                |
index e3f29dc8b290a4ead38bcffe62cdb947bdfcf48f..b8496037ef7ff45ceac040bc57ec851840215aaa 100644 (file)
@@ -2960,10 +2960,16 @@ static int i40e_tso(struct i40e_tx_buffer *first, u8 *hdr_len,
 
        /* remove payload length from inner checksum */
        paylen = skb->len - l4_offset;
-       csum_replace_by_diff(&l4.tcp->check, (__force __wsum)htonl(paylen));
 
-       /* compute length of segmentation header */
-       *hdr_len = (l4.tcp->doff * 4) + l4_offset;
+       if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
+               csum_replace_by_diff(&l4.udp->check, (__force __wsum)htonl(paylen));
+               /* compute length of segmentation header */
+               *hdr_len = sizeof(*l4.udp) + l4_offset;
+       } else {
+               csum_replace_by_diff(&l4.tcp->check, (__force __wsum)htonl(paylen));
+               /* compute length of segmentation header */
+               *hdr_len = (l4.tcp->doff * 4) + l4_offset;
+       }
 
        /* pull values out of skb_shinfo */
        gso_size = skb_shinfo(skb)->gso_size;