]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
i40e: Add support for ATR w/ IPv6 extension headers
authorAlexander Duyck <aduyck@mirantis.com>
Tue, 26 Jan 2016 03:32:54 +0000 (19:32 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 10 Mar 2016 16:37:43 +0000 (08:37 -0800)
Orabug: 22342532

This patch updates the code for determining the L4 protocol and L3 header
length so that when IPv6 extension headers are being used we can determine
the offset and type of the L4 protocol.

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>
(cherry picked from commit ffcc55c0c2a85835a4ac080bc1053c3a277b88e2)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/intel/i40e/i40e_txrx.c

index 5ac11534ce4fad34c419df80153852c2fe56df11..f6fdda4c7876f3058289d17a4526de57fd502847 100644 (file)
@@ -2043,7 +2043,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
        struct tcphdr *th;
        unsigned int hlen;
        u32 flex_ptype, dtype_cmd;
-       u8 l4_proto;
+       int l4_proto;
        u16 i;
 
        /* make sure ATR is enabled */
@@ -2061,25 +2061,23 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
        if (!(tx_flags & (I40E_TX_FLAGS_IPV4 | I40E_TX_FLAGS_IPV6)))
                return;
 
-       if (!(tx_flags & I40E_TX_FLAGS_UDP_TUNNEL)) {
-               /* snag network header to get L4 type and address */
-               hdr.network = skb_network_header(skb);
+       /* snag network header to get L4 type and address */
+       hdr.network = (tx_flags & I40E_TX_FLAGS_UDP_TUNNEL) ?
+                     skb_inner_network_header(skb) : skb_network_header(skb);
 
+       /* Note: tx_flags gets modified to reflect inner protocols in
+        * tx_enable_csum function if encap is enabled.
+        */
+       if (tx_flags & I40E_TX_FLAGS_IPV4) {
                /* access ihl as u8 to avoid unaligned access on ia64 */
-               if (tx_flags & I40E_TX_FLAGS_IPV4)
-                       hlen = (hdr.network[0] & 0x0F) << 2;
-               else
-                       hlen = sizeof(struct ipv6hdr);
+               hlen = (hdr.network[0] & 0x0F) << 2;
+               l4_proto = hdr.ipv4->protocol;
        } else {
-               hdr.network = skb_inner_network_header(skb);
-               hlen = skb_inner_network_header_len(skb);
+               hlen = hdr.network - skb->data;
+               l4_proto = ipv6_find_hdr(skb, &hlen, IPPROTO_TCP, NULL, NULL);
+               hlen -= hdr.network - skb->data;
        }
 
-       /* Note: tx_flags gets modified to reflect inner protocols in
-        * tx_enable_csum function if encap is enabled.
-        */
-       l4_proto = (tx_flags & I40E_TX_FLAGS_IPV4) ? hdr.ipv4->protocol :
-                                                    hdr.ipv6->nexthdr;
        if (l4_proto != IPPROTO_TCP)
                return;