Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp110039lqf; Fri, 26 Apr 2024 00:45:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxJb6hGoJkstIMBjoQrWYV5/9nzoi+IRsJb2JMcR2W6JZlp3fGO3TkD/1WuMa+G9X41p083YDI9bLGyjGq2bOllgql+VBfQ0OU78hSPw== X-Google-Smtp-Source: AGHT+IE5FEisyLupvUSF7Gvm99kedHGu7Y1gLyb8H7sZUQo+bZZz0ujbN23Jc103cZKbfeuK/G5R X-Received: by 2002:a05:622a:118f:b0:439:de9d:620c with SMTP id m15-20020a05622a118f00b00439de9d620cmr8757358qtk.20.1714117506833; Fri, 26 Apr 2024 00:45:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714117506; cv=pass; d=google.com; s=arc-20160816; b=oBi4LRj144dB2wuY2Q16Fomn1D/rCnfy0xPaSkODILk1Tflz7KKxDQ42cTuHSKznny 1wocrH7KR9z1b/bkkIgWgQloHLGHYMY8W7vOm6H/y41dmCCi4cHmX7J/0ndtl0yRjhc5 gYt3aoHdqm110hiMrfqd6xb3pNVc9qP8xAVDh6/ClwP7zd3YeR2txoEN0/fwPsGFH7tw ut3gn0NRVa/eK+tSmDCyqQGKmvRkKBZ8Sf12NBG2AVcaDwIh6SjPoHslsBo0CZCIxcBu CxLwohDkznZsoVPDEMzoRdNVmcDVpgtkaSOJD+M9Ll90jAMLW8H/OnjCbdGsSPzu7e1D uRbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=A33BurzJz4OQByTITh6Ot1PgPb3FP3Ow3zWOTt8U/FQ=; fh=L99XHqUYtf3ke9u7kBhOQUM/HmEwpigWRpHoc3kpSlc=; b=oSVHoq9tA6a06rv3GuwRwLo9P+2foJmCzEpOVpM2RsSLZwRB4+ZvB8AT0vSDAEwEwG 3QvvqdvRKRc7ZFsjAmGsdIT0ro8ASeQLw7APrmhKeTk2GvxXNzrw8nShi3+Du0aELtx7 +LXG75tDC/ZrLOnAi9Q3fgqr7/GEgC/DJ7xBjslFg8mKDQdkI88C8rbH+kXEM6vM4Grs xpnUvpJz4b0vcGcL/RRKbspHqOS1GJn+ZT+nqoMuzOU7mY0Z3719QLiBF5mf+aN9NHUN 4J83IbsjS+1ZzFakPCbs4KR8j6YTEAy4aLRLLPlv9C7jQINydMd7sn6lMlfDpWifIstE wKzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=oawk07lh; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-159655-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w20-20020a05622a191400b0043961134ddcsi16297850qtc.760.2024.04.26.00.45.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 00:45:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159655-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=oawk07lh; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-159655-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8B9EE1C20ABD for ; Fri, 26 Apr 2024 07:45:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44D3813C8FD; Fri, 26 Apr 2024 07:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="oawk07lh" Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF0F513C3EC for ; Fri, 26 Apr 2024 07:44:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714117497; cv=none; b=hh+x3pkuc3bcJxYbn+hnpzNc7R2v8De6+Q9kHDubvDUVZgaq9avxH7EB/KXJ4hA1XEIW0fXU9GqLg3FBWPASer2lCmXSnvHTxxE7tZAGM9nqC1q6r8DbWFb4Ztu7+WpW4hL8i0g0FmRcPNmtwqXIgd9E6AVtqRZBAUeuY9JblwQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714117497; c=relaxed/simple; bh=IAy3KSdWgKQ5Dy6jkMVe3ewR5lCzfv6BECAXxzU/b10=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=dbP+ZyShh1bmXbO59/3ApYx1RIUgTPJ42LjXTbmuOgRKv0XMv7iLcW0uy4nhbdIolkmLkzAPZ0h/6roFXMIrSX2zB35WMMvsqey4NXAOQIg5eP61O/vjpKdu/KfY2VwtrJhIUhOkhW4OqllhlulxtlUFzzIfp7vEVu1bLMHwjvA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=oawk07lh; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5724736770cso5191a12.1 for ; Fri, 26 Apr 2024 00:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714117493; x=1714722293; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=A33BurzJz4OQByTITh6Ot1PgPb3FP3Ow3zWOTt8U/FQ=; b=oawk07lhJBcKEp94xHEuT4kwtNRyk0fJ6jXQFmX8JTGtEEyc7zahwKQtM/GDNtSbIG 20DdU4UHCMpnTh1Vo4rSdKKs/2tg/iy0bjN1sfn7gkM+BHPJ0sX8XRdDIR/Q9I36g/R4 ryJVNu3Sk7JS4fB+FTlwJDi9VmTQ643IAMft3uJHrr9CFZFj1xFb9bxR2Bj1PfuMjyO9 o5DF/Le5mOmd4PImviZJzV6cTQCMPILS+DHAeRMSR5Yg0kET7UboBOHkkLJVnBaPEK42 4+mElj8jGyEZ42+pvJf5pQ892CRFDX7mOOX6Ss+B0sA7TPQNs4yLijQde8x/wevZfzqS GnfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714117493; x=1714722293; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A33BurzJz4OQByTITh6Ot1PgPb3FP3Ow3zWOTt8U/FQ=; b=TIC6T0uRpB12Xvq4iosc2QBG11JKNLIG6a2aViVNzaNSau7nPVkDng05I7+4hQn9pW mrSgz143+Wg5sBULLMhAtSgW/t29HBGh51xIar6w0l39TjVeCNOQUbrpMxTJOUCAbTG7 7FD4UUJE8lafbstZl9Tx4EVudyXjMI3i7eNdDUsxOH/jCCE/TENFUEH49kdTyg1RJSVy WPhJeDNyzQYuV2va/d5ZbIMl5I3XWed9HTJTD8YiNumC8F0WEJH0Ta9j20qvjNOMaJiy uF3lGoYUnUvflZsQlfOeXHv3HBoF2RgpH7Db+3gmaph12FZaeHcUvujFkUQBlTKif4lT UDSA== X-Forwarded-Encrypted: i=1; AJvYcCVwOsdywhjRSbmRlvyhu4uuYJ3ttvZNGdsvG3OSBZR+CyJu80d4Z0j/uqn/ew2dhkXXMqdxzZcDa9LxNpa8noo8Zpa35TdjPljI7zsQ X-Gm-Message-State: AOJu0YylBVKEc5rdUXmPtXRcSdraeMWOeciIRlJPv6uo3QvBipWTyBDe rZMdmqINduiN3qRiZYZOdkz3Pzi6KSXZUNs9ASq3/vk+QQX2o0Fij+vbGecczITuTOeKglFx+sw B8I7bcbYOXkROpeYna3XZov9AV47AFApVcM6O X-Received: by 2002:a05:6402:26cc:b0:572:57d8:4516 with SMTP id x12-20020a05640226cc00b0057257d84516mr47477edd.2.1714117492798; Fri, 26 Apr 2024 00:44:52 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240426065143.4667-1-nbd@nbd.name> <20240426065143.4667-3-nbd@nbd.name> In-Reply-To: <20240426065143.4667-3-nbd@nbd.name> From: Eric Dumazet Date: Fri, 26 Apr 2024 09:44:40 +0200 Message-ID: Subject: Re: [PATCH v3 net-next v3 2/6] net: add support for segmenting TCP fraglist GSO packets To: Felix Fietkau Cc: netdev@vger.kernel.org, "David S. Miller" , David Ahern , Jakub Kicinski , Paolo Abeni , willemdebruijn.kernel@gmail.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 26, 2024 at 8:51=E2=80=AFAM Felix Fietkau wrote: > > Preparation for adding TCP fraglist GRO support. It expects packets to be > combined in a similar way as UDP fraglist GSO packets. > For IPv4 packets, NAT is handled in the same way as UDP fraglist GSO. > > Signed-off-by: Felix Fietkau > --- > net/ipv4/tcp_offload.c | 65 ++++++++++++++++++++++++++++++++++++++++ > net/ipv6/tcpv6_offload.c | 3 ++ > 2 files changed, 68 insertions(+) > > diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c > index fab0973f995b..c493e95e09a5 100644 > --- a/net/ipv4/tcp_offload.c > +++ b/net/ipv4/tcp_offload.c > @@ -28,6 +28,68 @@ static void tcp_gso_tstamp(struct sk_buff *skb, unsign= ed int ts_seq, > } > } > > +static void __tcpv4_gso_segment_csum(struct sk_buff *seg, > + __be32 *oldip, __be32 *newip, > + __be16 *oldport, __be16 *newport) Do we really need pointers for newip and newport ? > +{ > + struct tcphdr *th; > + struct iphdr *iph; > + > + if (*oldip =3D=3D *newip && *oldport =3D=3D *newport) > + return; > + > + th =3D tcp_hdr(seg); > + iph =3D ip_hdr(seg); > + > + inet_proto_csum_replace4(&th->check, seg, *oldip, *newip, true); > + inet_proto_csum_replace2(&th->check, seg, *oldport, *newport, fal= se); > + *oldport =3D *newport; > + > + csum_replace4(&iph->check, *oldip, *newip); > + *oldip =3D *newip; > +} > + > +static struct sk_buff *__tcpv4_gso_segment_list_csum(struct sk_buff *seg= s) > +{ > + struct sk_buff *seg; > + struct tcphdr *th, *th2; > + struct iphdr *iph, *iph2; I would probably add a const qualifier to th and iph > + > + seg =3D segs; > + th =3D tcp_hdr(seg); > + iph =3D ip_hdr(seg); > + th2 =3D tcp_hdr(seg->next); > + iph2 =3D ip_hdr(seg->next); > + > + if (!(*(u32 *)&th->source ^ *(u32 *)&th2->source) && > + iph->daddr =3D=3D iph2->daddr && iph->saddr =3D=3D iph2->sadd= r) > + return segs; > + > + while ((seg =3D seg->next)) { > + th2 =3D tcp_hdr(seg); > + iph2 =3D ip_hdr(seg); > + > + __tcpv4_gso_segment_csum(seg, > + &iph2->saddr, &iph->saddr, > + &th2->source, &th->source); > + __tcpv4_gso_segment_csum(seg, > + &iph2->daddr, &iph->daddr, > + &th2->dest, &th->dest); > + } > + > + return segs; > +} >