Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2233649imm; Thu, 18 Oct 2018 11:07:21 -0700 (PDT) X-Google-Smtp-Source: ACcGV60hrH6GnsMkJYOsfxGPYLtrT7MDRWKWk2DyXd6ywWF4I0yYk0eIF515d569zv9T5r+Rc4BY X-Received: by 2002:a63:5605:: with SMTP id k5-v6mr29807255pgb.189.1539886041111; Thu, 18 Oct 2018 11:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539886041; cv=none; d=google.com; s=arc-20160816; b=JeTAKiS2zniTTgkZEN8Cuin/+lX0HUPwjSqb+1RlfC+pM/rXBBvTf2enloLVgPQxlc yst3GJmGrek0mK3YmDRGuth631WoHaR8i1LCylqtELw2Rp81qnNUxnliQmbVQ2S4cizn /yk0fzE/DW3i0BYXXTnnAjdnADLkfb2nQYmZjxnChWG8jftKE3gHjiFInykhSs4JGBtD 34JO6WiX/KKLSXZfBQmZnTI0PS51o3M6Urz/KLY+oG5OxIP32wEcdQaVmg7EgnUlyaLA 8V6vi1ub+hKwY6qlsUB3xtaSv45EKE+jMiPfYgYLITGKOboXCKUn72E8GVEghXD4X+oZ LS3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2JL/HCr8f2LNp1fvgzH4ubhMafKYasj+Gi8SvaoFAYs=; b=eV5iYQgLArmldfPJkoJqsZXCXJjLFFeQyneGbskmVf+eijHaUgKDEuNp5wqZ924+PP JPrenaKhqmMO17QrjB3ba7C9noOyaSNycA3SaDlhGArecK9oaL8vYwLSiR3BpanD62s+ XbHLnicFJGih2JroYYrWzjGSPYzTQGIxw8CvPYvc2n0uFi3sgXmjgS2gi9bgNIbh6kqH 0siSw5hcdUGuD+R6AzjZHQe/XcHBadXuChu4g75z0WwQFt2fG9Gee4dTW8i/Q7e07ynV qZK2xmRgbpEc7Pzpd6mmmavFAh254gFZVnlR4Ol8PjV9DHvuiJa1p7dulB071A6LSR5U Q1yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BDzsclXL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15-v6si21626889pgg.433.2018.10.18.11.07.05; Thu, 18 Oct 2018 11:07:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BDzsclXL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730378AbeJSCIF (ORCPT + 99 others); Thu, 18 Oct 2018 22:08:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:56940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729763AbeJSCIE (ORCPT ); Thu, 18 Oct 2018 22:08:04 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CFEE920658; Thu, 18 Oct 2018 18:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885956; bh=BcgVR2o4Bq7dIhCVzE1qmTNsRD+D85kLmih/OECb0yY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BDzsclXLaxKBTdIKjB5dFivK0MM4efkAHeSwkY533QIS1rLJKd9UOVp3mPZcMmNx3 uGS+eT/zeaxyDb/xy5Tc1OOVIzl8NTNqOAagO/dfT1Y5ToMwdpmSPuF1Alyog6JxYD 2jQ/Vyu8K90ihmDcV1fDz7Cej3Y3m+lt/7ywVEFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Chevallier , "David S. Miller" Subject: [PATCH 4.4 28/48] net: mvpp2: Extract the correct ethtype from the skb for tx csum offload Date: Thu, 18 Oct 2018 19:55:03 +0200 Message-Id: <20181018175429.482969698@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175427.133690306@linuxfoundation.org> References: <20181018175427.133690306@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maxime Chevallier [ Upstream commit 35f3625c21852ad839f20c91c7d81c4c1101e207 ] When offloading the L3 and L4 csum computation on TX, we need to extract the l3_proto from the ethtype, independently of the presence of a vlan tag. The actual driver uses skb->protocol as-is, resulting in packets with the wrong L4 checksum being sent when there's a vlan tag in the packet header and checksum offloading is enabled. This commit makes use of vlan_protocol_get() to get the correct ethtype regardless the presence of a vlan tag. Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") Signed-off-by: Maxime Chevallier Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/marvell/mvpp2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -4268,7 +4269,7 @@ static void mvpp2_txq_desc_put(struct mv } /* Set Tx descriptors fields relevant for CSUM calculation */ -static u32 mvpp2_txq_desc_csum(int l3_offs, int l3_proto, +static u32 mvpp2_txq_desc_csum(int l3_offs, __be16 l3_proto, int ip_hdr_len, int l4_proto) { u32 command; @@ -5032,14 +5033,15 @@ static u32 mvpp2_skb_tx_csum(struct mvpp if (skb->ip_summed == CHECKSUM_PARTIAL) { int ip_hdr_len = 0; u8 l4_proto; + __be16 l3_proto = vlan_get_protocol(skb); - if (skb->protocol == htons(ETH_P_IP)) { + if (l3_proto == htons(ETH_P_IP)) { struct iphdr *ip4h = ip_hdr(skb); /* Calculate IPv4 checksum and L4 checksum */ ip_hdr_len = ip4h->ihl; l4_proto = ip4h->protocol; - } else if (skb->protocol == htons(ETH_P_IPV6)) { + } else if (l3_proto == htons(ETH_P_IPV6)) { struct ipv6hdr *ip6h = ipv6_hdr(skb); /* Read l4_protocol from one of IPv6 extra headers */ @@ -5051,7 +5053,7 @@ static u32 mvpp2_skb_tx_csum(struct mvpp } return mvpp2_txq_desc_csum(skb_network_offset(skb), - skb->protocol, ip_hdr_len, l4_proto); + l3_proto, ip_hdr_len, l4_proto); } return MVPP2_TXD_L4_CSUM_NOT | MVPP2_TXD_IP_CSUM_DISABLE;