Article View: linux.kernel.netdev
Article #12986Re: [PATCH] net: stmmac: Disable checksum insertion for XDP frame TX
From: Jisheng Zhang
Date: Mon, 09 Nov 2026 04:27
Date: Mon, 09 Nov 2026 04:27
64 lines
10739 bytes
10739 bytes
On Thu, Oct 22, 2026 at 03:54:54PM +0200, Andrew Lunn wrote: > On Thu, Oct 22, 2026 at 07:33:44PM +0800, Jisheng Zhang wrote: > > 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. > > I don't know the XDP code. But... > > Zoom out, look at the big picture: > > What do other MAC drivers does? Do they also disable hardware checksum > when XDP is enabled on a queue? I checked ixgbe and i40e. AIUI, their ordinary XDP tx paths don't request checksum insertion: ixgbe_xmit_xdp_ring() leaves the checksum offload bits clear, and i40e_xmit_xdp_ring() supplies no checksum command or header offsets. So this patch likewise changes the descriptor for each XDP frame. NOTE, it doesn't disable checksum for normal skb transmissions. Also disabling insertion doesn't introduce an automatic software checksum calculation. An unchanged forwarded pkt already has its checksum. If an XDP prog modifies checksum-covered fields, it's responsible for updating the checksum. > > Should XDP actually have the needed meta data? Can it be added in a > low overhead way? Does the overhead of having it cost less than > forcing software check sums? This needs XDP common code path changes, I think, it needs a separate discussion.
Technical Details
Message-ID:
<avFLrDFxQdj4mbpN@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-359026-linux-kernel-netdev=dewy.ruReferences:
<20260929121025.20821-1-jszhang@kernel.org> <f0d8c25f-96e1-4da8-af6c-3286610338ba@lunn.ch> <atn0mF-dukVTK6Lh@xhacker> <741319db-17fb-4768-8606-9105df6bf905@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-359026-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: Mon, 9 Nov 2026 12:27:24 +0800 Organization: Usenet Network Message-ID: <avFLrDFxQdj4mbpN@xhacker> References: <20260929121025.20821-1-jszhang@kernel.org> <f0d8c25f-96e1-4da8-af6c-3286610338ba@lunn.ch> <atn0mF-dukVTK6Lh@xhacker> <741319db-17fb-4768-8606-9105df6bf905@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Injection-Info: usenet.network; logging-data="273676"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:b8njOxooXYPBQax1PR1J5GsyWhA= sha256:A1j7Ujc4vPS6Vk4bOqREcAEyxal+NU7dGZ/oYIqvUXQ= sha1:m90Lz3xHNydeccVwHBcNcVCNzBU= sha256:zcQg8dSps25zSlQ1HK48yMQMNZiw4nMBPrxQUTshb10= 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 813B7113691; Mon, 9 Nov 2026 07:48:09 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, 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 3o4VRSurRwMX; Mon, 9 Nov 2026 07:47:58 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-359026-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 17AB911366C; Mon, 9 Nov 2026 07:47:48 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 733A460A930; Mon, 9 Nov 2026 04:47:47 +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=1794199664; b=44HvJvwrt4geq9MFEt1RFT5coXZnYlU/7OHGCKS7SV1kqlXiy718AdPIquzWa+nfHe1x FADB7Mss78xycLUaLZZKlqmWX597WbYJOP5SbCOaqJupw6Ee8OJHQvK5yrnET8kvocPJX KD9TOK2joBLwfIIrdQI+sqgEKsIPtegeyiIFmrWTqmI9cZMa80eeRXADJG5EIGVl3ckei TbnftRnMzGheZqP9uXWEXU5UCNgYLJpQWJvcyLB2Lye3y41R4fclYhuLQXeCuF2fvSG/T /GmYr1+LbMyu8KdtUH68B1M8ccjx69FpGqop7fcCqHayPpz7B5o25g98ORcJ3tFMoQQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794199664; 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=97Oq3h61nNGl6LLTRfZVkFwajsAV8PVh6RmhEZUOMCg=; b=Y1vnJs6+ufQ4KwnaQYmQndCj+GPbzDKoHQn9TWON+RZb78vLiuYCXbFHFp0rfN+xWIYP R6BYHGmR4oB6017+RwobelIE2lr9+mJCai1Y27KaeDrXChM2MazTb+1VGPaqt3dL3FV2c tgJ5rQK5PGfVtY/6w504tGKfdBzqCPZuaQRdycaiFxPDtuMG1YXoaq0FrGIIlnKRRV8YB LKeeooxJI/RvR2mzsXjH/ImZNqLBgcEnWg0gax2+Rm9AYxo3T6KRMlBnRtWb8qJgOngNM c2blbdbpnBRB+ioJ3XRrAQUMxlUrqDIn+bD9dIoAvIatsvZUgLp0MqJZEMC3+/tJxTQ== 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=Hs6HABx6; 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 8E9E2606A330; Mon, 9 Nov 2026 04:47:44 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Hs6HABx6 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=1794199658; b=f3Hx5xdOOvwIXw1Ws0FAzlcveznYkRh2DGa/VFzaSeev3CTUQtp83cilqmAUQg7pFkyb kE4GHMcdk7Fw1I1MM9IeBYKVzzg4Uzr2HbqiIg4xENAyspFXyCPmtX8rh321E/P/P4MQV x+RNloUbhSxoEdYenFsHsNCzbUq9td1SUZN/4Eo8bSMGldi1l3E4eJrA85HLq/M9wderl r3LSgheIyQdy85ITacMHLVBe3xRcgnYgjVZQNGVjuBuGFgnWyP1V3bfL5ucORjvv4whmX VothTl09teNBo6thOTP640Tqn5/c5v7gn3gp0bDKa6kwho/AoPq9/tWYJCWXMWGNlFA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794199658; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=97Oq3h61nNGl6LLTRfZVkFwajsAV8PVh6RmhEZUOMCg=; b=e3kf3oqA+zGxpDd/oixENZ2DAWdkQJryFTj0HyPo60JUNr/5NozI4ylMmJxuJ9aWlO8M HVIRImGoaFgCJbsk9jfJl6qHf2C5xCisYYWexRukCoy5v0BENH/iHnN45/JQck1lpWAI/ 79EeAm0LaWdMt1pknjkXTcxXzIacmVgxztAi/QWb3X7Tczh8HE/hqOthnxs67yxZlBzIG lF1vsvQKbke2w7aRcivAS8GJYvRGvqSZfOFCg13evkoTQD0NimB5t1KBO5MhGo0eRHa7m 0SjLq6Hccz1a7ect5pz0oSxVMsvRQSwV8uXEfCPfhiGG7p+GDG7n/4Zbqv+vXJf2zPQ== 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=Hs6HABx6; 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 645CD606A31C; Mon, 9 Nov 2026 04:47:38 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCE3D1F0089F; Mon, 9 Nov 2026 04:47:33 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794199657; bh=97Oq3h61nNGl6LLTRfZVkFwajsAV8PVh6RmhEZUOMCg=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Hs6HABx6vSELnk8cm8cfChFZua9xIEEKQSWqtTW3oajmjkrUSCvrgq4t5l8WsC7Rx pflLZ5C2RQn6HdR9sdt83Ms2z4k2JpnezxZ0e7hAmX8wt5MVWaylh7v+nczzOnWVvB hqA2oIYUCYmQVtFChOPf32RZgdxLNKKu/tuRiiSXrXXcVKF7CzlxMMTQHexPiRBeeg yOXWEruDQzzACNv+JgXdSAyd8XJh7YjOX7beBZVA/4c7Tkx3UHvHV4FlLo5ecnpVyI QHIYAbKkawSNiirr8MQtbYosZBdXZHdpVfmC0ZrNgrKc3f+5qLxJWXjFkj0oGVEt/B 2cqLDZq1IrTEA== 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: <741319db-17fb-4768-8606-9105df6bf905@lunn.ch>