Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5451095imm; Tue, 16 Oct 2018 10:24:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Mp/eQffBVbS7MpZQzapXnigVZ9FJRtTS3md9TpaTdbuo+sjw7S2/xcfhdUjsVfZd3zUIS X-Received: by 2002:a17:902:b104:: with SMTP id q4-v6mr22364494plr.238.1539710685011; Tue, 16 Oct 2018 10:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710684; cv=none; d=google.com; s=arc-20160816; b=iPTHa2LZ69d2QjRexv6yjNRgoJ57tsSV2FLAqpYk4HPlkzwiPkDzcmgw2Mp2Tg9h+k Uli1xf2ktJei82d44ns5tDaocM6KxouUWEMfOjbfV0eQ4KU8lQWg7twWiXhCIWJWgT16 6nXYRNLQhS9mPBTpWVe+izFPhvTeTREBSJvLDA9NV0EMceO7jqwUh+SGtnPl5QevULRz p708XVfpkGicV7DDig8ybpQIstT0m8AQz31Y9pF0y7CgEnhenD7BqgxUc7qKpjprBF37 jI2+g7NoItgDvTp7KlzJ6orSYLjr9Fl6cb3SnnP8/5iBPb1fvLWFKJ1eP+UkY3qosb8W Xr/A== 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=eKmtEr4a3RauDOhjJcINS3ZU9/wa8ZOty5ZotBT2Zpg=; b=UADZ2m1o50Rw822oweuocXymmZtNJlj8I/CkPpAKsyGrXKsS0vBu4bnclrJqoEH0EA gUu8NUZe8W+TxWYI49bizTN/YFVpD3O+UyxJsuhBtsl/tj2W7HZ6aa0V0X2T8iKvPcte W/ULK/R5YVgaeVbL4q85D+zjt4+IiTT32oxmuZuG1IkEqW/bDx1CeVt42wVjQTbqAzcU E2CF6nLxJxzT1m9xukXM3hs0JIVQ9YAJMiQTAnLH6ExlBEBlyP6nH9Ab1JEMIHuJcNYI V+OJETnHF11DDGyUJyPqQWbLCI1vmH809NQIUA6s/AMUj5P0a4TADmeD3tHMY/wlR+7Z iPtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PqTWrWqu; 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 j19-v6si14407411pgh.198.2018.10.16.10.24.29; Tue, 16 Oct 2018 10:24:44 -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=PqTWrWqu; 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 S1731581AbeJQBPd (ORCPT + 99 others); Tue, 16 Oct 2018 21:15:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:34140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBPc (ORCPT ); Tue, 16 Oct 2018 21:15:32 -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 AD62E20866; Tue, 16 Oct 2018 17:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710646; bh=xif6/rsCwGyWrJnxPSZJ1ix2oelyAS3W0bdQQXb3rIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PqTWrWqunbzFF4QPLVpNg9QrPO40hY/md/5Nf7IVzvr5+OJTA/D2hv0x+GzqnJm8u 2eP45MCllGF4eREIj8nARNKKKTF+KD9UVSXCHmkHASqbAcsenSfn8+xFCasMPfiAco IJSYWY2a2JZjIM7MwK+8JIgGR2vBaiIK34h2Px8o= 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.9 38/71] net: mvpp2: Extract the correct ethtype from the skb for tx csum offload Date: Tue, 16 Oct 2018 19:09:35 +0200 Message-Id: <20181016170541.300836352@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@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.9-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 @@ -4266,7 +4267,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; @@ -5019,14 +5020,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 */ @@ -5038,7 +5040,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;