From patchwork Thu Oct 1 08:41:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 5426 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6ac1:b0:8b3:6e77:b38b with SMTP id v1csp1809819maw; Thu, 1 Oct 2026 01:43:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwgd94izFrFX17r4cR0aXWbKLe02vTdTB55du3rrfid2dEYSEhmRVpwPmSs3qu6zKeDjtyQcEWu3sA=@openvpn.net X-Received: by 2002:a05:6820:1905:b0:6d7:d91d:d77d with SMTP id 006d021491bc7-6dcf5a252a6mr4485790eaf.58.1790844118954; Thu, 01 Oct 2026 01:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1790844118; cv=none; d=google.com; s=arc-20260327; b=EDjcW+vRnLwMJhYTUSMQLavMXqCkgj8SYPbmr3gc3kCA/2JXVpei4TiYmDT8HkoV1B vvGAdNiFNCaBGGDqbhchn1aXWW2yj1QP54gMFuaqMBJ5qvudF22WgOaHh5fsGdkXpHyz kETvPOyvjk1RXo/femsIucUy2z6/4IBUBY3h8wzhiXMpqHx82egI+wzpzoT1R9hWPLap uoh+36dhpOBkdrb3ViZhm0KSpdTQ8xbQeMb+awIZuP0m6G5RYsvfZoUU/kvwoKg7Gaip cSDLnGnbVbchpvWeZG13WDzQec3y1dS9huiTJOtxpx9T/4yv8bmuHbx9N9k8gdLlBmft bGEw== 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=9Y9soyHYxCfkrXbCiOt3Ha1FjQcnK8weo+LpLMGJsOw=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=d2oi+S2v7Jbu4jorwIjnO7taBKsmx+DfN7XpkhyxBaNEtb4UVxMrkDwVHJ+qSRZP4n Dx3UDalC6xpT48JIkRvgPwlGzTdS87mJ6jiTgQMClJGGH4idYSXDdyPodk5jCZ41Nrtw CBZPLAG7Gc2v6Tg2KMQ24qEwEcrKVNee7jx32S3jZJLpz2RvkWm412GiI/kC7XG64LUk gL+ZKTGdydZ3jVhCFLEn1rhfDKMU1AftRIXSZHE+p0zddw84pyOfQuLR4pMTcGQfv6ev mBPV/7MQbVlHvrXAe0TrGKsC/7VQ+zrbfOQZrXaMXnszhwpHGEptMkFDcAaxgbljjaHd bRcA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=VSGYk2JG; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Cbel1hlV; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=nB0ZHz5G; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=WJoHpIvg; 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 006d021491bc7-6dd9a3ba1bdsi4120784eaf.85.2026.10.01.01.41.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2026 01:41:58 -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=VSGYk2JG; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Cbel1hlV; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=nB0ZHz5G; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=WJoHpIvg; 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=9Y9soyHYxCfkrXbCiOt3Ha1FjQcnK8weo+LpLMGJsOw=; b=VSGYk2JGYCUkR//4lj3BfbLmlD iYXDWepmB1X3AC29vfhQrOtSHF0JfhJIp4X/+SVX3VRWVycmilDGyUQ0mbpBIzty5QLFsnpCDGXxp xk0Izonxo0EeD0drP8nptnkaANs+/K6phPp45u7aVdl7LmwzvkIKZacm530f/Z9Lsi/k=; 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 1xCCMO-0003jB-Sn; Thu, 01 Oct 2026 08:41:49 +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 1xCCMK-0003ia-JC for openvpn-devel@lists.sourceforge.net; Thu, 01 Oct 2026 08:41:46 +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=M+3M5N0W2yUD4QwFybZmQKY1rBi566Rz2HRECDCDDEc=; b=Cbel1hlV4VZl1I7d0Vm+0X+jKy GqYfBuGZXxol/bLogrQ12VtVm1dRaIuihrDOFboIhZa80pj8x3WmGKAi2nAuLPxb6/3Dm4Hu2/eh7 RkK3W9atPnn/v4HblKRBLGylKyeyvpEloD13GYlLNGQHXe0AYb3LeVM8oINESYlM7Y1g=; 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=M+3M5N0W2yUD4QwFybZmQKY1rBi566Rz2HRECDCDDEc=; b=nB0ZHz5GQo34ql5zo3HriTZPqm QMWpMK7zclGDgTnEPIVyXkTbjKFeQoq2LrVei8MIuXbr4Q6yT3EnHpCY4ZAZde7FZ9u7vyaux/7Qh j9eHWJ3FtSUoGnpdhXueY38/WF/fjT2whWDOdQg6vfVI+PcilmZkGJmCLdEMnpx6qX+o=; Received: from mout-b-206.mailbox.org ([195.10.208.51]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1xCCMJ-0002wj-Pn for openvpn-devel@lists.sourceforge.net; Thu, 01 Oct 2026 08:41:45 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.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-206.mailbox.org (Postfix) with ESMTPS id 4hwQPW5JlfzSW for ; Thu, 01 Oct 2026 10:41:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1790844095; 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=M+3M5N0W2yUD4QwFybZmQKY1rBi566Rz2HRECDCDDEc=; b=WJoHpIvgp4uXnK/ARMTCAaab7+XEM3lhlEx8pQKCyrTzwDxaBxRoBA3/h7sea1Th6n3OIR k6Uyo1I077dK72qTL9byGW2YWhAqY9JLN2175NBXETVnO0D2CpFGBFJqRaltvwFSeoehdQ skFHbrN63ZROtUO4fpL0G5lCeLKOIfIVo6u/QLtd6a1UdlCE3/KOcshIwAfaz6zyfza2D7 EfC0zQFbjuUslfsIavIqvxQGQIyPN2AcYW36apuWKiffSSZjnAJhjNimX8McGhpWX9lQeG fiQduL301ObeAJho8p/qQ23rDuqiXJPll7cl5EGW8yk0zALbYaRFHQhUvP5Cfg== From: Ralf Lici To: openvpn-devel@lists.sourceforge.net Date: Thu, 1 Oct 2026 10:41:20 +0200 Message-ID: <1bbfde37488ade61928554db3a119525adf7b608.1790843153.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 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1xCCMJ-0002wj-Pn Subject: [Openvpn-devel] [PATCH ovpn net-next 1/8] 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: 1877836162555377164 X-GMAIL-MSGID: 1877836162555377164 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 RFC v4 https://lore.kernel.org/openvpn-devel/1bbfde37488ade61928554db3a119525adf7b608.1789558856.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;