From patchwork Wed Sep 16 06:52:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 5350 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6446:b0:8a0:ea1f:253a with SMTP id n6csp5853243mag; Tue, 15 Sep 2026 23:53:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBxs6QQJyMx9d9APqaY11F5lwX7GOPw0dVKpLrlYKCafulYCAjHQ6YzJ9uGe6CQWkIjOM9YcOFam7a0=@openvpn.net X-Received: by 2002:a05:6871:a872:b0:45e:daba:e3bc with SMTP id 586e51a60fabf-48475a7407emr1461772fac.15.1789541598025; Tue, 15 Sep 2026 23:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1789541598; cv=none; d=google.com; s=arc-20260327; b=P3/qb7OE6SxPEvTZ8tY53vXpEq0mVamHMyYQbSMj/cH3HKIdMa7LxsTbiPw0jNXCFb lCJdGpijrkJiUIWW72fhCJ8DOvKSRnKnIo0rze9BsICvMZ3VQWQjXIgqzCHIgkk4ewPJ xJ49hf+xKBJ6m1ZkO4bSXDJ43kpo8YDULvk5F5iCd4sTasVHg9JBkFtb43BrOw1UpDRs AWotMZV15fXS1L1hJzIoJ/yNB1IgResR80IMix+k7uVjg1itmwMGemvwcXOzlnIoMPBv 69yAQoumYIDO6LtFt+uVx3vqFLF6JLdCOJvSMLb/iHSMLOA6+2R5ctYeGXp6XF+Wk+aC 6Xfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=FkgqB8W+q5bnu0D/dCHJoSUoH9fwF7IIAOTsjJXD3RQ=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=SfIwAogHiWzltIjI6eitrH49MHW6jGE2Ff/gbOgo3dBiA3Ae0VOF0od3BSlzYVo1Hq q47QOD1pqzU0cOFZW8ZY45l3w5MsKF3HObSYCWBKa8RhmpiwiBRVLFcMjdSB58qSTPQK AO3XB7AMXHQMJFFIPFD2hCCWZW9FJpN4oslvOwiPK4uUYlgCdZ9RDwFLb1u5yGcbX/rI bsd4ZsWl1Ws+sS4FTalrkHB3MpLlsOSmN3/bJAAmCKv76UlGp0n5iT3YHdfkXX/tu2bD QRjPWuimNxaF92tZPmTBQK+vRSF4jp0YgQeGmqV28egDsJ85Lldxi2U2wK6IkNiYmEjz diDA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=BnB1dM3Z; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BXVtwSnl; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=CqCtCkKu; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=Z9iCxY7C; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-48429f20001si2049309fac.122.2026.09.15.23.53.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2026 23:53:18 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=BnB1dM3Z; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BXVtwSnl; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=CqCtCkKu; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=Z9iCxY7C; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FkgqB8W+q5bnu0D/dCHJoSUoH9fwF7IIAOTsjJXD3RQ=; b=BnB1dM3Z75T6TkiYdt4liEVDhI IJDC9VT3JfhQJ+fAzFXhuCEQ3VXrebdfq1Gc2ejm+fM83A8NZFaN4K0zOHfwb8W33Y12Shj+L0d2a Ly/FqIm13L7bZZmpUHn0sAd1K/q22oWWv47L+vgrEMjUhGcS4vG6p1yaPkulxF4ghscQ=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1x6jW3-0001IO-Qi; Wed, 16 Sep 2026 06:53:12 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1x6jVz-0001Hz-RN for openvpn-devel@lists.sourceforge.net; Wed, 16 Sep 2026 06:53:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=fyQgrF5Ipkwull3dYlDG+VJucpyKg81I7KDThNvJq6Y=; b=BXVtwSnlzlmIY7sGmIesgZeeDZ R4/CGkt2WWtmns3ObOynDFI+rbKdVRmB/Zi906cI/Pq9KF8F+ecxSrbBfaldo9F0xb5ZuQEs8cJCe 1LOu4/6ixTqJwwHi+Bm0tG4zJ5JC1+7XzIDVmgBjLtKDvcRJW4RHNffV8+dGzEy2UG2A=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=fyQgrF5Ipkwull3dYlDG+VJucpyKg81I7KDThNvJq6Y=; b=CqCtCkKuSk3M7dFJGi0jS6GApM hQX/76TGzhZe2swLSb5JWYbJcVvHfhIbGMqdxSPxWOqwUo9xUMMEUB89Ns6f02fm8Mh0FMgQqHC+t u8JVSvEK/YLjzQgf+CRZFg1ZhdD3wL0wtvHsPO8Q45w8EltGhn4tv/Fxe3ZAngWJ2pSk=; Received: from mout-b-201.mailbox.org ([195.10.208.61]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1x6jVy-000672-N0 for openvpn-devel@lists.sourceforge.net; Wed, 16 Sep 2026 06:53:08 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-201.mailbox.org (Postfix) with ESMTPS id 4hl8j61qPfzLlyR for ; Wed, 16 Sep 2026 08:52:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1789541578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fyQgrF5Ipkwull3dYlDG+VJucpyKg81I7KDThNvJq6Y=; b=Z9iCxY7CBYNoUQITP9aTn2C1IL9kk4qvwiVc0PbWkGJ7XLrGhiH8saeDEsLdkWL83J/NHK /q3st0P48b2Ihu5g9dTCpDENnQ3N71pq3q4tiEbBZMF6C2CwrdRL2XlVyzdoFVLkV4c1kA DlP3+XA3RRR+zz81vkYeAuENdI/eAd3kb8il7D9g5YeyTHD4gCgORD5jJ0fvZgrbouvS2P RsCXHLP4UbukFJ4wVLGJ70vh6/pp+owWLaQVIne1oyf6lvFr1xGIShxrsVbwScGg600ijV /cbBPGIKd2GtBEbEGXqLvF0I2GUj3KTwhXgpSCSAiJAgYKYXCDW14bsosaxi5w== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=ralf@mandelbit.com From: Ralf Lici To: openvpn-devel@lists.sourceforge.net Date: Wed, 16 Sep 2026 08:52:42 +0200 Message-ID: <1bbfde37488ade61928554db3a119525adf7b608.1789540779.git.ralf@mandelbit.com> In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4hl8j61qPfzLlyR X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: ovpn already advertises software GSO support and segments GSO skbs in its transmit path. However, without checksum offload in the device features, the networking core has to segment GSO packets before [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1x6jVy-000672-N0 Subject: [Openvpn-devel] [RFC ovpn net-next v2 1/9] ovpn: advertise checksum offload for GSO packets X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1876470370864589144 X-GMAIL-MSGID: 1876470370864589144 ovpn already advertises software GSO support and segments GSO skbs in its transmit path. However, without checksum offload in the device features, the networking core has to segment GSO packets before they reach ovpn because TCP GSO packets normally carry CHECKSUM_PARTIAL state. Advertise NETIF_F_HW_CSUM so the stack can pass such packets to ovpn. Complete partial checksums after any GSO segmentation and before submitting packets for encryption, since the inner packet checksum can no longer be fixed after the packet has been encrypted. Also pass the ovpn feature set to skb_gso_segment with GSO capabilities masked out: this forces software segmentation, but still lets the segmenter preserve supported non-GSO properties such as non-linear skb data instead of needlessly linearizing. Signed-off-by: Ralf Lici --- No changes since v1 https://lore.kernel.org/openvpn-devel/1bbfde37488ade61928554db3a119525adf7b608.1789485693.git.ralf@mandelbit.com/ drivers/net/ovpn/io.c | 20 ++++++++++++++++++-- drivers/net/ovpn/main.c | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/net/ovpn/io.c b/drivers/net/ovpn/io.c index 9526f8096da6..112067ded401 100644 --- a/drivers/net/ovpn/io.c +++ b/drivers/net/ovpn/io.c @@ -358,6 +358,7 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev) struct ovpn_priv *ovpn = netdev_priv(dev); struct sk_buff *segments, *curr, *next; struct sk_buff_head skb_list; + netdev_features_t features; unsigned int tx_bytes = 0; struct ovpn_peer *peer; __be16 proto; @@ -392,8 +393,13 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev) skb_dst_drop(skb); if (skb_is_gso(skb)) { - segments = skb_gso_segment(skb, 0); - if (IS_ERR(segments)) { + /* force software segmentation, but keep ovpn's non-GSO feature + * bits so the generated segments can preserve non-linear skb + * data where possible + */ + features = netif_skb_features(skb); + segments = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); + if (IS_ERR_OR_NULL(segments)) { ret = PTR_ERR(segments); net_err_ratelimited("%s: cannot segment payload packet: %d\n", netdev_name(dev), ret); @@ -418,6 +424,16 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev) continue; } + /* NETIF_F_HW_CSUM requires completing partial checksums */ + if (unlikely(curr->ip_summed == CHECKSUM_PARTIAL && + skb_checksum_help(curr) < 0)) { + net_err_ratelimited("%s: skb_checksum_help failed for payload packet\n", + netdev_name(dev)); + ovpn_dev_dstats_tx_dropped(ovpn->dev); + kfree_skb(curr); + continue; + } + /* only count what we actually send */ tx_bytes += curr->len; __skb_queue_tail(&skb_list, curr); diff --git a/drivers/net/ovpn/main.c b/drivers/net/ovpn/main.c index 0708249e9607..28e1eb06e127 100644 --- a/drivers/net/ovpn/main.c +++ b/drivers/net/ovpn/main.c @@ -157,7 +157,7 @@ static const struct ethtool_ops ovpn_ethtool_ops = { static void ovpn_setup(struct net_device *dev) { - netdev_features_t feat = NETIF_F_SG | NETIF_F_GSO | + netdev_features_t feat = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_GSO | NETIF_F_GSO_SOFTWARE | NETIF_F_HIGHDMA; dev->needs_free_netdev = true;