Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5436075imm; Tue, 16 Oct 2018 10:11:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV62wTmRdTkd75Up62f3dzkPrK4ahZNO6RVbC2OOAu9SIFCBDokQq0Eu8PDU8+MLkeXVqoCeJ X-Received: by 2002:a65:6204:: with SMTP id d4-v6mr20799614pgv.121.1539709894003; Tue, 16 Oct 2018 10:11:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539709893; cv=none; d=google.com; s=arc-20160816; b=FdGqV4FdYAGtSffk6ppStffrAaWOAjN5Cy+kK4jzd/XPhRdu903Mg8DAJTQw7lch/Z Rac1Qp1looBmFg4XcEAWpOK7SW22wFKceiR7kO1dBiGkSiMJJK1edIGnNxl+uP9Empas OzkFxkBwqC5QkMzTwYyCCXHha/yaLarcaKpmcsd4KeDkvU9lVZnwoJh4TSgRMdX9b4e/ +qG2rKHLSibIDUki9x6FssnCK0x9eMTB/GVGWj1XjKhV5KpSbPsok+S97lOYK8wcGgqx r3ONZb38Fol6k+4XWOrAQFrBsiTaYvlq2w5zqk+4O+MfBFlDaXRoognppTf26jIe6eBo 3c2A== 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=dHJYKRNSK9JoWaFV25JFUyq+B3X8RXBeFFIQup6ygLw=; b=bsM/epIpQ3DqsFgDisByoXv5i9LotVamdptS2GjFwyV5ZpKcFlMZSKhIbFRomIKwlw M4KdJJBRj1WdOOKPMHeF/98uVooEiJx36LoZ1RamezMT/DDaCkrgUS3snkc7cKks94A0 767GW6q/52TmLasxoT9WAVgB1vL9YV5SELhrVApKGBNs3AhLx3TpkN4Uo/3Da/N7qktY 2RyEc3+Zk5Gzo6on+nWRUL/fWN8vYCaxpkrhjnCFJZu+XROAUH8HnbXm/hi3jQxfZblQ W56ZZEJW9O1K8qqMGGccgpV1Nr2S008iXklFsj/0mSN7N1kobenfZ9DD00gUe4uSiVqM 2+6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EdjjPOHz; 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 x85-v6si15146957pfk.54.2018.10.16.10.11.18; Tue, 16 Oct 2018 10:11:33 -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=EdjjPOHz; 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 S1727703AbeJQBB6 (ORCPT + 99 others); Tue, 16 Oct 2018 21:01:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:42258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727669AbeJQBB5 (ORCPT ); Tue, 16 Oct 2018 21:01:57 -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 EB85220866; Tue, 16 Oct 2018 17:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539709835; bh=i3z56OuLX6fzgFD9YR14UBCxnzs5IYtoJ/H4roWB2EI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdjjPOHzYv89o7iNWh+0wxfXuYbKDbII9KeiD4GQD8UfDqvnlfOl+YTXiy3M58ZF4 9P2Y1UvL2DoGuM/xEL52MbsRP3w0OSgUE5EpqfO01SgXhvVYED3Q3wMLSr/GC/zoVp mh7A9BP+cWRMT4yQo6g3MqjMMDiZLigCb3B3olOQ= 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.18 013/135] net: mvpp2: Extract the correct ethtype from the skb for tx csum offload Date: Tue, 16 Oct 2018 19:04:03 +0200 Message-Id: <20181016170516.328437839@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170515.447235311@linuxfoundation.org> References: <20181016170515.447235311@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.18-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/mvpp2_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -1725,7 +1725,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; @@ -2600,14 +2600,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 */ @@ -2619,7 +2620,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;