Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2746355imj; Mon, 11 Feb 2019 07:53:27 -0800 (PST) X-Google-Smtp-Source: AHgI3IYoXb9XfJzQGlQggmCgMcUlx4ZwwiKdmRxQtxALs4yH0Pg6l20mBGl/n/EKg6Tnlx6DV9GE X-Received: by 2002:a63:5343:: with SMTP id t3mr268185pgl.415.1549900407223; Mon, 11 Feb 2019 07:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900407; cv=none; d=google.com; s=arc-20160816; b=NQZwsPLzssi6eBzcxQYcdZKnfW3L6ahkZt59MC8c+ailx/vHscnFh8D+WYaH+K8BbB GNmUPCtHV0zL9/tFwLXrdo9oU7dD26TD0qmGWh4v45Jbj7OclkFffdAr5N2adIHBcd7J wad9/rAsgAC7zEJkbhqDwCrFN+ZP6aKOVjot+gmm0xIFPAQ99EmzyDA1kjA5zmNQuHpr WyDOvJqiEQrRHeVdfPdO2W6x+qTGoax0oQVkvCghnceYwxHSBki9/M+r3VZpP9nZC0vR KEEzfu4VooM8A/3tZ6bOx3ZU1sIdMt15zaj7Fq2xa0/WPEa2rg1jD9c4J9rcWgmFMaBQ LxMg== 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=JXzapkvGwlg5E35Klfk23rzhHNvZUPChvDwBOKfuQxM=; b=qoPliHAV/xtxbiZozK1cnvynZ7zkbZ9/ctXPNUULeslORVL/TyvM8IIRrqCNUhaM1b tYzs8KduEphr1Vn4Ov73tTUYxSEZ3YXkAvvPQZK6MXfw6cMOn+SrHzs1zlfd63bHbjFy 6RX9yROrvP/Waq/tIPfB1MZwncTxOEyzKwlx3O3qt1OFRyThZisqetSFP//batSHwYCH h2Iwhu4Piju3KBjL8i+HD5h4CMu7m1/9oS7hgS8Lyw6hHMqjqKFKBipJv86Do018VLNG WenEzobr0DG69vB57ASeBqCDg/Y50SpRRqPgJ0sW942dZEewGR562anvoldtSyJ1TWBE Hw8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YlTHtwMs; 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 k16si4568702pls.124.2019.02.11.07.53.10; Mon, 11 Feb 2019 07:53:27 -0800 (PST) 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=YlTHtwMs; 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 S1731473AbfBKOhe (ORCPT + 99 others); Mon, 11 Feb 2019 09:37:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:46838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731455AbfBKOh3 (ORCPT ); Mon, 11 Feb 2019 09:37:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 73CFB2081B; Mon, 11 Feb 2019 14:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895848; bh=jRUwISIauTvwSHxdK4s5y0CaoC8URZ5leSdqrQACeh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YlTHtwMs8WDHWmqeW2v98qoF+IaP60uKCIv8caspV/sJWTzbtIXtGdc+DFjv8E5L3 XG1vIKQLYhuhCTO4tZohhpUfMFjaz1jvi/MdpsS2g+gZkpGKK5WHnwIzmLpeocIihM y+NbkO6jYmhgOzoTk1mcZ0zrBiO/NvjjFkLrqVXo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Tariq Toukan , Nikola Ciprich , Cong Wang , Saeed Mahameed Subject: [PATCH 4.20 312/352] net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames Date: Mon, 11 Feb 2019 15:18:59 +0100 Message-Id: <20190211141906.684824003@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cong Wang [ Upstream commit e8c8b53ccaff568fef4c13a6ccaf08bf241aa01a ] When an ethernet frame is padded to meet the minimum ethernet frame size, the padding octets are not covered by the hardware checksum. Fortunately the padding octets are usually zero's, which don't affect checksum. However, we have a switch which pads non-zero octets, this causes kernel hardware checksum fault repeatedly. Prior to: commit '88078d98d1bb ("net: pskb_trim_rcsum() and CHECKSUM_COMPLETE ...")' skb checksum was forced to be CHECKSUM_NONE when padding is detected. After it, we need to keep skb->csum updated, like what we do for RXFCS. However, fixing up CHECKSUM_COMPLETE requires to verify and parse IP headers, it is not worthy the effort as the packets are so small that CHECKSUM_COMPLETE can't save anything. Fixes: 88078d98d1bb ("net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"), Cc: Eric Dumazet Cc: Tariq Toukan Cc: Nikola Ciprich Signed-off-by: Cong Wang Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *s ((struct ipv6hdr *)ip_p)->nexthdr; } +#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN) + static inline void mlx5e_handle_csum(struct net_device *netdev, struct mlx5_cqe64 *cqe, struct mlx5e_rq *rq, @@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(str if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) goto csum_unnecessary; + /* CQE csum doesn't cover padding octets in short ethernet + * frames. And the pad field is appended prior to calculating + * and appending the FCS field. + * + * Detecting these padded frames requires to verify and parse + * IP headers, so we simply force all those small frames to be + * CHECKSUM_UNNECESSARY even if they are not padded. + */ + if (short_frame(skb->len)) + goto csum_unnecessary; + if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) goto csum_unnecessary;