From patchwork Wed Sep 16 08:35:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 5357 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6446:b0:8a0:ea1f:253a with SMTP id n6csp5930056mag; Wed, 16 Sep 2026 01:35:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwJSiPHKizcWNleHr4kuoIUh7m6kge45iTXQ8KhgAa1qfD2NC1rDHVOvMR6OGz77/wICN3X5E6H6m8=@openvpn.net X-Received: by 2002:a05:6820:2012:b0:6c6:9743:e118 with SMTP id 006d021491bc7-6c7d1bc8514mr3307770eaf.8.1789547748567; Wed, 16 Sep 2026 01:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1789547748; cv=none; d=google.com; s=arc-20260327; b=Iws29LlQDDezhauqgnvibvIbodYkolUcv6V26QG/gEXMs70FeJi7dd0crqi4djnxiF 2RO+PH3pn8KE4qicT0DEeMag8CCSfdWabMvJkLgJhk8vci27868vvKD02IbqJdJYgcgF Q7lUauPQw7JUCK9acJuWQ+rkibzjdek78ELJi9fbMcT4T6EJgRQmRXyeNItwp4D+FV/1 llFgAtuL3F02fGHlC6nSO4fY9PnZ8V6jZEJnhM4RWCWV+0G/tnWzH3OVN9KSgyChvhgb CBmLdyTNT3DrkAMw7MwH5Kal97Y3CHlY67Ee2M44h8HsTtXlSIG3QGUkgtpoZb+lg4Vp v3mQ== 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=jlX0s5H+x2Q/mV73j+18lEUJG3VMB9oItXO9tda0NIQ=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=QPsTYiVwGDI9dBcM6x2J9JHtVo8o7slS2mOMDxvkWbYjE4lOmCnhI7q+ynVRnnHVEO l8tZw0L57PeCY/4i9ZiIZ/BraifgSrIO8Wxyc8QLXRPHVpUGhA5x0VwHFCgHrJdmTjQL YB29E1+xsKNyZlqR8D7XZhE60cer67V4jZ++uQdDRGIPca8uGZYeJ1BxTtWXpifGdjPX lqmQRr2YJ1r6Qog0+gpEJMJo518EVoCebfHp6IO+Nygk6jMH/6NsUT4I5O7vXaTxRSg6 zUs6+D0VS2oGzX7eE/ZpF6lTIGjhrxq2bQttL/jOi1eZfUHypXn0aMmmV+0SOK78m9RZ 1erQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=EQzOLpny; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=UyOulbXL; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=JiMzGQjI; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=c4bLSl4B; 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-4842aac032fsi2492658fac.312.2026.09.16.01.35.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2026 01:35:48 -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=EQzOLpny; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=UyOulbXL; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=JiMzGQjI; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=c4bLSl4B; 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=jlX0s5H+x2Q/mV73j+18lEUJG3VMB9oItXO9tda0NIQ=; b=EQzOLpny1+L7FEJi9kQLtQADQR 14mxrqSTpGSJGmiXRF4JSDLtliNS5X+RKbZEsL0IwC/+1fnHwxWw7ejOZ7Km4swXhZO/w1hifJl/X qRda5Ifq1z20tet0/FO4St1McSXJldE66Dzq0EOc0UUjDTeCEJcCE3oGlp6NGgOdOkV0=; 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 1x6l7G-0004XZ-6G; Wed, 16 Sep 2026 08:35:42 +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 1x6l7C-0004XQ-HM for openvpn-devel@lists.sourceforge.net; Wed, 16 Sep 2026 08:35:41 +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=6+ZJJ8XiuDG++HUlfyuIY73IeUadtL79nf1exCRGXkQ=; b=UyOulbXLktp3BrzHvLpys/CU4V VIr32fIJwbpfKSPrA660eVatqmFktv0K4ptIQEYTeji+RHkS/BGfDn9j/JC08qq1ZuryOdW/cIVOM aCJus0UaQ3SgWsRuYre/5u7N0eFXnZA4ALwLx4I4Lto8RFV2kEOwNgV8t2BkN+Vs6NnU=; 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=6+ZJJ8XiuDG++HUlfyuIY73IeUadtL79nf1exCRGXkQ=; b=JiMzGQjIS7IK5c8FQgo7BSbdj3 SlcmPQm02DJY8XBKwPigV8k7xNjM22qnzU2QXrtceNKNdFsJl8k1k9utRi/nNo6NVVCq2WiEC3qxX gRyx8mjBb3s6Ojx4nN7WO2m0hD2xF+8xJXKlJ6+T65qcZUlpKhwJVD8Sm1VJ+7DfFz+M=; Received: from mout-b-107.mailbox.org ([195.10.208.47]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1x6l7B-0000lq-RY for openvpn-devel@lists.sourceforge.net; Wed, 16 Sep 2026 08:35:39 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (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-107.mailbox.org (Postfix) with ESMTPS id 4hlBzP3w9Zz3yFR for ; Wed, 16 Sep 2026 10:35:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1789547729; 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=6+ZJJ8XiuDG++HUlfyuIY73IeUadtL79nf1exCRGXkQ=; b=c4bLSl4BJ0RaBraLRFqThY4IpyU90P3Stp1QOBxmOnAZCpJ0X28qc31Ghmz7kRAYSN60X6 8vtDZAz+tqD2cU4SvbhWT1Gpj9wiuwPRm4Hs2IzNpPUx+4+7BzZKoh7jcel3gfCSzZHNA7 banJH9rkP28Gq8+sYWNUHA9sHuugZwk3PidK54TwLm0i7HYQMrsf8d2y7EMWtSwUO5GYGn wS3X5Ckm7b/TRah5tVCo1RfM+XMwjePUKTRf0L74yStujhRDOyT2TGgeGcYF84qzI7/Oq9 w1S5psct4+bwDsC+W8w0JBAFHhmMzCIenXoZW9V0JxPG91AhhzmqnDMrtg6luw== From: Ralf Lici To: openvpn-devel@lists.sourceforge.net Date: Wed, 16 Sep 2026 10:35:10 +0200 Message-ID: <1bbfde37488ade61928554db3a119525adf7b608.1789546917.git.ralf@mandelbit.com> In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.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 Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-Headers-End: 1x6l7B-0000lq-RY Subject: [Openvpn-devel] [RFC ovpn net-next v3 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: 1876476820070469529 X-GMAIL-MSGID: 1876476820070469529 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 v2 https://lore.kernel.org/openvpn-devel/1bbfde37488ade61928554db3a119525adf7b608.1789540779.git.ralf@mandelbit.com/ 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;