Article View: linux.kernel.netdev
Article #6451Re: [PATCH] net: stmmac: Disable checksum insertion for XDP frame TX
From: Andrew Lunn
Date: Thu, 22 Oct 2026 13:54
Date: Thu, 22 Oct 2026 13:54
48 lines
10364 bytes
10364 bytes
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? 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? Andrew
Technical Details
Message-ID:
<741319db-17fb-4768-8606-9105df6bf905@lunn.ch>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350597-linux-kernel-netdev=dewy.ruReferences:
<20260929121025.20821-1-jszhang@kernel.org> <f0d8c25f-96e1-4da8-af6c-3286610338ba@lunn.ch> <atn0mF-dukVTK6Lh@xhacker>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-350597-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] net: stmmac: Disable checksum insertion for XDP frame TX Date: Thu, 22 Oct 2026 15:54:54 +0200 Organization: Usenet Network Message-ID: <741319db-17fb-4768-8606-9105df6bf905@lunn.ch> References: <20260929121025.20821-1-jszhang@kernel.org> <f0d8c25f-96e1-4da8-af6c-3286610338ba@lunn.ch> <atn0mF-dukVTK6Lh@xhacker> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="221961"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:qrk4bAIQ2wGOt3Rr8Gs0Lfy0CqE= sha256:1/Y4rlZjrq8NDvpor5vPQn756enzuJcKMYZDqhEovSQ= sha1:fZIFz+l0lD24uUEVQCOfpsrJ+Rk= sha256:mOgNplQxrMQVVdhSIRUCtYnGV4dRNQL7BxVhn2VV0Tw= 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 2631211129A; Thu, 22 Oct 2026 16:55:55 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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 (1024-bit key) header.d=lunn.ch 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 rcKJcOfpTqFj; Thu, 22 Oct 2026 16:55:51 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-350597-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 3FA12111292; Thu, 22 Oct 2026 16:55:40 +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 AEDA9606636; Thu, 22 Oct 2026 13:55:16 +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=1792677313; b=SQY5/WXhG66dadmaFcNSXGd2oHwjLQA6Y+fYHMsxHOibkt+cBHq/O6NNLnQ0os2zbqvY 4NSFRN0HwDCnkTfUOYpge6d1O0vjFg98VCKeJYS19JDvmm4V9hnu+P53Xe0gsn4QD7yEQ jtsej52iUO9vt2Sb5e0hKFLpox+Z2VvdbCffXKxYKjYHzDAqJPTkTRmzVgb6CxQaOfHhy ZmYvkQlWumdIwhS3qeOLx0oMstOCojYyiDNiK3D1t843chkqsT2HdLYLauH1r4KLV82Ix Gx9gQXRUYiU+A4A+rpeaaYd/nMzmVSOXcYHc2cn0lDPBLFlRwn3sNukvPXDI8VD2K1g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792677313; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received: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=2ojm36jDUBb6pXJrubCoB6gVau8R+P1ZTa/JMKRiThE=; b=QnGoBSFoza4nrLg9YT7bRmkbuiyhhbgL6g5IBzKPStv+H7H3sK9lnY3nYCey+JSegUz0 goPTH4CkRq7/asMMsB24S0VyyXiUMaSLu65mRL3BhAZD7IglBFmFb31nrWnKu0T6uBRD5 t8VTP2ndwlqeQGacAYvOVSodXXk0IwbxZ2+vS74C1c9NTVFbPjuLeJTddBxvDLdu3Yldo 39J9FToVQ/OD5Q/uXhk1fcnr8UEmjwEwOZW+zmjvUBobDjk5L7W4hC7yXyo9MPg3FZjXW OQMqibnDJz19tEFZd0gBVG0LgoP+c1xj5JAobC/HHwVZf7n26bUXCH5Es+RA3GbUytw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=CxrBhuig; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; 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 9408F606A330; Thu, 22 Oct 2026 13:55:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=CxrBhuig X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792677312; b=LEg/dKoDVAnHi+ENao+kCx5C5dKpNlyJZJ4sQMVJcQHrJbA0w8/ZsWl5os9SrhCmoYM6 cu53BBDegk2PY4z+zvMLA22Ets5YpFZwZIMWetqNcEK+DMIksfTkrf4Oar1c2bdhgcTrh qpXgMERvrjwEMhPXfZUN1V4qQ+vFCLwAkNbK5Ay2cFzzr2I5+C3bB1XDBjbypka/j42U+ ihej2AgOpUbrZTN0upYGoCPQV+cUt70/36yLb2dKP6BeYhOfrpW1fqdSZS9igcWBSxxUN VLu/1z9Xz8HXa6vreM4fbM+46HsGpbvaYoXjHwfgbJ4kem6QziR7FRO0UegronNLnXg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792677312; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=2ojm36jDUBb6pXJrubCoB6gVau8R+P1ZTa/JMKRiThE=; b=OVF6Ft10Q6UdckBhAXKEtq55gXRvhr2XltOzFIRX+NRf7T6Fjw9yk2qEfj9HNUnwZAj1 MsDqFWz6xffqQNZJFpqvkBWmJgQkU2GDUURlzDzno4vzOjOPst/yuDzSSII5gyZ63HMFR /XvvpDykm2g3xrwg/1V2YTuCMRV9dprWt6UML3YwVBBAAm39taCvpKieVK81qS5LyZJ7+ ifA+HJyK7m3GR5P569RD/83yXHYk2e8UUhpqAZbdfXTY8yXAZGNKa+O/Wa5HyumNlq1S9 Kt7ZfKfsIG//bNko+y3HwT9MIOLHxO3LhMvRFFRgwvcfuRZ61kS5yxEUAICD3dQWrSg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=CxrBhuig; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96BB0606A31B; Thu, 22 Oct 2026 13:55:11 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 96BB0606A31B X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=2ojm36jDUBb6pXJrubCoB6gVau8R+P1ZTa/JMKRiThE=; b=CxrBhuigoakpWN5Is0+/mnuMlH 7kvWlQaUZz3J10DLYIY62uAy0UDsgHoBxPmyVdeiQfOB69wozYtoATCzfGr+fXCjXhDDZdMBcXeBK TnRlktYSQY0q6QnulyWq8f1vtaS9fInAIMV2u5lngm9VwdpTSQlsXSt13abfxEFN8ios=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xJtFu-00CGU8-KE; Thu, 22 Oct 2026 15:54:54 +0200 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: <atn0mF-dukVTK6Lh@xhacker>