Article View: linux.kernel.netdev
Article #13491Re: [PATCH net-next 1/6] eth: mpnic: Tx checksum offload
From: netdev-bot+sashiko
Date: Mon, 09 Nov 2026 23:31
Date: Mon, 09 Nov 2026 23:31
138 lines
12811 bytes
12811 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] mpnic_tx_offloads()
(drivers/net/ethernet/meta/mpnic/mpnic_txrx.c) increments…
- [Low] The new mpnic_features_check() calls skb_mac_header_len(skb) for
every CHECKSUM_PARTIAL skb without checking that a MAC header has been…
--
eth: mpnic: Tx checksum offload
This commit adds generic Tx checksum offload (NETIF_F_HW_CSUM) to the
mpnic driver. It also adds an ndo_features_check callback that checks
the skb header lengths and checksum offset fit into the Tx descriptor
fields and the 256 byte header limit. CSO frames are counted and
reported 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 93abdec44642f..edb087b12a1e2 100644
> --- a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
> +++ b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
[ ... ]
> +static void
> +mpnic_tx_offloads(struct mpnic_ring *ring, struct sk_buff *skb, __le64 *meta)
> +{
> + struct mpnic_tx_hdrs hdrs = {};
> +
> + if (skb->ip_summed != CHECKSUM_PARTIAL)
> + return;
> +
> + mpnic_tx_fill_hdrs(skb, &hdrs);
> +
> + *meta |= cpu_to_le64(FIELD_PREP(MPNIC_TWD_CSUM_OFFSET,
> + skb->csum_offset / 2) |
> + MPNIC_TWD_FLAG_REQ_CSO);
> +
> + u64_stats_update_begin(&ring->stats.syncp);
> + u64_stats_inc(&ring->stats.twq.csum_partial);
> + u64_stats_update_end(&ring->stats.syncp);
[ ... ]
> @@ -230,6 +263,8 @@ static netdev_tx_t mpnic_xmit_frame_ring(struct sk_buff *skb,
> MPNIC_XMIT_CB(skb)->bytecount = skb->len;
> MPNIC_XMIT_CB(skb)->desc_count = 0;
>
> + mpnic_tx_offloads(ring, skb, meta);
> +
> if (mpnic_tx_map(ring, skb, meta))
> goto err_free;
>
[Severity: Low]
By this point mpnic_tx_offloads() has already incremented
twq.csum_partial. mpnic_tx_map() can then fail if skb_headlen() or a
frag size is above FIELD_MAX(MPNIC_TWD_LEN), or on dma_mapping_error().
In that case the err_free path frees the skb and counts it as dropped:
err_free:
dev_kfree_skb_any(skb);
ring->tx_buf[tail] = NULL;
ring->tail = tail;
err_drop:
...
u64_stats_inc(&ring->stats.twq.dropped);
Does the csum_partial increment stay in place for a frame that was
never sent?
mpnic_get_queue_stats_tx() reports this counter as needs_csum, and
mpnic_aggregate_ring_twq_counters() adds it into base->tx.csum_partial.
So dropped frames would also be counted as checksum offloaded frames.
Could the counter be bumped only after mpnic_tx_map() succeeds?
The same ordering is still there at the end of the series (in "eth:
mpnic: add GSO_PARTIAL for other tunnels"). There, mpnic_tx_lso() also
increments hw_gso and hw_gso_wire before mpnic_tx_map() runs.
> @@ -256,6 +291,30 @@ netdev_tx_t mpnic_xmit_frame(struct sk_buff *skb, struct net_device *dev)
> return mpnic_xmit_frame_ring(skb, mpn->tx[skb_get_queue_mapping(skb)]);
> }
>
> +netdev_features_t mpnic_features_check(struct sk_buff *skb,
> + struct net_device *dev,
> + netdev_features_t features)
> +{
> + unsigned int l2len, i3len;
> +
> + if (skb->ip_summed != CHECKSUM_PARTIAL)
> + return features;
> +
> + l2len = skb_mac_header_len(skb);
[Severity: Low]
Can this run before the MAC header has been set? skb_mac_header_len()
starts with:
DEBUG_NET_WARN_ON_ONCE(!skb_mac_header_was_set(skb));
ndo_features_check is called via netif_skb_features(). The IP GSO slow
paths call that before the L2 header exists, and before
__dev_queue_xmit() calls skb_reset_mac_header():
ip_finish_output_gso()
netif_skb_features()
mpnic_features_check()
skb_mac_header_len()
ip6_finish_output_gso_slowpath_drop() does the same on the IPv6 side.
At that point a locally generated TCP or UDP GSO skb is
CHECKSUM_PARTIAL, and its mac_header is still ~0 from allocation. TCP
builds software GSO skbs even without NETIF_F_TSO, because
sk_setup_caps() adds NETIF_F_GSO_SOFTWARE. So this path can be hit,
for example, when the PMTU drops after the MSS was chosen.
With CONFIG_DEBUG_NET the warning fires. Without it, l2len becomes
network_header - 0xffff as an unsigned int, which fails FIELD_FIT().
The CSUM and GSO features are then masked and segmentation falls back
to software checksums, so the traffic itself stays correct.
Would skb_network_offset() avoid depending on mac_header here? At
ndo_start_xmit time skb->data points at the L2 header, and the slow
path only needs a conservative answer.
fbnic_features_check() in drivers/net/ethernet/meta/fbnic has the same
pattern. This code is also unchanged at the end of the series.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261106-mpnic-lso-v1-0-e943ff1493e4%40gmail.com
Technical Details
Message-ID:
<179426706384.994134.13046661968612847431@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359681-linux-kernel-netdev=dewy.ruReferences:
<20261106-mpnic-lso-v1-1-e943ff1493e4@gmail.com>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!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359681-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 1/6] eth: mpnic: Tx checksum offload Date: Mon, 09 Nov 2026 23:31:03 +0000 Organization: Usenet Network Message-ID: <179426706384.994134.13046661968612847431@kernel.org> References: <20261106-mpnic-lso-v1-1-e943ff1493e4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="474519"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:J0OxymcmzbQINQ1Ly9ncAHA3XEs= sha256:JSEcb5SoenVlxnHtw2VvoqDTuxvRRq4wv15WVj4vra8= sha1:AQOeGzOsDotGOekVZxWXvfzQuqo= sha256:prIgN5EfpyH2L4RSzziRozXknxO/RT1Zl6jSyAgP1xY= 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 788CA113985; Tue, 10 Nov 2026 02:33:57 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, 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 FWR8b3zPZTLn; Tue, 10 Nov 2026 02:33:52 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-359681-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 3F9F7113980; Tue, 10 Nov 2026 02:33:42 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 706FE2ECB3; Mon, 9 Nov 2026 23:31:15 +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=1794267071; b=2633MaXQ8x+3vLmFqdb0TkQbT1Yiu7Ser2yGNCMsmPK8Vjd3UtEXCVmr8vsz0mpM7oSG MZbZb8/kkOzngjXg3Sc3VgccWouCnmDUoanQpB93BPH3BRZJeL81kAKVI4rtELP6sWrd4 4BKr/5y3iWIMonE5NyYD8qdRRShzyvkDl/XqOFYtaR17OajDMpBXm0Hx5Yh2XL3hoar8w +j5ubXJtcwYcGyI4B4lZ5re7BWWowXdXa0G+HSRLONDd9MtESTfakqBAyhqRDHILYHJNg cP0Yk+ncSyT7jvpwxYi1tu1YFmQbWK+3/omJmJ4EtgIuSuxMCKwww60NzVAhBK8WeRg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794267071; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=Yp7+MFo6ivpVY8je3iQxlPFI1fVKcXYVEZ5Inw0sQnA=; b=TYlp9CkoRX6vu+KzuY6p8LC3YD+tkax6cE6zUEbzJ2yykh++dxihKTU7BX6tVuAxZ0rf QT8A6lzOlvDsapgDaWo4RgPTDIYtTo2yJ/5qtWfi7Jj9vSaCSsKF72R0/TJVR8BxorW0Y S79AbkIHfWnLmWiTypQpB2IDGNqAvdfilrQMti6VnCamSRFFkZSS0nHVH9RkSqHWUXsRA 8CCkJDtSe/KZdfNkbH2TxQydSQvs33Bta58f5uvJ7YgU2sYr0JlHO2pf7hvTBwi+3ZKS0 4vEMRTDtRjMLHv4ri6HclJOF6Y8+MWJp2hBzhse3z6G1zIhPcDZulHoiVSe7Cf+lH5A== 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=K94AOvJ1; 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 7FE1860A2607; Mon, 9 Nov 2026 23:31:11 +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=K94AOvJ1 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=1794267065; b=UW0pr3TSZOibVJ9RvDr5CQS1Kak/suEzuUrgGhNVLHzTYnpzziuyu7q1MSM/MnOPSajT lWPfehm0OAhBw3rpen8Pz5QuTGjPwnYEjkpJxW1JjICLmsqm+uMZQZ8CG0lArTyi6szh1 Ho4aMjqDKHBcIQt3WeMKcaP7kLl7zKfG6u3zxNFJ/welmLD80VY72m1kdc3WvDQEibApX 7JyRwgcVKt+Klya+8z7hesgnDdxbNhIjg/9r0TVu/sM34NKla4eb+/sWRLNb7mSvjZMX/ s+kCYINmwgGwuw/drUdYO8lpjVjy/W0x7LpYJfGqoMsZbZWf/AfFAzhseEXin7jSzSw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794267065; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Yp7+MFo6ivpVY8je3iQxlPFI1fVKcXYVEZ5Inw0sQnA=; b=pCDy40Nf5k5fLRwgwMJA2xbsMs0jCAJy9Fr7EJkSsKKoeEP4r0YlVgWFgz6dXPawuEbs nIOdW44QnWBiBSfMYl0GI1fInZBuuO6MuK51h33B3jYzLtrlJ/09iar9hONgLqSnDFpvm lEnDTfdumfMjqzeES8EvZ9rf/U2tOTcnK4uXGuxUyNZXewTkvJGA9eFmW20fkEqMSH4TS 2s7tGj79Kufete1ACzAUpdn50ihOGPoueESli4UPWlpC9OTlmN0a3kO7GWB/EFrIgOcYo Ou9Wd73uRP23eOCxxOWo8EPpsZn1bTicFy/j/rKhji9qf/RRHl6oYsjKoWd1sJPKWwg== 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=K94AOvJ1; 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 53C45606A330; Mon, 9 Nov 2026 23:31:05 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A06D1F008A2; Mon, 9 Nov 2026 23:31:04 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794267064; bh=Yp7+MFo6ivpVY8je3iQxlPFI1fVKcXYVEZ5Inw0sQnA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=K94AOvJ1+SDRBrVppqJqmiroNDOq/QVXXAE5voRhQ2kSajmyphEi21mH3X454nV3R RL/Eua1oHEFGA4Gjn7gL4JIXKsumOwuGOWOysuOo/6DPMB2G9BZVYh9FyRUKCWl4Gs 3IkxNgBBy8cEvlPQbpgLTWM9T4X5LVp4gKhrDMTTdU5+lZ34lVG0NLVPsvcKmy4hwd dQf8+lVkZV2XdGpXeg5/Eg3+9a/WcY9xB1/gfWrUExoDNzHOoNNoP9xXHbDLs13OJb U3P2Vf6FpneuhVTz6KyaUvR8A6LIpTHHqoGm16s5ApW1atlJJFWGTq9ALP+lPGON3r FFd5pNTbF8pdw== 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-In-Reply-To: <20261106-mpnic-lso-v1-1-e943ff1493e4@gmail.com> X-sashiko-severity: Low 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-Received-Bytes: 12525