Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2574047yba; Mon, 6 May 2019 08:12:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxF4KzQLcIHa5uzl9kPqhBaYuQGxsV18nLqkrJPMXO876gebFQNgtBRgg3fxUdGT0Pd4+Wq X-Received: by 2002:a17:902:868e:: with SMTP id g14mr33546101plo.183.1557155525823; Mon, 06 May 2019 08:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557155525; cv=none; d=google.com; s=arc-20160816; b=H3hqWNNgwYO9zR5lBAeBzHDgT6vqajNO5o/4tettTwqpP06EvJDS4N80hmpZHdnuvD nqhBrs4fIYloWu9RHEo1eXKME/wklWaFrpqrv+R44+kEBIOEvbXKKomgDOU+xm2kx9vt 1BZaH8dbCcRADgnovsaCcOUCYcK5g9arSVnVF3MbTKj9WWTc2S24WW1BFACeKZpa/wCz DUf6pfKgaO5JS0Lu2rpyzAysgJhqi4CV51eR2rZXKQaVg2QBvLyxenVKZV5u6cBv4f3K OrbE89X5IBeGCvwqOMYOpO3XeC6yA/OZIra6+yLSd96nlqZeIdFg+HLRQJQlXRNsMnTN ooLQ== 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=Efw1JCD6Ky6TfoDEm1I4cR90rpB277XtohnkyxuBbNA=; b=bEDOhsMJe8h4ZGyZqE7Gm8zgIsx8uqh8VTef4qrkPPECRjH8cK3KJAFA4f1P0kGsXf T0vHA14Bdd0d43SmYP/x+VYw1b38nNyJU6Ous3LtpN5J8yt7rhnZLItyAWPIU9NIt3ne 8YKGgwOE4jKxJ/hf1MZW4vZYgjsQowJwtntL6ru9+00O8OZcMO0vuf2QdBCqsDTqspHb Ep4wuEJG8yGOeDXrAbodjD2NbH58orqZXDKBmrR3ap2ig5tpTf6uFRa/TBZEQOKL5kAA HAAvyyiF63jzbvSfysKAFsGPZgTHtZHLjsAELmHY6F48AzJ0CzFfjoghBEwL4pBf1UE1 LI0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Oy7tBKZT; 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 y24si14999080pga.57.2019.05.06.08.11.49; Mon, 06 May 2019 08:12:05 -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=Oy7tBKZT; 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 S1727015AbfEFOfu (ORCPT + 99 others); Mon, 6 May 2019 10:35:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:55890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726984AbfEFOfm (ORCPT ); Mon, 6 May 2019 10:35:42 -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 AB589204EC; Mon, 6 May 2019 14:35:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153342; bh=9zeHQlPijgcf6JRRmHXC/9ChAO8zIEKZhkj2hr+EehI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oy7tBKZTztXOeWLoWUbfgsgkGlOmiLYtCEjFxvf0AlM9UYMVor7MgUzX2x55L0OXw HE6ctd9tWcc7nYVYaGPd/1BvalYJuz3FgK0lYprTKA0QWAEsYWIPPM5weG4VRxqfn8 7S+VBPNAWcJaw+Ic3nQTYVexiq5v6F5ZAr2u1aBw= 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 (Microsoft)" Subject: [PATCH 5.0 053/122] net: stmmac: dont overwrite discard_frame status Date: Mon, 6 May 2019 16:31:51 +0200 Message-Id: <20190506143059.681026572@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@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 (Microsoft) --- 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 e8855e6adb48..c42ef6c729c0 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