🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #13797

Re: [PATCH net-next 2/6] eth: mpnic: Rx checksum offload

#13797
From: "Daniel Zahka"
Date: Tue, 10 Nov 2026 10:30
128 lines
15675 bytes
On Mon Nov 9, 2026 at 6:31 PM EST, netdev-bot+sashiko wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 1
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] The CHECKSUM_COMPLETE value in mpnic_rx_csum() is only right
>   on hosts of one byte order.
> - [Low] mpnic_rx_csum() (drivers/net/ethernet/meta/mpnic/mpnic_txrx.c)
>   sets skb->ip_summed = CHECKSUM_UNNECESSARY and ignores the full-frame…
>
> --
>
> eth: mpnic: Rx checksum offload
>
> This commit adds Rx checksum offload to the mpnic driver. When the
> completion descriptor's l4_csum_unnecessary bit is set, the driver reports
> CHECKSUM_UNNECESSARY; otherwise it reports the l2_csum field as
> CHECKSUM_COMPLETE. It also exports csum none/complete/unnecessary counters
> through the netdev qstats API.
>
>> diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
>> index edb087b12a1e2..680625810ec03 100644
>> --- a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
>> +++ b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
>> @@ -655,9 +655,34 @@ static void mpnic_put_pkt_buff(struct mpnic_pkt_ctxt *ctxt, bool napi)
>>  	page_pool_put_full_page(page->pp, page, napi);
>>  }
>>  
>> +static void mpnic_rx_csum(u64 rcd, struct sk_buff *skb,
>> +			  unsigned int *csum_complete,
>> +			  unsigned int *csum_unnecessary,
>> +			  unsigned int *csum_none)
>> +{
>> +	skb_checksum_none_assert(skb);
>> +
>> +	if (!(skb->dev->features & NETIF_F_RXCSUM)) {
>> +		(*csum_none)++;
>> +		return;
>> +	}
>> +
>> +	if (FIELD_GET(MPNIC_RCD_META_L4_CSUM_UNNECESSARY, rcd)) {
>> +		skb->ip_summed = CHECKSUM_UNNECESSARY;
>> +		(*csum_unnecessary)++;
>
> [Severity: Low]
> This isn't a bug, but should mpnic_rx_csum() prefer CHECKSUM_COMPLETE here,
> since the same descriptor also carries MPNIC_RCD_META_L2_CSUM?
>
> The commit message says l2_csum is reported for every frame, and
> mpnic_csr.h doesn't define a validity bit for it. The comment in
> include/linux/skbuff.h says:
>
>  *   - Even if device supports only some protocols, but is able to produce
>  *     skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY.
>
> With the current ordering, every TCP/UDP packet that the device validates
> goes up the stack without skb->csum. Anything the hardware L4 engine did
> not check then needs a software checksum. One example is the inner
> payload of a UDP tunnel when the checksum conversion path doesn't apply.
>
> The in-tree fbnic driver uses the same pattern in fbnic_rx_csum(), so
> this may be intentional. It still doesn't match the documented contract.
>
>> +	} else {
>> +		u16 csum = FIELD_GET(MPNIC_RCD_META_L2_CSUM, rcd);
>> +
>> +		skb->ip_summed = CHECKSUM_COMPLETE;
>> +		skb->csum = (__force __wsum)csum;
>
> [Severity: Medium]
> Is this skb->csum value correct on big-endian hosts?
>
> mpnic_clean_rcq() converts the descriptor to host order first:
>
> 	rcd = le64_to_cpu(*raw_rcd);
>
> So the u16 that FIELD_GET() extracts from bits 47:32 is the same number on
> every host. A __wsum, however, is computed by csum_partial() using
> host-order 16-bit loads. The correct value therefore differs by a byte
> swap between little-endian and big-endian hosts, and storing the raw
> field can only be right on one of them.
>
> The MPNIC Kconfig entry only has:
>
> 	depends on 64BIT || COMPILE_TEST
> 	depends on !S390
>
> That still allows ppc64 BE, sparc64 and mips64 BE builds with PCI_MSI.
>
> On such a host, would every good packet reported as CHECKSUM_COMPLETE fail
> validation in __skb_checksum_complete()? That would end in
> netdev_rx_csum_fault() and "hw csum failure" messages. Decap paths such as
> skb_postpull_rcsum() and pskb_trim_rcsum() would also adjust from a wrong
> base.
>
> Would a conversion that keeps the device's byte layout help here, for
> example (__force __wsum)(__force u16)cpu_to_le16(csum)? Alternatively, the
> driver could be restricted to little-endian hosts in Kconfig.
>
>> +		(*csum_complete)++;
>> +	}
>> +}
>
> [ ... ]

