Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2555143yba; Mon, 6 May 2019 07:58:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+yh7PTCELOhxTV+oUoKFKXx4z8XXqfk4nwTzBHXCB94a2Fh7YT4AyMYomS1RDtHiT+m98 X-Received: by 2002:a62:e117:: with SMTP id q23mr33914527pfh.60.1557154683896; Mon, 06 May 2019 07:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557154683; cv=none; d=google.com; s=arc-20160816; b=b/Pnb3Xf0p6FguKp8VQL/GFGAF7oF5dqC8wTz4Yu4Wt5HasKmuhD+POIoiiCS5XBue gMug0yGJ8nKxSp5x+qTMUopO19vK9MYQyiVCS4gcT5KL5JXCxcu2IAHAbf98ZQ3Y6lxk y3MOdTbMp5dejameybuLuST5KIHAjh1LtebqM33q1nFE5GkKrewK4pJDGVKrRni4UkFN 33spw9jNF4vOSXuJDHCyRZ8Q16Cyy7KY5iA6TtuptO7+wA4PgER5F/C+Qfjtzc+y4+Mk 2DjwuGnsFUUa5L6Z7TK0asPNuaa2P48ccWC/KZavAgt+INl1SfsVNdwXjTT/4Td4k/eD tarQ== 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=gR9pVaV4l0RjyJ0KP3XJk5CA6SGpcnjWNz8XL2QkWog=; b=V7udy7y9JIbRbnqjhmfhkhSMEAPOYVSKhsXM3PE3uVYph+cCrhrgVazZeU68cqkmq5 0Ten+Oh/BlrRgoOv4taNpMmgtWrypMPrDDYk8LOd5l7MaMRksLSgUZ0KkqgO4or18UI1 vw3ZEey1c6zSSqIPGZFsIRZMpzhbe5XI9+/3j+7cD9otx/Nfi6wC5ZfwK1Zu5n/5TN34 hbqghW+IzZyK7TX+b1a6/CeU6/R4GQFYVmZ7jlFTy03Io1D3c8dO+6mn79+D7OnkPuNI kane2Eo6u5YWV4WcoaE9VleJsxZgRLFe4oYaR7oIP4DgntlDdUZgiCEZEo5zrrzC/yXq an9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QPPXc3aP; 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 a11si14698671plp.306.2019.05.06.07.57.48; Mon, 06 May 2019 07:58:03 -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=QPPXc3aP; 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 S1728503AbfEFOpD (ORCPT + 99 others); Mon, 6 May 2019 10:45:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:41510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728879AbfEFOpA (ORCPT ); Mon, 6 May 2019 10:45:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 055E72053B; Mon, 6 May 2019 14:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153899; bh=dSgiSJOkgwKJOQchPPXosPfklzC3ZKRtMnVJZJRghE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPPXc3aPzHA+HGC5f3ACERaVAv3tpkcRbnLKKdR4U+7j/gCwzYSKsFPxHTF6+m0yl mXNBq3VDJNwqJ/nCSiCDl9pE109zEFmWMTbygQzyUJvbNLCc/4jvaktgbeR4d9pzb4 n9XhiVv/5VGwLzA6/PdgsjyKWY2S4uKkaL0vwibA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaro Koskinen , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 37/75] net: stmmac: dont overwrite discard_frame status Date: Mon, 6 May 2019 16:32:45 +0200 Message-Id: <20190506143056.578889905@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143053.287515952@linuxfoundation.org> References: <20190506143053.287515952@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit 1b746ce8b397e58f9e40ce5c63b7198de6930482 ] If we have error bits set, the discard_frame status will get overwritten by checksum bit checks, which might set the status back to good one. Fix by checking the COE status only if the frame is good. Signed-off-by: Aaro Koskinen Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c index acd65a4f94d4..cdfe9a350ac0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c @@ -231,9 +231,10 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, * It doesn't match with the information reported into the databook. * At any rate, we need to understand if the CSUM hw computation is ok * and report this info to the upper layers. */ - ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), - !!(rdes0 & RDES0_FRAME_TYPE), - !!(rdes0 & ERDES0_RX_MAC_ADDR)); + if (likely(ret == good_frame)) + ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), + !!(rdes0 & RDES0_FRAME_TYPE), + !!(rdes0 & ERDES0_RX_MAC_ADDR)); if (unlikely(rdes0 & RDES0_DRIBBLING)) x->dribbling_bit++; -- 2.20.1