i40e/i40evf: make IPv6 ATR code clearer
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Tue, 20 Jun 2017 22:16:58 +0000 (15:16 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 26 Jul 2017 10:25:20 +0000 (03:25 -0700)
This just reorders some local vars and makes the code flow
clearer.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.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

index b936febc315a17b3d8db0af05f60938d478edefd..c9a149678926126d14b89ae8f364af71e3e42a10 100644 (file)
@@ -2451,9 +2451,15 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
                hlen = (hdr.network[0] & 0x0F) << 2;
                l4_proto = hdr.ipv4->protocol;
        } else {
-               hlen = hdr.network - skb->data;
-               l4_proto = ipv6_find_hdr(skb, &hlen, IPPROTO_TCP, NULL, NULL);
-               hlen -= hdr.network - skb->data;
+               /* find the start of the innermost ipv6 header */
+               unsigned int inner_hlen = hdr.network - skb->data;
+               unsigned int h_offset = inner_hlen;
+
+               /* this function updates h_offset to the end of the header */
+               l4_proto =
+                 ipv6_find_hdr(skb, &h_offset, IPPROTO_TCP, NULL, NULL);
+               /* hlen will contain our best estimate of the tcp header */
+               hlen = h_offset - inner_hlen;
        }
 
        if (l4_proto != IPPROTO_TCP)