]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
i40e/i40evf: Refactor tunnel interpretation
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Mon, 18 Apr 2016 18:33:41 +0000 (11:33 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 7 Jul 2016 17:41:20 +0000 (10:41 -0700)
Orabug: 23176970

Refactor the interpretation of a tunnel.  This removes
some code and lets us start using the hardware's parsing.

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

index cdd452ac6f727e0800182501fb8de34be08c8bb5..6254b24dff5bbf8dbaaee6667a94cfc10102063c 100644 (file)
@@ -1391,7 +1391,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
                                    u16 rx_ptype)
 {
        struct i40e_rx_ptype_decoded decoded = decode_rx_desc_ptype(rx_ptype);
-       bool ipv4, ipv6, ipv4_tunnel, ipv6_tunnel;
+       bool ipv4, ipv6, tunnel = false;
 
        skb->ip_summed = CHECKSUM_NONE;
 
@@ -1440,14 +1440,13 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
         * doesn't make it a hard requirement so if we have validated the
         * inner checksum report CHECKSUM_UNNECESSARY.
         */
-
-       ipv4_tunnel = (rx_ptype >= I40E_RX_PTYPE_GRENAT4_MAC_PAY3) &&
-                    (rx_ptype <= I40E_RX_PTYPE_GRENAT4_MACVLAN_IPV6_ICMP_PAY4);
-       ipv6_tunnel = (rx_ptype >= I40E_RX_PTYPE_GRENAT6_MAC_PAY3) &&
-                    (rx_ptype <= I40E_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4);
+       if (decoded.inner_prot & (I40E_RX_PTYPE_INNER_PROT_TCP |
+                                 I40E_RX_PTYPE_INNER_PROT_UDP |
+                                 I40E_RX_PTYPE_INNER_PROT_SCTP))
+               tunnel = true;
 
        skb->ip_summed = CHECKSUM_UNNECESSARY;
-       skb->csum_level = ipv4_tunnel || ipv6_tunnel;
+       skb->csum_level = tunnel ? 1 : 0;
 
        return;
 
index ed7e92cf34c8fd49bc1a55ddc2f53ef4a3e3a507..24ae0977b35a43e03134b3a722c1165cda1fe1a3 100644 (file)
@@ -863,7 +863,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
                                    u16 rx_ptype)
 {
        struct i40e_rx_ptype_decoded decoded = decode_rx_desc_ptype(rx_ptype);
-       bool ipv4, ipv6, ipv4_tunnel, ipv6_tunnel;
+       bool ipv4, ipv6, tunnel = false;
 
        skb->ip_summed = CHECKSUM_NONE;
 
@@ -912,14 +912,13 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
         * doesn't make it a hard requirement so if we have validated the
         * inner checksum report CHECKSUM_UNNECESSARY.
         */
-
-       ipv4_tunnel = (rx_ptype >= I40E_RX_PTYPE_GRENAT4_MAC_PAY3) &&
-                    (rx_ptype <= I40E_RX_PTYPE_GRENAT4_MACVLAN_IPV6_ICMP_PAY4);
-       ipv6_tunnel = (rx_ptype >= I40E_RX_PTYPE_GRENAT6_MAC_PAY3) &&
-                    (rx_ptype <= I40E_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4);
+       if (decoded.inner_prot & (I40E_RX_PTYPE_INNER_PROT_TCP |
+                                 I40E_RX_PTYPE_INNER_PROT_UDP |
+                                 I40E_RX_PTYPE_INNER_PROT_SCTP))
+               tunnel = true;
 
        skb->ip_summed = CHECKSUM_UNNECESSARY;
-       skb->csum_level = ipv4_tunnel || ipv6_tunnel;
+       skb->csum_level = tunnel ? 1 : 0;
 
        return;