🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6424

Re: [PATCH] net: stmmac: Disable checksum insertion for XDP frame TX

#6424
From: Jisheng Zhang
Date: Thu, 22 Oct 2026 11:33
36 lines
9379 bytes
On Tue, Sep 29, 2026 at 10:29:14PM +0200, Andrew Lunn wrote:
> On Tue, Sep 29, 2026 at 08:10:25PM +0800, Jisheng Zhang wrote:
> > stmmac enables TX checksum insertion for XDP frames whenever the queue
> > supports it. XDP frames carry no TX checksum offload request, so this
> > can overwrite a checksum already present in the packet.
> > 
> > Pass false to stmmac_prepare_tx_desc() when transmitting an XDP frame
> > so that the packet is sent with its checksum fields unchanged.
> 
> This seems odd to me.
> 
> If the frame contains a checksum, it is either correct, and the
> hardware calculated one will come out the same, not an issue.  Or the
> checksum in the frame is actually wrong, because the frame has got
> mangled by eBPF before sending it out, and you want the hardware to
> calculate the correct value.
> 
> What an i missing?
> 
Hi Andrew and all,

some discussions happened in below thread
https://lore.kernel.org/netdev/athAoWfW-xesPhFP@xhacker/

Since it has been merged. Let's move the discussion back to my patch.

AIUI, dwmac can only do HW checksum for normal particular packets
layouts, such as TCP, UDP etc. The stmmac_has_ip_ethertype() has
well demostrated this limitation.
Different with normal tx where the common stack supplies the skb->ip_summed
metadata, XDP path doesn't have the necessary metadata. So to make
the XDP always work properly when transmiting tranmist arbitrary Eth
frames, dwmac HW csum needs to be disabled by default currently.

Thanks
Technical Details
Message-ID: <atn0mF-dukVTK6Lh@xhacker>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350541-linux-kernel-netdev=dewy.ru
References: <20260929121025.20821-1-jszhang@kernel.org> <f0d8c25f-96e1-4da8-af6c-3286610338ba@lunn.ch>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350541-linux-kernel-netdev=dewy.ru
From: jszhang@kernel.org (Jisheng Zhang)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] net: stmmac: Disable checksum insertion for XDP frame TX
Date: Thu, 22 Oct 2026 19:33:44 +0800
Organization: Usenet Network
Message-ID: <atn0mF-dukVTK6Lh@xhacker>
References: <20260929121025.20821-1-jszhang@kernel.org>
 <f0d8c25f-96e1-4da8-af6c-3286610338ba@lunn.ch>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="202925"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:orCtshe3nBCnm3+MLUKHIAtBfrw= sha256:EmFKvcBCl/2KcXTAh6reeiO2bntJge9fceOF1zIK75M=
	sha1:xatF/bk841j8slGYl04NBEVpUCg= sha256:kPBaoiUQwj5nu2BZqQIpthI6mtl9oq4z1QoU2y/fYt4=
