[PATCH RFC net-next 1/2] net: stmmac: dwmac4: accept dribble-only receive frames

Mohd Ayaan Anwar mohd.anwar at oss.qualcomm.com
Mon Nov 23 10:41:45 PST 2026


Commit 1cc5a735185a ("stmmac: do not discard frame on dribbling bit
assert") removed the packet drop condition for descriptors which report
only a dribble error for Normal and Enhanced descriptors, since a
dribble error with the correct FCS doesn't necessarily mean a bad
packet.

Do the same for dwmac4; accept receive frames with dribble-only errors
while still counting them in the error statistics.

Signed-off-by: Mohd Ayaan Anwar <mohd.anwar at oss.qualcomm.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 4 +++-
 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
index c6a8f8d73501..2549ffaf9cef 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
@@ -102,7 +102,9 @@ static int dwmac4_wrback_get_rx_status(struct stmmac_extra_stats *x,
 		if (unlikely(rdes3 & RDES3_DRIBBLE_ERROR))
 			x->dribbling_bit++;
 
-		ret = discard_frame;
+		if ((rdes3 & RDES3_ERROR_SUMMARY_MASK) !=
+		    RDES3_DRIBBLE_ERROR)
+			ret = discard_frame;
 	}
 
 	message_type = FIELD_GET(RDES1_PTP_MSG_TYPE_MASK, rdes1);
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.h
index fb1fea5b0e6e..8e8762f9e0c8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.h
@@ -120,6 +120,7 @@
 #define RDES3_RECEIVE_WATCHDOG		BIT(22)
 #define RDES3_GIANT_PACKET		BIT(23)
 #define RDES3_CRC_ERROR			BIT(24)
+#define RDES3_ERROR_SUMMARY_MASK	GENMASK(24, 19)
 #define RDES3_RDES0_VALID		BIT(25)
 #define RDES3_RDES1_VALID		BIT(26)
 #define RDES3_RDES2_VALID		BIT(27)

-- 
2.34.1




More information about the linux-arm-kernel mailing list