]> git.karo-electronics.de Git - linux-beck.git/commitdiff
i40e/i40evf: Fix TSO checksum pseudo-header adjustment
authorAlexander Duyck <aduyck@mirantis.com>
Fri, 18 Mar 2016 23:06:47 +0000 (16:06 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 6 Apr 2016 03:34:51 +0000 (20:34 -0700)
With IPv4 and IPv6 now using the same format for checksums based on the
length of the frame we need to update the i40e and i40evf drivers so that
they correctly account for lengths greater than or equal to 64K.

With this patch the driver should now correctly update checksums for frames
up to 16776960 in length which should be more than large enough for all
possible TSO frames in the near future.

Signed-off-by: Alexander Duyck <aduyck@mirantis.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_txrx.c
drivers/net/ethernet/intel/i40evf/i40e_txrx.c

index 5bef5b0f00d9bce9408b024101470ad15f2303d3..5d5fa5359a1dde67b632254a865d211450ef2c65 100644 (file)
@@ -2304,10 +2304,8 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
                        l4_offset = l4.hdr - skb->data;
 
                        /* remove payload length from outer checksum */
-                       paylen = (__force u16)l4.udp->check;
-                       paylen += ntohs((__force __be16)1) *
-                                       (u16)~(skb->len - l4_offset);
-                       l4.udp->check = ~csum_fold((__force __wsum)paylen);
+                       paylen = skb->len - l4_offset;
+                       csum_replace_by_diff(&l4.udp->check, htonl(paylen));
                }
 
                /* reset pointers to inner headers */
@@ -2327,9 +2325,8 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
        l4_offset = l4.hdr - skb->data;
 
        /* remove payload length from inner checksum */
-       paylen = (__force u16)l4.tcp->check;
-       paylen += ntohs((__force __be16)1) * (u16)~(skb->len - l4_offset);
-       l4.tcp->check = ~csum_fold((__force __wsum)paylen);
+       paylen = skb->len - l4_offset;
+       csum_replace_by_diff(&l4.tcp->check, htonl(paylen));
 
        /* compute length of segmentation header */
        *hdr_len = (l4.tcp->doff * 4) + l4_offset;
index 570348d93e5dc718324d745606fd867c270fd0fb..04aabc52ba0dd9e1e770859a8e6ddfa460067cc0 100644 (file)
@@ -1571,10 +1571,8 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
                        l4_offset = l4.hdr - skb->data;
 
                        /* remove payload length from outer checksum */
-                       paylen = (__force u16)l4.udp->check;
-                       paylen += ntohs((__force __be16)1) *
-                                       (u16)~(skb->len - l4_offset);
-                       l4.udp->check = ~csum_fold((__force __wsum)paylen);
+                       paylen = skb->len - l4_offset;
+                       csum_replace_by_diff(&l4.udp->check, htonl(paylen));
                }
 
                /* reset pointers to inner headers */
@@ -1594,9 +1592,8 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
        l4_offset = l4.hdr - skb->data;
 
        /* remove payload length from inner checksum */
-       paylen = (__force u16)l4.tcp->check;
-       paylen += ntohs((__force __be16)1) * (u16)~(skb->len - l4_offset);
-       l4.tcp->check = ~csum_fold((__force __wsum)paylen);
+       paylen = skb->len - l4_offset;
+       csum_replace_by_diff(&l4.tcp->check, htonl(paylen));
 
        /* compute length of segmentation header */
        *hdr_len = (l4.tcp->doff * 4) + l4_offset;