pw-bot: cr
Technical Details
Message-ID: <DMRGLXRN47F0.EPQ8KQQ531FL@gmail.com>
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-360088-linux-kernel-netdev=dewy.ru
References: <20261106-mpnic-lso-v1-2-e943ff1493e4@gmail.com> <179426706505.994134.14903670095120167303@kernel.org>

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-360088-linux-kernel-netdev=dewy.ru
From: daniel.zahka@gmail.com ("Daniel Zahka")
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 2/6] eth: mpnic: Rx checksum offload
Date: Tue, 10 Nov 2026 05:30:11 -0500
Organization: Usenet Network
Message-ID: <DMRGLXRN47F0.EPQ8KQQ531FL@gmail.com>
References: <20261106-mpnic-lso-v1-2-e943ff1493e4@gmail.com>
 <179426706505.994134.14903670095120167303@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="583635"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:j57XjTzt1FBHZD5NK2Btis8z5SI= sha256:jSaPoJxlcY307wzWWct23vjPpNqw+9JvRzcg/E2F9AQ=
	sha1:10WB05KMsGVZb9wv9SoRuFMgZ+g= sha256:tjJ6x8DGlUP1MPu00cs3rwPom0dEtsujQneAU+Lj1hE=
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 6BC8D113AFC; Tue, 10 Nov 2026 13:41:05 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, 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] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
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 sQsMZ_l89VfG;
	Tue, 10 Nov 2026 13:41:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-360088-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id D7326113A82; Tue, 10 Nov 2026 13:40:53 +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 7F7851014D8; Tue, 10 Nov 2026 10:30: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=1794306615;
	b=g9MbnZkyfaNDrdEHAnLMdUCn1LEaT1QTyLC49jF/KNFExW91V6GJJyLNedJiHqAc8heD
	 dP+72zOLomm3JOtkBL3a5Bb0fdBQYL0kPI05e3GlTDrj+b2LoduAQNPY9BDnYdSOprWRa
	 421qHNI7CI6LfmbBy9IJcTIFHDH2TwKwcGbeW+w0fZhhrpF6QwGE90PFoD0RG+3TUuS+E
	 UDhzq5VPyR7keG9RW9zoB3XlAIio9i23NfajSowk2ExtuY4ahTzXV6fhe5WVs5pFtWIat
	 9ZDL8jntUVgYmiW7s9LrycNlzWEPfZ1Jdce3iapq3mQyS2tpVfe02Ub233A58jyz/wQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794306615;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 Mime-Version:Content-Transfer-Encoding:Content-Type:Date:Message-Id:
	 From:To:Cc:Subject:X-Mailer:References:In-Reply-To;
	bh=zi+Zsq/PpxVfP2QTeVnAcqL73Etz3B0CnzQ12J/UIHw=;
	b=cyo0Tzu8+i5IXlLcOeTYGmYkTdcctzjARzZ1YWZ7b5ea5RKsoC/YOOS7hglJKznBlfPM
	 J80A2gY620tQuQcAxDERq7ykRxXTGzm2Inayemqj0xPz6U+ze9FI90v39+0tSOhMbDpG6
	 yu+8C88Osn5WAe+f+zkLOxk1MY9fnMbmP59ndi7sTXlEaGg+wwWbUbnfcAGh5U3s1xRDS
	 gUT0jeFsE5d757JV4BvVz6k/3xunix24kpME8oDC0HV0h+7F/36o1qeGhclea+z8IP4fx
	 8WenwPv/3LBEkTbCBqE8bYp4l+CNb5uG12kwNTuLkTP/wMYf6MhD3AuH8a6/rtgZ01g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Kwvx5BjZ;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 9CB72606A333;
	Tue, 10 Nov 2026 10:30:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Kwvx5BjZ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.179
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794306614;
	b=ohaQx0Znuey3jfHD/JcYvaGzsfZkz05xo2N2F0pZTudrs0+TlVYbHWUjfm4MsMRWWxan
	 3Z4co5EWarLsmmXo+VeXkc5oqF0E0hEpAo+i0aXsdzDUoeIGXq2fY3ReB5fSxja1u60Q6
	 yn/MxvaJZTB24kPgrVj+naBZbBiWltKGjX4Z9b306Lax1giOmKpD5yq9+BZMVS0RwiajE
	 MrQEK0NaWX5ILaZiwAzCGvN7qpCCqkDRs7Sb6gqavwrgv3JV45wWMVa1PtGj2JHn1yUrB
	 gLRpG38Y31SKCrPPJcV0U/yRGYqHHA/nofI2kbDAZQPolG5aluV6ydJMzpPo2pklCFA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794306614;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Mime-Version:Content-Transfer-Encoding:Content-Type:Date:Message-Id:
	 From:To:Cc:Subject:X-Mailer:References:In-Reply-To;
	bh=zi+Zsq/PpxVfP2QTeVnAcqL73Etz3B0CnzQ12J/UIHw=;
	b=U7M2B4DJxhwGw84KQAYTlB1K0mDOvWplOIMpLUkp2hRJp41akdOLyxLqOKjXv8C7DLGN
	 sP8dy7E0YSQEiUUocGTSq2mbzs61FwdWt6AOgjErw+75pUjW+wF70AgV5w78WC8ecyikR
	 u1+caf3Iua41wkB2HGzK+9s4eqEF3Ji8Vyp2t0LdvWAX4pyRfkA5ooJkGOa+e1fPIcHCn
	 Csk4MavLyzru79Z140xOCHhGDzWHLFpjmT2q148wAxnlDqOqNxRas7jPtpao0IOhPVMR0
	 P5mm0OpvZSavgFLvF/Z7JikjtLHrEKdXrk+DhxG757r48sC4zZiWHJ9D7jZwgFNIjsg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Kwvx5BjZ;
	arc=none smtp.remote-ip=209.85.222.179
