linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aaro Koskinen <aaro.koskinen@iki.fi>
To: "David S. Miller" <davem@davemloft.net>,
	Jose Abreu <joabreu@synopsys.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Aaro Koskinen <aaro.koskinen@nokia.com>
Subject: [PATCH 4/6] net: stmmac: don't overwrite discard_frame status
Date: Wed, 27 Mar 2019 22:35:38 +0200	[thread overview]
Message-ID: <20190327203540.1884-5-aaro.koskinen@iki.fi> (raw)
In-Reply-To: <20190327203540.1884-1-aaro.koskinen@iki.fi>

From: Aaro Koskinen <aaro.koskinen@nokia.com>

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 <aaro.koskinen@nokia.com>
---
 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.17.0


  parent reply	other threads:[~2019-03-27 20:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27 20:35 [PATCH 0/6] net: stmmac: fix handling of oversized frames Aaro Koskinen
2019-03-27 20:35 ` [PATCH 1/6] net: stmmac: use correct DMA buffer size in the RX descriptor Aaro Koskinen
2019-03-29 10:02   ` Jose Abreu
2019-03-29 10:48     ` Aaro Koskinen
2019-03-27 20:35 ` [PATCH 2/6] net: stmmac: ratelimit RX error logs Aaro Koskinen
2019-03-27 20:35 ` [PATCH 3/6] net: stmmac: don't stop NAPI processing when dropping a packet Aaro Koskinen
2019-03-27 20:35 ` Aaro Koskinen [this message]
2019-03-27 20:35 ` [PATCH 5/6] net: stmmac: fix dropping of multi-descriptor RX frames Aaro Koskinen
2019-03-27 20:35 ` [PATCH 6/6] net: stmmac: don't log oversized frames Aaro Koskinen
2019-03-29  0:10 ` [PATCH 0/6] net: stmmac: fix handling of " David Miller
2019-03-31 21:01 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190327203540.1884-5-aaro.koskinen@iki.fi \
    --to=aaro.koskinen@iki.fi \
    --cc=aaro.koskinen@nokia.com \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=joabreu@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).