]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.117/net-stmmac-don-t-overwrite-discard_frame-status.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.117 / net-stmmac-don-t-overwrite-discard_frame-status.patch
1 From 4cf6345dd90f3c3d69f6971768224453d1cf0e14 Mon Sep 17 00:00:00 2001
2 From: Aaro Koskinen <aaro.koskinen@nokia.com>
3 Date: Wed, 27 Mar 2019 22:35:38 +0200
4 Subject: net: stmmac: don't overwrite discard_frame status
5
6 [ Upstream commit 1b746ce8b397e58f9e40ce5c63b7198de6930482 ]
7
8 If we have error bits set, the discard_frame status will get overwritten
9 by checksum bit checks, which might set the status back to good one.
10 Fix by checking the COE status only if the frame is good.
11
12 Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 Signed-off-by: Sasha Levin <sashal@kernel.org>
15 ---
16 drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 7 ++++---
17 1 file changed, 4 insertions(+), 3 deletions(-)
18
19 diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
20 index acd65a4f94d4..cdfe9a350ac0 100644
21 --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
22 +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
23 @@ -231,9 +231,10 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x,
24 * It doesn't match with the information reported into the databook.
25 * At any rate, we need to understand if the CSUM hw computation is ok
26 * and report this info to the upper layers. */
27 - ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR),
28 - !!(rdes0 & RDES0_FRAME_TYPE),
29 - !!(rdes0 & ERDES0_RX_MAC_ADDR));
30 + if (likely(ret == good_frame))
31 + ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR),
32 + !!(rdes0 & RDES0_FRAME_TYPE),
33 + !!(rdes0 & ERDES0_RX_MAC_ADDR));
34
35 if (unlikely(rdes0 & RDES0_DRIBBLING))
36 x->dribbling_bit++;
37 --
38 2.20.1
39