X-Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179])
	(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 6AA09606A321
	for <netdev@vger.kernel.org>; Tue, 10 Nov 2026 10:30:14 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6AA09606A321
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-93f3c616c84so174642185a.1
        for <netdev@vger.kernel.org>; Tue, 10 Nov 2026 02:30:14 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794306613; x=1794911413; darn=vger.kernel.org;
        h=in-reply-to:references:subject:cc:to:from:message-id:date
         :content-type:content-transfer-encoding:mime-version:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=zi+Zsq/PpxVfP2QTeVnAcqL73Etz3B0CnzQ12J/UIHw=;
        b=Kwvx5BjZ2evAT3Q9Yj2Ow+4dEP2dZiu3wvCKtvQz+Ysi1tT7TwtQBuZIZ3Y0/mi3Ds
         aedjON8EDZmp4KkhzGKqaUOe1fsVA5cSLBQAkOsvzw5o6pXQu3oRhOqbpw+hg9afEbY/
         pQvPgUcILsLmHMNunvW4cOzTchoaoZ2e0mrTsymAmUt5s3bf429IDtO3e/mPmY1iN0ar
         /tKkVO6T8rdJZ8wPERNAKH4ajWLt+dE87yoAoz3IL7y+ZWshNMycy+SeJusY0nfQiqin
         Z1ePlSRrmEt67Fd9Ci98ZG+6zBno9H/ZJVJ679jCeI8fkQts5wFSiqqVOfFP24Ac9HvW
         tNmA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794306613; x=1794911413;
        h=in-reply-to:references:subject:cc:to:from:message-id:date
         :content-type:content-transfer-encoding:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=zi+Zsq/PpxVfP2QTeVnAcqL73Etz3B0CnzQ12J/UIHw=;
        b=T4pviZnGQyi67U7DIotIgOScFbb6wuA00sqwiSXaZOj2UYjYvtb61OxbWjyegzXR4Z
         A+TSe5FIfrD4+twYOu5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1jWVyDT1CCt0Zw4tU7jQciJDnOtmL6dzD7dkKGA5PXHQkPALmkYn2Yx
	aQFprYLQRKkrSj4CgIeWuK0iC7KEzZOlXw==
X-Received: by 2002:a05:620a:4047:b0:947:826d:15e4 with SMTP id af79cd13be357-9479f4317a3mr342618985a.76.1794306612793;
        Tue, 10 Nov 2026 02:30:12 -0800 (PST)
X-Received: from localhost ([2600:4040:9399:4000:e553:72e5:7d37:c7ef])
        by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91ef43519a0sm9282416d6.3.2026.11.10.02.30.11
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Tue, 10 Nov 2026 02:30:12 -0800 (PST)
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-Cc: <alexanderduyck@fb.com>, <kuba@kernel.org>, <kernel-team@meta.com>,
 <andrew+netdev@lunn.ch>, <davem@davemloft.net>, <edumazet@kernel.org>,
 <pabeni@redhat.com>, <dimitri.daskalakis1@gmail.com>,
 <mohsin.bashr@gmail.com>, <netdev@vger.kernel.org>,
 <linux-kernel@vger.kernel.org>
X-Mailer: aerc 0.21.0-threadmapfix
X-In-Reply-To: <179426706505.994134.14903670095120167303@kernel.org>