Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp991111lqm; Thu, 2 May 2024 01:46:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxoW8+a7LtXmJvCt+QxJRS1iUx//ucJpc1Luw0I/JeWgZ2jqUFhrcGVkEBPqGvC1hZYyGbDIIlXxKFvNYdQA6iIZTm0kiSmWh+6ES1Ug== X-Google-Smtp-Source: AGHT+IE3NOCmYkixT5YRRUb4JvCKrntshMdFd+9pMZEQARO8qufRDglatPw6Kl4SPBrUuMVv+YBZ X-Received: by 2002:a05:6870:9724:b0:23d:f5fd:a0c6 with SMTP id n36-20020a056870972400b0023df5fda0c6mr1061218oaq.25.1714639573291; Thu, 02 May 2024 01:46:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714639573; cv=pass; d=google.com; s=arc-20160816; b=lgfWhscuGLKWgAQCR/C4TufcbAbUhaI2c/2Icdr0n2uz6MwoByejtE1VhcwWyVMzj2 xNTfK4lV25FWOOLq/YlueUs9a5iXykLNglbBN8ovUHoL0GQWYfiImZ9+Z+QcFqaMuu/d 7emdO2wllpRWFumUmckijuXEWPW/A1Xaz3dYo+iNtUTWgU0uCC60D183bJd1E0ArlHVO ANT9hDsSOSbufmFZE0AQAuadpD9L5YPMOPYwf4+1mYn9ZMueA56r7v9s/1SZHV69P8YL OmVijiw9K50LtJg2D4cwdt/8qUl9Q7+X6LDCJSwBW1eNQVNZne81geGnm5iuIa5XOzm8 TTFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fg/6cT3jAJK1vqwjodbXWEwb5gy6rm9+zRAdButCrKg=; fh=2UbUgTfeWurEVRdEHvoH7tS6zQOJWd6bxNx0UHIIt2A=; b=uXlcbQEfG5YfDGcUbGJJFQ/5QOvOcPPelsA26OJTeYJOEgZsYNSLUoZmMNTCNpYj0Z 6aNH5HC9Jf5NssvgAG4/gGHjuZQG4eI6SQ9f4rSgv/+6SlFjNNYFE5XbwdDMyH8kLDks 1bUdWKPsIk+z7S0PwzEV9tMBkZ6V1hj++FAFHzVtblgWID0jQ9sYQnmtcG7JHGXJfZVo o6d8HgyTZv1M+KxBBfXxysChoxg5sgw9fGVBl18ZMiZT+KYiSnLdK1S0IPxRtZqf6eHR jRsrtgNve8VcSHRD/h9BIcb0aqtfg6TH1LoXWnEUwLVyY3tjx4GNOJsib3e6NMTOdcHA rAjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=o4HlmzTJ; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-166132-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166132-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x22-20020a62fb16000000b006f03011c97bsi628837pfm.113.2024.05.02.01.46.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 01:46:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166132-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=o4HlmzTJ; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-166132-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166132-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A5B2B28543B for ; Thu, 2 May 2024 08:45:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87CCB535D6; Thu, 2 May 2024 08:45:04 +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="o4HlmzTJ" 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 ED33C46544; Thu, 2 May 2024 08:45:01 +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=1714639503; cv=none; b=lYWmYmTxDnZdbZzROMEwypbkTyWYKy1ETe6L/gy4h47NdB9qkRz1aTPWYUDpX32pwDMe+8rGOkJZU6e168P8dCpbzwBbBqdK3iroFUhM75wqBtidmTtijG3C+Sj6bl52lVp/tXbUe5b2GHBhAO/kjHllAQfueYgMklPlknE3vnE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714639503; c=relaxed/simple; bh=Ec3n3R3FZcZFT49rhjxqF95C5KQCNufioCSig6jhwoc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wfe+bVR39jbqM6s/vexB5RkU9El5WtrvGMfSBea0/XPis1M1PpqKFGMsWOUsyU2HGltKy58mGmA6LSPUGEsb7NKeytYAUAktdoJXYu1JmeVLh4s2Omjt5ciqiRzk2GKlqAFsx06FtSqznDHrTQLkiToTIyZNtISw9uyQj95fZJE= 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=o4HlmzTJ; 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: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=fg/6cT3jAJK1vqwjodbXWEwb5gy6rm9+zRAdButCrKg=; b=o4HlmzTJ7Q/tPSMtP1IZc+P9Wp tWoLOdjU6+tx0eawKLIzhWXfCT+xPK4eo+JFrjxMfDM8Jq+Kcq9rfEb6qV87mi7U9ULgjxfHPOTKx 3sf2gcyDimTjProB5VUcAj44l2/Le1bLO4e5Knc8XEre153ES9O/HdeFuQ+7xE7hXpmw=; Received: from p54ae9c93.dip0.t-ipconnect.de ([84.174.156.147] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1s2S3h-00BKKn-2I; Thu, 02 May 2024 10:44:53 +0200 From: Felix Fietkau To: netdev@vger.kernel.org, Eric Dumazet , "David S. Miller" , David Ahern , Jakub Kicinski , Paolo Abeni Cc: willemdebruijn.kernel@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH v5 net-next v5 3/6] net: add code for TCP fraglist GRO Date: Thu, 2 May 2024 10:44:44 +0200 Message-ID: <20240502084450.44009-4-nbd@nbd.name> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084450.44009-1-nbd@nbd.name> References: <20240502084450.44009-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This implements fraglist GRO similar to how it's handled in UDP, however no functional changes are added yet. The next change adds a heuristic for using fraglist GRO instead of regular GRO. Acked-by: Paolo Abeni Signed-off-by: Felix Fietkau --- net/ipv4/tcp_offload.c | 21 +++++++++++++++++++++ net/ipv6/tcpv6_offload.c | 9 +++++++++ 2 files changed, 30 insertions(+) diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index affd4ed28cfe..aa7508676315 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -334,6 +334,18 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb) flush |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq); flush |= skb_cmp_decrypted(p, skb); + if (unlikely(NAPI_GRO_CB(p)->is_flist)) { + flush |= (__force int)(flags ^ tcp_flag_word(th2)); + flush |= skb->ip_summed != p->ip_summed; + flush |= skb->csum_level != p->csum_level; + flush |= NAPI_GRO_CB(p)->count >= 64; + + if (flush || skb_gro_receive_list(p, skb)) + mss = 1; + + goto out_check_final; + } + if (flush || skb_gro_receive(p, skb)) { mss = 1; goto out_check_final; @@ -400,6 +412,15 @@ INDIRECT_CALLABLE_SCOPE int tcp4_gro_complete(struct sk_buff *skb, int thoff) const struct iphdr *iph = ip_hdr(skb); struct tcphdr *th = tcp_hdr(skb); + if (unlikely(NAPI_GRO_CB(skb)->is_flist)) { + skb_shinfo(skb)->gso_type |= SKB_GSO_FRAGLIST | SKB_GSO_TCPV4; + skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; + + __skb_incr_checksum_unnecessary(skb); + + return 0; + } + th->check = ~tcp_v4_check(skb->len - thoff, iph->saddr, iph->daddr, 0); diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c index 7180c30dbbef..575e2743e331 100644 --- a/net/ipv6/tcpv6_offload.c +++ b/net/ipv6/tcpv6_offload.c @@ -32,6 +32,15 @@ INDIRECT_CALLABLE_SCOPE int tcp6_gro_complete(struct sk_buff *skb, int thoff) const struct ipv6hdr *iph = ipv6_hdr(skb); struct tcphdr *th = tcp_hdr(skb); + if (unlikely(NAPI_GRO_CB(skb)->is_flist)) { + skb_shinfo(skb)->gso_type |= SKB_GSO_FRAGLIST | SKB_GSO_TCPV6; + skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; + + __skb_incr_checksum_unnecessary(skb); + + return 0; + } + th->check = ~tcp_v6_check(skb->len - thoff, &iph->saddr, &iph->daddr, 0); skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV6; -- 2.44.0