Content-Disposition: inline
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 0319811125F; Thu, 22 Oct 2026 15:00:49 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
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 G01T1b1ByeRk;
	Thu, 22 Oct 2026 15:00:41 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350541-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 24859111257; Thu, 22 Oct 2026 15:00:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 6664E40CCE; Thu, 22 Oct 2026 11:53:56 +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=1792670036;
	b=CZ3QbbfPS0kNeGElinNJ2tcipAYp5XCqTaWijUBkW0ulkSARfAePIhyn9UmWXAk7f3Gi
	 +zPpR+krS7v18Xc8qrZhgqnD3HYaaonJyDmLol28tluUaOhq6QkpWa+Cw+wEWVvNlHAQn
	 RT1jBQ84EpmAKet7RtVHt18hyN/PNU4E+dvcWCKsvM+vj+pfl4MACgLdqh7bKHpZrY7WC
	 M/DiM5ZZmhPttC9m9CnD/3wSQawBpPmdhq9YGToFhlMYWriEmrM+E4Gvk/sIwYwrUNI2r
	 dAAsuEaTxAU6IBySigfTm5zfCBPzWmXoBiXqi04xxmW9t/EVjCrvHz6YfA1WejEhjyQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792670036;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=aFj9EOMMM4ZfmH8lB0SRPQlwHihAc++U7Qmw0rZKtAw=;
	b=Lh5zEcVRvoqtTUhuy34KZad0Xwvr5q5Z3iJrSRvtk3y4c0LNc/v0jj2GRYWXeQfSf1NT
	 v77suA1vuOeOcsm0m/i3wrzBz4S600CQmGNOhoNE721LDe/qUiK/zAJoD4acLLd9yP8Hz
	 Dnh4zwjgonawEWUTgHdY7axUnOKXs9eE+GT3T/6uTkHv0F6nJ8m3rIRH/pt3rOX87eLq6
	 LzskvnKWdJ8Soy+/ae8bsNTJDx5ryIx7bOzctVwE3kSTRZymswXbV2vqvGr8rq4alCQb9
	 TbyaW5O7SaQDd6BJift6srg3JMtfCZ+XU9b59uvJMhWymp0tCTOkp0LSwduTlk2awjQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VwbgQH6E;
	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 3D71E606A320;
	Thu, 22 Oct 2026 11:53:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VwbgQH6E
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792670030;
	b=0HcO8fIQIpepJM4pKOdAp1NFfp7vJm+yDGUPcZHgSQOuiAcoA/BCYXxD3pRSTr5j53dY
	 9SshuwAbn6ot4IoPbPJhz5G8oPr1d8y9BJx172InR6OAchxGkQmp8HCVoic14TZI4kAy0
	 wqPCtfKpebmKBpP6i3/v3JRxNZLi3BfIa3/B65xKeRgug2oztv+vs4YKi/6viPBaiL2Wu
	 mOmTacTL9e7FQ4VFUAP9TTRn8FYH2LEjvhNHB0Q5R8Y4u/j9ndtDIYhzrI7rHb23c5eC5
	 xRroLo7cOyOZ9q9MuKUB6fLNBVdCT2xsL4Iae+EyhVvYfktQM3ZFzzbILt9H4aThDcQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792670030;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=aFj9EOMMM4ZfmH8lB0SRPQlwHihAc++U7Qmw0rZKtAw=;
	b=dWV/mfPn7DDMoQr1IMIWy/oF0X/k6aB0/rrFOAJnkKSuavZ6jokP+9JV5/MfvnFaeOgT
	 4PN2gqI3bVTgooWtRk1nCG8+xw2UKqsfiv1AZJUdDHb2D+5a04k+6rnQFAPTJFpNMrrUO
	 C5j7Vb2xfxKrgk90wqc1jmg5S0q8+mlUPmTvgOlnWJS3ooPQr/UcxPRqW7vkEJHauifEW
	 UOPIh+bvISNL6fnPUeqDUAg0amjeXImIi2F4sRA/76fIEx22ZzKEIL7j5F8HGkpDmYXaP
	 xpIUhHzuMZFAOS52kQ+yR5/GQO6yc2vjlKteI+yWX9g5ZHGmBzsc9yvLDcMYBFm4m3w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VwbgQH6E;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C4AE606A332;
	Thu, 22 Oct 2026 11:53:50 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42F881F000C5;
	Thu, 22 Oct 2026 11:53:47 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792670030;
	bh=aFj9EOMMM4ZfmH8lB0SRPQlwHihAc++U7Qmw0rZKtAw=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=VwbgQH6E6d2EPY7DrOxy0zWCdu18bjOfHPcC7AtxLsjjNoxU2WijAntIipUbau2H6
	 SzyLGawID2D2xB3WFoFCq7890+Ml7u9VNIIQFKdaHdOn0AzB3+kpmeVv4tl5+bTSrE
	 s7Hc4gCSgCjM3DFDo+tNo2WPAyyyP27uW67NO5In8bCrrGOZr3xGMTY38OAM4TqZTM
	 1rdDjXwP1N22vg1dirZduSskhN+vr0TUkKHAwWiiM/zyvFeYxvGSz/3Uz/RTuR/72q
	 d3QMKgthEetIcsCackzdQN4/1kTg0Q1+MqnWnLlXuX2bwFA/g+45JC621rhkLufpoJ
	 T4WYtaaVinzbA==
X-Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
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
X-In-Reply-To: <f0d8c25f-96e1-4da8-af6c-3286610338ba@lunn.ch>