From patchwork Tue Sep 15 15:23:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 5346 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:30c4:b0:8a4:a7c2:8138 with SMTP id n4csp3642482maa; Tue, 15 Sep 2026 08:26:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBz11BIul28ZMn0ppKjIxTUJi3u1dYAVHo1PkFxM0/FVXFRXe5bX5/f1fOUhpOyBqRntj7SY/fEOaJI=@openvpn.net X-Received: by 2002:a05:6809:184:20b0:4b9:e65b:8c36 with SMTP id 5614622812f47-4c9ab4b3cf1mr905320b6e.36.1789485863014; Tue, 15 Sep 2026 08:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1789485863; cv=none; d=google.com; s=arc-20260327; b=ZNhbMH+86SXkPfyd083r4uO7ocagK5gg0vIwOgyClxj4pfJq+zxGxIviTodPOLXmoI hGTNQoJYR4Ih3FU04XFMRbHyxt4m1DZtWVBj1NwsFqulUsnGCAuO4h3dKpmLrL0XHtKW 7PyV8y2qmry4ZY8hP2OVv1quZS7b1adSYIBxeEfzX/m8UIZX12Uewsbln3AbaiL7T6+r BsraliequBiINSkIF038rOPTLqiSE3aq+8RFZWsNG0lfdPrB8nagaAmM0i4WatOWL8hc 1c+mZQX9SoV9dsTNuEADhmIOxZbdv8hWYaXHo48QdLh11fqpKGv/dtnaIDohASrCbaHy HzQA== 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=FkCwVfT4Am+dQXmRyLA16Gsh4uWbF70yHJgi2lZYQOM=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=WKAcdxqENKbpxJyOWl1dBXi9AC/64TZC7dJysSbYUSNBfUU3UYzN0nemmfdVw3ExzP JmPyHoVyTAxFfB0mYckeZW7F49z4Al2SUSLZF1E91wmmyZmsbVqmsC9XVHZBSSPaFKLr oG5eG96EIzPLZ+zxRccGTNtisNHmlcx2T+xEz1e1yTaadGBUU+a2kLr/QePIbBFGAtp+ EMF/NUFoio1bzovvNBzbG7m3i5Ibm/EKdSmErLqJ/ZH04dO7NRsT2kgJ6ZIwd2Rv7dPB phnmiUdSabPjVQs6VjhO9rFJBr5/74756UNGB5ei4SOf8ncd+rLLkmX9v/cwi5kTRE9g 0jvQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=hipNzePq; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="DT2Qbg/p"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=juRVviO1; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=Z61e+cM1; 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 5614622812f47-4c7b8fc1977si4692416b6e.92.2026.09.15.08.24.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2026 08:24:22 -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=hipNzePq; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="DT2Qbg/p"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=juRVviO1; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=Z61e+cM1; 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=FkCwVfT4Am+dQXmRyLA16Gsh4uWbF70yHJgi2lZYQOM=; b=hipNzePq5y+6v7m+PR1QHL4A4U yNwb02QKGi6yFUN42gQZpkMXbD9WER/mnGcpvED0eyMZeUOK3oH4uqAl/NOTxivoWt5zsmLYJNo2G zcwL1GoC6cegM/ZItGDKRcwjupC+xIlHTmkJYJWyndm0ZzFCkFmALFeSebPbUCL3SdLk=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1x6V16-0000JL-JZ; Tue, 15 Sep 2026 15:24:17 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1x6V11-0000IU-Al for openvpn-devel@lists.sourceforge.net; Tue, 15 Sep 2026 15:24:13 +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=VresLWD6BJvlpegALgISoARrJWJkgDuZoqGTBddC6EQ=; b=DT2Qbg/pTSPSbs6hjGbf4MUZL+ UjMEblrvb41zeNySE9uXPXQhm8J1OoVuctUyNxnqICoVcd86JuzEYbVcRhoX9+S9a/Y+irEHf/KnG 8HRMW9yPh2EB5U/pkHJQ69JDyJ3Qm42IxptwTq7MZRD+hAIviD68saenOGq/dsxeIyHQ=; 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=VresLWD6BJvlpegALgISoARrJWJkgDuZoqGTBddC6EQ=; b=juRVviO1sthhJJxwak3A30zm+N /gKK8ipxKii3R6NO/bxx4eC68gIHt9A8jFNaMeBAV5HKFILVkkg42olwd2328xF8je3FQWrfTgZxY GMbycb6wj9a/RcKj3IH6M0KYiONwnKRHbbo+SY1l/ClDi4PvkhHgzX0t2PLo2h9d0d3k=; Received: from mout-b-201.mailbox.org ([195.10.208.61]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1x6V0z-00076y-TD for openvpn-devel@lists.sourceforge.net; Tue, 15 Sep 2026 15:24:12 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (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 4hkm5G0pthzLmDM for ; Tue, 15 Sep 2026 17:24:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1789485842; 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=VresLWD6BJvlpegALgISoARrJWJkgDuZoqGTBddC6EQ=; b=Z61e+cM1ttWIg149D3w2/0iG4nAjg/U7j6HtIXc1uOiB4IqGEkQM2Lg38Fl9J2rg9rcMQv Bee+IjvSxKQN+RSIhz//+R2ZpjYxeeMgc7R5vZrs0UY+4/vy6VuCWpr/N9MeQPqEwyAojA gQ3uRnutKp21clj9omVe4+KrhX216Q0xbfU5q+Kx6DDyZfFmXXNDhK9V6sw0ue0PnZCzea IwEqfuuLV4WwKge4fW2I6Xt1mK1rT6GuCkw4RykSnZe1iOrRkkxx6z8BzdCgFHl9up5JS1 idy6F/37Amg2D32SjxyF5DGZE+drZqDzbKZ2gy6vmKUD/3yNgPBzzrjLNo3DgA== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=ralf@mandelbit.com From: Ralf Lici To: openvpn-devel@lists.sourceforge.net Date: Tue, 15 Sep 2026 17:23:49 +0200 Message-ID: <1bbfde37488ade61928554db3a119525adf7b608.1789485693.git.ralf@mandelbit.com> In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4hkm5G0pthzLmDM 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_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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1x6V0z-00076y-TD Subject: [Openvpn-devel] [RFC ovpn net-next 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: 1876411928584655789 X-GMAIL-MSGID: 1876411928584655789 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 --- 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;