Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6385979 authored by Anjali Singhai's avatar Anjali Singhai Committed by Jeff Kirsher
Browse files

i40e: Fix Rx checksum error counter



The Rx port checksum error counter was incrementing incorrectly with
UDP encapsulated tunneled traffic.  This patch fixes the problem so that
the port_rx_csum counter will show accurate statistics.

Signed-off-by: default avatarAnjali Singhai <anjali.singhai@intel.com>
Signed-off-by: default avatarGreg Rose <gregory.v.rose@intel.com>
Tested-by: default avatarJim Young <james.m.young@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent d91649f5
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -1325,9 +1325,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
	 * so the total length of IPv4 header is IHL*4 bytes
	 * The UDP_0 bit *may* bet set if the *inner* header is UDP
	 */
	if (ipv4_tunnel &&
	    (decoded.inner_prot != I40E_RX_PTYPE_INNER_PROT_UDP) &&
	    !(rx_status & (1 << I40E_RX_DESC_STATUS_UDP_0_SHIFT))) {
	if (ipv4_tunnel) {
		skb->transport_header = skb->mac_header +
					sizeof(struct ethhdr) +
					(ip_hdr(skb)->ihl * 4);
@@ -1337,6 +1335,8 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
					  skb->protocol == htons(ETH_P_8021AD))
					  ? VLAN_HLEN : 0;

		if ((ip_hdr(skb)->protocol == IPPROTO_UDP) &&
		    (udp_hdr(skb)->check != 0)) {
			rx_udp_csum = udp_csum(skb);
			iph = ip_hdr(skb);
			csum = csum_tcpudp_magic(
@@ -1346,6 +1346,8 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,

			if (udp_hdr(skb)->check != csum)
				goto checksum_fail;

		} /* else its GRE and so no outer UDP header */
	}

	skb->ip_summed = CHECKSUM_UNNECESSARY;