🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16323

[PATCH net v3 2/3] net: stmmac: dwmac1000: don't discard frames with only a checksum error

#16323
From: Christian Schmidbauer
Date: Sat, 14 Nov 2026 13:36
71 lines
14264 bytes
On dwmac1000 with enhanced descriptors, the hardware sets the Error
Summary (ES) bit of the Rx descriptor not only for L2 errors but also
for an L3/L4 checksum error. enh_desc_get_rx_status() returns
discard_frame whenever ES is set, and since commit 1b746ce8b397 ("net:
stmmac: don't overwrite discard_frame status") the checksum status is
only evaluated for good frames.

Return discard_frame only when ES comes with one of the L2 error bits.
A frame with only a checksum error is then reported as csum_none and
reaches the stack as CHECKSUM_NONE, so the stack verifies the checksum
itself. This matches dwmac4, whose Error Summary bit does not cover
checksum errors.

RDES0 bit 7 is not in the mask, because depending on the core and on
Rx checksum offload it reports a timestamp, an IP header checksum error
or a giant frame, and enh_desc_get_rx_status() cannot tell which. In
threshold Rx mode, a giant frame that fits one buffer therefore reaches
the stack with a verified FCS.

Also remove the pr_err that enh_desc_get_rx_status() prints when bit 7
is set. Once the MAC stops dropping checksum-error frames, any host on
the link can flood the kernel log by sending frames with a bad IPv4
header checksum.

This prepares for setting DMA_CONTROL_DT, which makes the MAC deliver
checksum-error frames instead of dropping them in its Rx FIFO.

Fixes: 1b746ce8b397 ("net: stmmac: don't overwrite discard_frame status")
Cc: <stable@vger.kernel.org> # 6.6.x: ee0aace5f844: net: stmmac: Correctly handle Rx checksum offload errors
Cc: <stable@vger.kernel.org> # 6.6.x
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christian Schmidbauer <opensource@grische.xyz>
---
v2:
- Drop RDES0_LENGTH_ERROR from the mask of Error Summary bits. The
  length check further down already discards such a frame.
- Explain in the commit message why RDES0 bit 7 is not treated as an
  L2 error.
v1: https://lore.kernel.org/netdev/20261020190319.884375-1-opensource@grische.xyz/
 drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index 7ece8d4157a8..d0622f2605aa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -216,9 +216,6 @@ static int enh_desc_get_rx_status(struct stmmac_extra_stats *x,
 		if (unlikely(rdes0 & RDES0_OVERFLOW_ERROR))
 			x->rx_gmac_overflow++;
 
-		if (unlikely(rdes0 & RDES0_IPC_CSUM_ERROR))
-			pr_err("\tIPC Csum Error/Giant frame\n");
-
 		if (unlikely(rdes0 & RDES0_COLLISION))
 			x->rx_collision++;
 		if (unlikely(rdes0 & RDES0_RECEIVE_WATCHDOG))
@@ -230,7 +227,10 @@ static int enh_desc_get_rx_status(struct stmmac_extra_stats *x,
 		if (unlikely(rdes0 & RDES0_CRC_ERROR)) {
 			x->rx_crc_errors++;
 		}
-		ret = discard_frame;
+		if (rdes0 & (RDES0_DESCRIPTOR_ERROR | RDES0_OVERFLOW_ERROR |
+			     RDES0_COLLISION | RDES0_RECEIVE_WATCHDOG |
+			     RDES0_MII_ERROR | RDES0_CRC_ERROR))
+			ret = discard_frame;
 	}
 
 	/* After a payload csum error, the ES bit is set.
-- 
2.54.0
Technical Details
Message-ID: <20261114133640.3285413-3-opensource@grische.xyz>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363290-linux-kernel-netdev=dewy.ru
References: <20261114133640.3285413-1-opensource@grische.xyz>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363290-linux-kernel-netdev=dewy.ru
From: opensource@grische.xyz (Christian Schmidbauer)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 2/3] net: stmmac: dwmac1000: don't discard frames with only a checksum error
Date: Sat, 14 Nov 2026 14:36:38 +0100
Organization: Usenet Network
Message-ID: <20261114133640.3285413-3-opensource@grische.xyz>
References: <20261114133640.3285413-1-opensource@grische.xyz>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1579846"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BSkxY1fwkoVmPuNdjAFX5TaGIfI= sha256:HZ6XCIupDs6GfWqkXj/ZAKtKynfx6TGziP88I1b+ncw=
	sha1:p2uAsZwJgUXvU52OhPCJ9xQdXFA= sha256:07wEZOyUfSbogXwtFmTIjAU860vgAf303utKzFXXTGc=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 28AAC1147CF; Sat, 14 Nov 2026 16:37:55 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.542
X-Spam-Status: No, score=-2.542 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FROM_SUSPICIOUS_NTLD=0.499,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	T_PDS_OTHER_BAD_TLD=0.01] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=grische.xyz
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id aaGLInT2pFtG;
	Sat, 14 Nov 2026 16:37:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-363290-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=grische.xyz
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 8559111481D; Sat, 14 Nov 2026 16:37:34 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 7A1482BB03; Sat, 14 Nov 2026 13:37:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794663413;
	b=KFIas4mYbActRxyiwniB89BM1vzYkvm2K5ujpFE1Xd4tcYzEKPd396HjihayXhEXzw9O
	 GEueo/wSan8OMP2ROLlNGDruoC6Xcm+ikCGhLb42h1bMBD9qJJopiOd3le50DVfFZf8Wm
	 XAPD43k4Enq+7wFltz2FELOxpXA+mLraWn1Me3dEaJ/qQ9rWYAiPAQwEf57odSC7YCKLY
	 xFHEuD+tX09oCexl2IGZY9YR+y08mYXuXIBa2NJVLJPqW3ltYDRo2DzsIdSYHYM4oEj8G
	 bDbpFK1+4/XBlz4CeTXCCfelH4r7KDwv5xyS73EWBqMqHM1dYqyCgbgyjqyzvsPOgeQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794663413;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=nxrZJxHUg2O9j8zi4wkVtSZmuc/DWB6+tE9tT3nYX8c=;
	b=eR3F3ewQxI0GaYmzoF5e5l777gp8jOYqGligkCTX2ZuwADyn/ncce0DVAlspOvSB27rP
	 FjwFUdL+n/MU7eI48C24hgCmIcJGo4JB5yyQqXR1EAo+/y6YAvkZjTtKu9RxxTCSWwe9N
	 Zz3+XzZMY4NzWr8azbRd7JbutOm3Nyo9HCe/ADUVPdohYnyY88aMv6vI5JA/1ycw1hjbh
	 zfAgXPTIvMmZm3/tQ208FDdw/p7Kn06ZmMApLhZxaHF0FZQtNtLV7iyTVWO9cUGqH+9AF
	 Mt419rGNthvI00SxRJrDHtClSAuuKnjU1O89LZqgXRPBfBtJlIXSdEMLoQjZ7TS5imQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=grische.xyz header.i=@grische.xyz header.a=rsa-sha256 header.s=google header.b=MNy13gTL;
	dmarc=pass header.from=grische.xyz;
	spf=pass smtp.mailfrom=grische.xyz;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 90D5D606A33B;
	Sat, 14 Nov 2026 13:36:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=grische.xyz header.i=@grische.xyz header.a=rsa-sha256 header.s=google header.b=MNy13gTL
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.44
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794663407;
	b=zuN5+SDFDN2dKrpXuGvPV0fT84z63QAzI0dP2xvHm98QH6iT9qzkaGr4ouBYjKCpv2y+
	 UdD4jJbPMej5LlV8gT6k50q5fbpWO0oVg841WwxITjaGd3TJs9wMbjJbrBM9mPCALg/IR
	 KSk76kBY+6EYIkqsFM2/0yTp76AshZ7Bu5PDElsoGjp0ygQrD8xrxj8lM+MiQ2vcdSZTe
	 DsQz1LLkgIHDZsrXFH7ptmqKvpIa9QzAQYqBKi32RzQ7nN1o4U727+urlCc52iz+R2yo9
	 c+poHa+rcAOUB4sMclCKNFRZE9U2ymY1hf7oyDBkbk+n4aAdGzflZa0viUh8owHYbBA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794663407;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=nxrZJxHUg2O9j8zi4wkVtSZmuc/DWB6+tE9tT3nYX8c=;
	b=nPGWLr5zoXE2kEX2LABvt6qUVpIj31T7V48hMlk28IrqdSrSmU4WtExyUpGCwYDqD1Un
	 7TE0xG0LiUDcV0jFoIlbIlu1Umbz+Dcdee7B+yRjWrjAgjoLRewo3f937yoiPrNputCPD
	 Rj6qD+0FQ+RQJOXd6a4WgBCbdSLrxl4J5KR+SEDErarh6udsYQ5D11vRO3ZV3Yk24ItpR
	 C7YeKjJxnZcq88gh1HRGutXMUypfHpWKpnhwfiNNRnBmwQIakuPr7/0S/6GJ9GElmJFcp
	 6mzttuLA7Q7S3V169a9MjvH4RfLiA/YOIexWwYkxYTEl7YitRxC4PxiR8XhltunEFLA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=grische.xyz;
	spf=pass smtp.mailfrom=grische.xyz;
	dkim=pass header.d=grische.xyz header.i=@grische.xyz header.a=rsa-sha256 header.s=google header.b=MNy13gTL;
	arc=none smtp.remote-ip=209.85.221.44
X-Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 524C4606A891
	for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 13:36:47 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 524C4606A891
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=grische.xyz
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=grische.xyz
X-Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-48e10a70540so962692f8f.1
        for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 05:36:47 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=grische.xyz; s=google; t=1794663406; x=1795268206; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=nxrZJxHUg2O9j8zi4wkVtSZmuc/DWB6+tE9tT3nYX8c=;
        b=MNy13gTLmC76O2NwWxzMLq2bD2NcAS2Lmb+Fa3QAE5m3tgPQDQl/dmDgGSBdSkVSXM
         jo7SSTHv6JwLuKfNswjxK4G+NRrtPwxEFluwI1dZ1LCBs2oAjApsc2mI1Apv+ilRrROY
         K46icOMtrBYmvhpyDkK38wTxSxfIeRGUbx6Fr8v8CmvbnTTlM8I4Ou+0sEivLrrzS/8N
         R9OKZ31N8fOJ5RtReTqWfpVyjMlpwrkDQiCLrzuE1wjnedpYqztGKEPtAV62PUFHoTIB
         PPDQur2xPCsj+0uWGKSMxDXEpQRrgpdiiQMlO2m0nzR6hC9dpNppZyzFw9myK7+h01q5
         soAA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794663406; x=1795268206;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=nxrZJxHUg2O9j8zi4wkVtSZmuc/DWB6+tE9tT3nYX8c=;
        b=KgxXE+G/8bJUqsFN1/P7pEUvWywul+cGtdoovuRQgzpOpZCnwNlPndkunrgRVUO7Fk
         TmQx5jzlfOm9RPJRf9gsAvfirVPley5zTxeXpxFeANJCrimiAe1eKkzCJh45Od/2mxvx
         j0v0TmKTzChS6LPXjneFT6Qx8IeNpqahos10Ewt6Bn+7N3mBInKgYCgiobf0xQ7LHDX7
         NhUmh94RTdW4LvwsYfCOOBjJzI8CIiaThOx57/IaZDS4Vs1Itwm6EIx2dbdlf5FmG6jL
         jtfhSHxpDDmKbqwv9xABdF5qgecgoAgYXHYuY1JWaBL786MDgEDQyERW5R5BJtUETOqO
         4xPw==
X-Gm-Message-State: APuU4Z+4Z+OkxsgS1PpDLR4rIhpdF1ycmctWchDgD3BDJfwNZgo0IOpe
	IOYIEJDOaCL3VjTZCegPPLs12bqNGP+PMQ5Khg5f4vQED00tMbec8V9SKKwxRNVVrqaY/n9u2OP
	tXP/Ff6nR7Q==
X-Gm-Gg: AYBFou3qeQ6AK54e6n3swVIjRMYnfGGx3qk4kKU0p0ehAOdg9hm1KUldKO0nkEGeYtq
	QXs0KpWWoNEHtzgqQbomQmERXo1mdLqvKsolwePxP6MapJk/PpOlri9r/1W5kS12rgYOYEPa5iw
	ic1Mu2QGQNmsCVCRFNBthM3iMsQCBN/ROzk93NzjHnK+0YqhT80KU7CQDH681hOd9d1MdEOuMD7
	LjiGqqaAYm+R19fyj9He+FPExhsW9k5IHA+XSU6GnlKw5NoaUE5RBA05IIlzNf3Kv30InJ5cFfx
	s+px2MVebne3VD6B7weH0ALO3vOjpR3c7dRriNZltglnKZbpsFC/dS+Vt41tOZKfm02Quiphv7u
	sYLcBaYn2OHeFvLHAD4KNKLGIW4vZ+gS6vJ2DbcaqqDK18BAWv4yoIKU/MQ4Y6b4IUx9kdTbIxP
	r6b3T20zLUZXGWhQAiwfpyvyKHGTHh9HASMm6TGkH8HlPTvha03zxSWqnNZ9qcQKcbam2Vu1YNF
	pv3KG/it/nU9IdouKWFI9upzxb0sVyh7eOXNVcqECn65WUDBA8qlgrzjBasMOwRNHY/Ayt3856i
	1h7iSRQJzIhUN9Afh/YOYwiqIw==
X-Received: by 2002:a5d:5e85:0:b0:48d:f391:5c45 with SMTP id ffacd0b85a97d-49c740bcf7amr10850377f8f.42.1794663405564;
        Sat, 14 Nov 2026 05:36:45 -0800 (PST)
X-Received: from lake ([2a02:810d:d09:1b65:1a41:5e41:61a6:f0b6])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49d69c21a17sm6657866f8f.50.2026.11.14.05.36.44
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 14 Nov 2026 05:36:45 -0800 (PST)
X-Cc: maxime.chevallier@bootlin.com,
	andrew+netdev@lunn.ch,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Christian Schmidbauer <opensource@grische.xyz>,
	stable@vger.kernel.org,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Aaro Koskinen <aaro.koskinen@nokia.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.54.0
X-In-Reply-To: <20261114133640.3285413-1-opensource@grische.xyz>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list