From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 306993D9023 for ; Fri, 10 Apr 2026 15:10:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.150 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775833811; cv=none; b=rWJe1D1jgFmvoTBT1YwAZZR1RazgW+Yu72zGjBXrAZdBYufFjDbnLWqD/6zBxmRB0Xf+p93aB+th+td1lIsT3VcKHrfYSuxz6xSK400tcWywnphQyBAIjyNDsoh45oExBH0nAUG89QqbM5MlXfvL/TRuEVjU4fLV20SzUxf2fxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775833811; c=relaxed/simple; bh=nxnsrzL5r/C/+ZRUKWPTX9sgFQSHHCyhovFeBfpcrLo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q2cGFKwwddZyX8y29f+IZ367H23ETV0Sm1vK+kMYcdcJiIHr8Ja3SF4MIz8lKYjyNgKWw1xuQwWNi1Agdi44FrM6s6gPzVVOYa2kDDcAB2ndTXnxRPcHPZ+zpQWcETYPWk76Pwm4/S8mUc6eE6UvZysaqBp3cPawB3uh5bs67tw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.im; spf=pass smtp.mailfrom=fastmail.im; dkim=pass (2048-bit key) header.d=fastmail.im header.i=@fastmail.im header.b=OkCPx0UD; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HTvoajLv; arc=none smtp.client-ip=103.168.172.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastmail.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fastmail.im header.i=@fastmail.im header.b="OkCPx0UD"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HTvoajLv" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 7D422EC0442; Fri, 10 Apr 2026 11:10:09 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Fri, 10 Apr 2026 11:10:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.im; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1775833809; x= 1775920209; bh=Q4qdeOvCTl3pwS+MpklFN0PITR02yqluSW2YmSKW/wI=; b=O kCPx0UDDkwHKRlwJYBmhZqg78N/OBAlefr1FdUZdyR0txQTCipVVZBeeaQdyAYhF 04wz96Hhx/OFVZPXcbIpFZtH+vwLiRFcQ8dG4qTXX/nJsdBi13t87Gi6rqe63WOx TX4irnh+nG3Pmx3jCyYv+raLDQearbZ+Lbq/6uK6CUK6tEsMK4ymmlRgsbxi4CVA 0j16Vhi9VO+N+fmRjyKBaEUOAYo+92zXGU21fSY9BlK041XPPcYzZJ/15ZJ+h6fY Uj198BhpRowZBy4tI+FR60tOTWMq4r2xjh53XHr9WqNp7UCKtBxno0LPNDlQ+plF wb+nKXctjkaVUF9cGi9Pg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1775833809; x=1775920209; bh=Q 4qdeOvCTl3pwS+MpklFN0PITR02yqluSW2YmSKW/wI=; b=HTvoajLvYE0PCgxnX yRM1LZiAOzKkqN8vAGcWupLoP1VwUi47KisRb1mUkvWDLI/yu2H/q9aJ/52IkiIU /b5N1kj+348zspV7bHchjgrPI1A17iIasCaz3JxpdVlY5c8wtZrczMbgmJ4ZSwjY DVfeGi2khp2aFeGqOv5o/zUErlPy5u9dqOwr7+Ww9q9FYE4VUkYoaPYa9wW7u3oZ MJm3P/5Uiwh0FkNxuFXk0JrHx/uec/xDPzqvLnJdCRcbt1bxyiu8yZWWdYPZNWzR toKQjkLmhYI81go0bN2FIrJCwiuLSLcpCxdXwjHf1e1FTQbYyOjynCPQzhAkUrT2 SKnUA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddvleejfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetlhhitggvucfo ihhkihhthigrnhhskhgruceorghlihgtvgdrkhgvrhhnvghlsehfrghsthhmrghilhdrih hmqeenucggtffrrghtthgvrhhnpeetffeljeefvdfhheeijeelgfekleejveeugeegveet hffguefhudffgeekvddttdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmh grihhlfhhrohhmpegrlhhitggvrdhkvghrnhgvlhesfhgrshhtmhgrihhlrdhimhdpnhgs pghrtghpthhtohepudejpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegurghnih gvlhesihhoghgvrghrsghogidrnhgvthdprhgtphhtthhopegurghvvghmsegurghvvghm lhhofhhtrdhnvghtpdhrtghpthhtohepvgguuhhmrgiivghtsehgohhoghhlvgdrtghomh dprhgtphhtthhopehkuhgsrgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepphgrsggv nhhisehrvgguhhgrthdrtghomhdprhgtphhtthhopehluhgtihgvnhdrgihinhesghhmrg hilhdrtghomhdprhgtphhtthhopeifihhllhgvmhguvggsrhhuihhjnhdrkhgvrhhnvghl sehgmhgrihhlrdgtohhmpdhrtghpthhtohepughsrghhvghrnheskhgvrhhnvghlrdhorh hgpdhrtghpthhtoheprhgriihorhessghlrggtkhifrghllhdrohhrgh X-ME-Proxy: Feedback-ID: i559e4809:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 10 Apr 2026 11:10:08 -0400 (EDT) From: Alice Mikityanska To: Daniel Borkmann , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xin Long , Willem de Bruijn , David Ahern , Nikolay Aleksandrov Cc: Shuah Khan , Stanislav Fomichev , Andrew Lunn , Simon Horman , Florian Westphal , netdev@vger.kernel.org, Alice Mikityanska , Gal Pressman Subject: [PATCH net-next v3 02/12] udp: gso: Simplify handling length in GSO_PARTIAL Date: Fri, 10 Apr 2026 18:09:33 +0300 Message-ID: <20260410150943.993350-3-alice.kernel@fastmail.im> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260410150943.993350-1-alice.kernel@fastmail.im> References: <20260410150943.993350-1-alice.kernel@fastmail.im> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Alice Mikityanska Taking further the idea of commit b10b446ce7ad ("udp: gso: Use single MSS length in UDP header for GSO_PARTIAL"), simplify the implementation and fix the checksum (apparently ignored by hardware anyway). The mentioned commit started using msslen for uh->len, but still uses newlen to adjust uh->check. If the formula for check is fixed, newlen is assigned but never used before the loop, and newlen is overwritten after the loop. This makes msslen not really necessary, as we can reuse newlen, if we don't adjust mss before. The adjustment of mss can be simply dropped, because mss is not used anywhere else below. This brings us back to one variable, drops an unneeded arithmetic for mss, and fixes the UDP checksum. Signed-off-by: Alice Mikityanska Cc: Gal Pressman --- net/ipv4/udp_offload.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index a0813d425b71..2578aa7f9ff9 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -482,11 +482,11 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, struct sock *sk = gso_skb->sk; unsigned int sum_truesize = 0; struct sk_buff *segs, *seg; - __be16 newlen, msslen; struct udphdr *uh; unsigned int mss; bool copy_dtor; __sum16 check; + __be16 newlen; int ret = 0; mss = skb_shinfo(gso_skb)->gso_size; @@ -555,15 +555,6 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, return segs; } - msslen = htons(sizeof(*uh) + mss); - - /* GSO partial and frag_list segmentation only requires splitting - * the frame into an MSS multiple and possibly a remainder, both - * cases return a GSO skb. So update the mss now. - */ - if (skb_is_gso(segs)) - mss *= skb_shinfo(segs)->gso_segs; - seg = segs; uh = udp_hdr(seg); @@ -586,7 +577,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, if (!seg->next) break; - uh->len = msslen; + uh->len = newlen; uh->check = check; if (seg->ip_summed == CHECKSUM_PARTIAL) -- 2.53.0