Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp154910lqf; Fri, 26 Apr 2024 02:39:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdWFXsTR/pjap6LVni1qH1oC++B1dI6UzHAErrfNNREU3sV9a6PX6zmVwI18Xa+g62xc6h/dwborV1oz7HTNB2KZaL+BO4snADzE6jFQ== X-Google-Smtp-Source: AGHT+IFkpbKR4f6knqh9H6xMnfq7melye82SS0thO8vALd0M5emij/kHYpMpMdRMN6dZiUDCO8d8 X-Received: by 2002:a17:906:3614:b0:a51:de95:f592 with SMTP id q20-20020a170906361400b00a51de95f592mr2130308ejb.63.1714124393370; Fri, 26 Apr 2024 02:39:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714124393; cv=pass; d=google.com; s=arc-20160816; b=N7t5H5Wc/+UBvo4OrNwT8fRSjI08bXzObajyOV/PO4cw59SCSwtPwkzhx5LBvIeIXW J6stDoVpt6f/eqWdoWO93WFuX8C9t2+nAmMUW1udCa4mgH+BJtLrH7owspXk+DAg/29t IfEtTNAOA/8pS3wGUNGNJs577+7ToxMmZbcA3lgzzDdSNxfR7eQ55ZGy2SpTzx9aDGK5 jHgk88VBreqU7XqRESTIRHfayeg/9/dX9rSEseNpiMjwpfxtGI2yg6LfKobF1i7XrNXh rnmxoLAXCXamfi1z3V4YqlcF/svf57L39kaWIXVaCmInO5NBW2rWQ28GuNbTkVQEZdZb njNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=D/C00mYciwib9Vm5DuPUx5AWbZneVokRlK3ybHxbCNM=; fh=Gbu5VKP9pHFMOtrTTUAHv33gxh+S+imJmBKvbHJcbrU=; b=UFvOt4vpBnWPJH9DV+05CiJSm3iR397Dkmn2ctdBNoTiN+IIUrxFc7q0oEnMEoDorF eoJDkXM0Oq9EQYBhpFnlVX4Y/u57OWdUZE8PYKPC6Tmu7vdnp8gzopBbpcZLS05vNw3x L4Yk2xNrfrab17hXDZRKh90/EL5repEE5fsSkhpaEkTC1UuxiP2dYuHCQePBhSyOcUxI c8iTH+a+11lH9sFTvpob506/J1rr0LhNJ4/L6O3K4zCJFf8IsApDNv/mBA+xJYiMWUZw qka0thL02Bu4z3vWM5nsS3+YCOROw1PQywkbzr3CCusT91dJe2rls4L51SfT1FfDJ9ul Lc+Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=GU2VPrQA; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-159804-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f25-20020a17090631d900b00a55b10cc51fsi6656127ejf.1038.2024.04.26.02.39.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 02:39:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159804-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=GU2VPrQA; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-159804-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1D2FD1F2330C for ; Fri, 26 Apr 2024 09:39:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BB9713F440; Fri, 26 Apr 2024 09:39:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="GU2VPrQA" Received: from nbd.name (nbd.name [46.4.11.11]) (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 F1D337EF; Fri, 26 Apr 2024 09:39:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714124382; cv=none; b=OvjcG8DueyW57AaypYWe13kKINMtZPv4gg1ygvNJm9hiG/cDW3JD7mbI1iDCuKJ7iJIBCvXNaMt2dOHDZOldQCgN9x7ojcJ5Tj+UrVb13mGSk51mlj8LcUNupDrYg/RCDqkOAe18LlVPUQ4+ZnNK5ckoXQ9Yv87xDVpqJetDpVg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714124382; c=relaxed/simple; bh=oaDdFl/3lgKvaVpqyoxY9BccUbOJlb/+jgS8suJ9HI4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Jk40jWLFPbrlOxYI1NL4FDT4KLwg/s/obKOHlU3zO3zI8B4YNNgiQ/PDOmHqz5sTGy77o7HNsvRvmZ/KM6y7m7LrLayfFMjv5nnraAiyP/kfluZwufzzrq+DkdX0s55LSovlHKLT0ceRzME55nBWyBan2/qpU63P8J10dTeWHaI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=GU2VPrQA; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: 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=D/C00mYciwib9Vm5DuPUx5AWbZneVokRlK3ybHxbCNM=; b=GU2VPrQAlYACd2vH5y6/+5Zl1s UWkupDc2hiIEE1PrlTBsj/cWxOURhCQUiE8a6HPS3j3i88QKeoBGo2idcEmq5zaH9JC3hp8ClQEow R0/g2PJgPZBX2Tagqf19ZZFQlv/DFYLBb8noUw6wh6fA9+Vi0wbnud/gepjCp3auEFdU=; Received: from p54ae9c93.dip0.t-ipconnect.de ([84.174.156.147] helo=nf.local) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1s0I3I-007sy5-28; Fri, 26 Apr 2024 11:39:32 +0200 Message-ID: <9350b6f7-abd8-45c5-931a-62f48a50bee4@nbd.name> Date: Fri, 26 Apr 2024 11:39:31 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 net-next v3 2/6] net: add support for segmenting TCP fraglist GSO packets To: Paolo Abeni , netdev@vger.kernel.org, Eric Dumazet , "David S. Miller" , David Ahern , Jakub Kicinski Cc: willemdebruijn.kernel@gmail.com, linux-kernel@vger.kernel.org References: <20240426065143.4667-1-nbd@nbd.name> <20240426065143.4667-3-nbd@nbd.name> <5a95fea4156b492eb19124bb33b21be81766c617.camel@redhat.com> From: Felix Fietkau Content-Language: en-US Autocrypt: addr=nbd@nbd.name; keydata= xsDiBEah5CcRBADIY7pu4LIv3jBlyQ/2u87iIZGe6f0f8pyB4UjzfJNXhJb8JylYYRzIOSxh ExKsdLCnJqsG1PY1mqTtoG8sONpwsHr2oJ4itjcGHfn5NJSUGTbtbbxLro13tHkGFCoCr4Z5 Pv+XRgiANSpYlIigiMbOkide6wbggQK32tC20QxUIwCg4k6dtV/4kwEeiOUfErq00TVqIiEE AKcUi4taOuh/PQWx/Ujjl/P1LfJXqLKRPa8PwD4j2yjoc9l+7LptSxJThL9KSu6gtXQjcoR2 vCK0OeYJhgO4kYMI78h1TSaxmtImEAnjFPYJYVsxrhay92jisYc7z5R/76AaELfF6RCjjGeP wdalulG+erWju710Bif7E1yjYVWeA/9Wd1lsOmx6uwwYgNqoFtcAunDaMKi9xVQW18FsUusM TdRvTZLBpoUAy+MajAL+R73TwLq3LnKpIcCwftyQXK5pEDKq57OhxJVv1Q8XkA9Dn1SBOjNB l25vJDFAT9ntp9THeDD2fv15yk4EKpWhu4H00/YX8KkhFsrtUs69+vZQwc0cRmVsaXggRmll dGthdSA8bmJkQG5iZC5uYW1lPsJgBBMRAgAgBQJGoeQnAhsjBgsJCAcDAgQVAggDBBYCAwEC HgECF4AACgkQ130UHQKnbvXsvgCgjsAIIOsY7xZ8VcSm7NABpi91yTMAniMMmH7FRenEAYMa VrwYTIThkTlQzsFNBEah5FQQCACMIep/hTzgPZ9HbCTKm9xN4bZX0JjrqjFem1Nxf3MBM5vN CYGBn8F4sGIzPmLhl4xFeq3k5irVg/YvxSDbQN6NJv8o+tP6zsMeWX2JjtV0P4aDIN1pK2/w VxcicArw0VYdv2ZCarccFBgH2a6GjswqlCqVM3gNIMI8ikzenKcso8YErGGiKYeMEZLwHaxE Y7mTPuOTrWL8uWWRL5mVjhZEVvDez6em/OYvzBwbkhImrryF29e3Po2cfY2n7EKjjr3/141K DHBBdgXlPNfDwROnA5ugjjEBjwkwBQqPpDA7AYPvpHh5vLbZnVGu5CwG7NAsrb2isRmjYoqk wu++3117AAMFB/9S0Sj7qFFQcD4laADVsabTpNNpaV4wAgVTRHKV/kC9luItzwDnUcsZUPdQ f3MueRJ3jIHU0UmRBG3uQftqbZJj3ikhnfvyLmkCNe+/hXhPu9sGvXyi2D4vszICvc1KL4RD aLSrOsROx22eZ26KqcW4ny7+va2FnvjsZgI8h4sDmaLzKczVRIiLITiMpLFEU/VoSv0m1F4B FtRgoiyjFzigWG0MsTdAN6FJzGh4mWWGIlE7o5JraNhnTd+yTUIPtw3ym6l8P+gbvfoZida0 TspgwBWLnXQvP5EDvlZnNaKa/3oBes6z0QdaSOwZCRA3QSLHBwtgUsrT6RxRSweLrcabwkkE GBECAAkFAkah5FQCGwwACgkQ130UHQKnbvW2GgCeMncXpbbWNT2AtoAYICrKyX5R3iMAoMhw cL98efvrjdstUfTCP2pfetyN In-Reply-To: <5a95fea4156b492eb19124bb33b21be81766c617.camel@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 26.04.24 10:28, Paolo Abeni wrote: > On Fri, 2024-04-26 at 08:51 +0200, 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, unsigned int ts_seq, >> } >> } >> >> +static void __tcpv4_gso_segment_csum(struct sk_buff *seg, >> + __be32 *oldip, __be32 *newip, >> + __be16 *oldport, __be16 *newport) >> +{ >> + struct tcphdr *th; >> + struct iphdr *iph; >> + >> + if (*oldip == *newip && *oldport == *newport) >> + return; >> + >> + th = tcp_hdr(seg); >> + iph = ip_hdr(seg); >> + >> + inet_proto_csum_replace4(&th->check, seg, *oldip, *newip, true); >> + inet_proto_csum_replace2(&th->check, seg, *oldport, *newport, false); >> + *oldport = *newport; >> + >> + csum_replace4(&iph->check, *oldip, *newip); >> + *oldip = *newip; >> +} >> + >> +static struct sk_buff *__tcpv4_gso_segment_list_csum(struct sk_buff *segs) >> +{ >> + struct sk_buff *seg; >> + struct tcphdr *th, *th2; >> + struct iphdr *iph, *iph2; >> + >> + seg = segs; >> + th = tcp_hdr(seg); >> + iph = ip_hdr(seg); >> + th2 = tcp_hdr(seg->next); >> + iph2 = ip_hdr(seg->next); >> + >> + if (!(*(u32 *)&th->source ^ *(u32 *)&th2->source) && >> + iph->daddr == iph2->daddr && iph->saddr == iph2->saddr) >> + return segs; > > As mentioned in previous revisions, I think a problem with this > approach is that the stack could make other changes to the TCP header > after the GRO stage, that are unnoticed here and could cause csum > corruption, if the egress device does not recompute the packet csum. On segmentation, each packet keeps its original TCP header and csum. If the stack makes changes, they apply to the first packet only. I don't see how we could get csum corruption. - Felix