Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp600239lqd; Wed, 24 Apr 2024 11:05:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+IGkgP0q3wgWysYuktJyahENSBLg98eo2MkUlBUPXLB1dK9rqjhpntW3KJhoq2GBodPUfHCsIugMm1A6NNJwBbBOGAiZrWfSCOWnUTw== X-Google-Smtp-Source: AGHT+IEuuhJC8/sXyG8ShIwo2jJJOyXh4IfxhNv1lnwCBhLnrvX2nNS8qyknQH+xh88WcX+slb1M X-Received: by 2002:a2e:954f:0:b0:2de:81c9:14b3 with SMTP id t15-20020a2e954f000000b002de81c914b3mr1567723ljh.35.1713981921457; Wed, 24 Apr 2024 11:05:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713981921; cv=pass; d=google.com; s=arc-20160816; b=d+z9lIXblV9vt4/D48lqqy9v5YA/NNJop2RE2+eObcA8sWAfPvc0x1ZIg1R/MM8M1u 80ap/OPrpCI22qjAMlpi1kufsy7HTa6r3PE1yjmhIpyYEcjrUFoitFUA7rCsx1VI8S5v p7SpT6REyPftifmq3JQM4LwOhE+8MONLuojXzEUMtO9cyYjjbQfQHnvdFnkJi/OIvey6 Hn1r33GPtLMzDRXQfy3upqXaj8Ryf3CDqyw7o4CFVjQVonnzlmPS/GhsFhzeTk7+V4Oz a4prEpmDdJmET8tBuhn71NjpozN8S3LS7hzrAqGUj42EoQe/C7tPkGJUrgCB6BQe5lf2 q10Q== 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=3H6dBRGk+BHU+y8mRcNlZ506UX4DS949WCdH9l5DVuI=; fh=9iJrMgK1q8MSPg7EjJjGAIHnUpOIOHcnmLG6NGJ0Rxw=; b=fE1mrp0XkHf6Gkcoq9rXgDw96IyPepVgfoQVUalm/oRvNY9T2C29pZzExTDMxPb0ZI JTpwud5fvXylTOl1USqHHnZFoEv+OB9yprbt7JqvwOpJpVjTXoB/hV0NoAuhAc5Tzres zBYdE+m/AdffSYUJUOr1D5CGilamugtvVEnMxkPPF1HUDiQqoNQ4fubuwglHS5LuN74R 6wzOGhAVBTclemNC9G89tsaUccGxQIf6/Hq2r0K78//u/z8sTbkun+LdnVnw9L8HK6jo TKfZxNtnjiHeLQ+VrNEpjnPKbUFiNoQG9z5g5p2dRlNZIwFCaDacPE84anEsjKIVN4M5 jmDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=UvFn6rmZ; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-157436-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157436-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. [147.75.80.249]) by mx.google.com with ESMTPS id t28-20020a508d5c000000b0056fffc2fa67si8400584edt.490.2024.04.24.11.05.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 11:05:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157436-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=UvFn6rmZ; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-157436-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157436-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 310DB1F26C8A for ; Wed, 24 Apr 2024 18:05:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CAF716D9DB; Wed, 24 Apr 2024 18:05:09 +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="UvFn6rmZ" 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 8754B16D9B4; Wed, 24 Apr 2024 18:05:06 +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=1713981908; cv=none; b=QUqzXIFQ7YfjbTLPGU0ELjJw6foTY9XDbyYAcvgRBwYPs+J4ZhPyNqwB4nMKXljleIiICUj3YMeA0y1TcB4mMz71gMW7fvxxLehMoUX7hYuXcsTMPrKXWtwR13MW1Vk5aqx846NPTsSiJ8igTRS0JlbJg0hI96y3yTtX5+c7y3g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713981908; c=relaxed/simple; bh=IXZq04hiu+Pn+sF7BKtV+tVHTOSfOBndsfo4YDuDbeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BRVRyIA6Ir+pB9RdIyI49yuI7Qy6VOS6hoQ0ZpHxg0GJkiqtevhILl8D2dr+g2PPLT0uuBAspsSK2vZWzWf81Mr+k37cuidMu38RPon6FlieobiNTfMj+oP+vFGSxn91ejWO4DWk8zAJF5GMB3N9r8lSmRAvin86ufGdb3dT+vo= 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=UvFn6rmZ; 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=3H6dBRGk+BHU+y8mRcNlZ506UX4DS949WCdH9l5DVuI=; b=UvFn6rmZheJj5CMt6PXevzwOZs M0qTYxH0R7Yn5FdcYXj36vvMQQRcEGP/YQdAImQ0fjvvtjLkhSgkMSRhMri4ysR4ym4QUfF4/kNjv f7qogJNz8YhgbxWnMnq78rkzZrwludynpTumIqX0Eyx7PXwLvlqrl98wbR07UMHR2cKo=; Received: from p200300daa70d8400593e4be1bb3506c9.dip0.t-ipconnect.de ([2003:da:a70d:8400:593e:4be1:bb35:6c9] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1rzgzM-006rUX-0o; Wed, 24 Apr 2024 20:05:00 +0200 From: Felix Fietkau To: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern Cc: willemdebruijn.kernel@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/4] net: move skb_gro_receive_list from udp to core Date: Wed, 24 Apr 2024 20:04:53 +0200 Message-ID: <20240424180458.56211-2-nbd@nbd.name> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240424180458.56211-1-nbd@nbd.name> References: <20240424180458.56211-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 helper function will be used for TCP fraglist GRO support Signed-off-by: Felix Fietkau --- include/net/gro.h | 1 + net/core/gro.c | 27 +++++++++++++++++++++++++++ net/ipv4/udp_offload.c | 27 --------------------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/include/net/gro.h b/include/net/gro.h index 50f1e403dbbb..ca8e4b3de044 100644 --- a/include/net/gro.h +++ b/include/net/gro.h @@ -429,6 +429,7 @@ static inline __wsum ip6_gro_compute_pseudo(const struct sk_buff *skb, } int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb); +int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb); /* Pass the currently batched GRO_NORMAL SKBs up to the stack. */ static inline void gro_normal_list(struct napi_struct *napi) diff --git a/net/core/gro.c b/net/core/gro.c index 2459ab697f7f..268c6c826d09 100644 --- a/net/core/gro.c +++ b/net/core/gro.c @@ -231,6 +231,33 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb) return 0; } +int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb) +{ + if (unlikely(p->len + skb->len >= 65536)) + return -E2BIG; + + if (NAPI_GRO_CB(p)->last == p) + skb_shinfo(p)->frag_list = skb; + else + NAPI_GRO_CB(p)->last->next = skb; + + skb_pull(skb, skb_gro_offset(skb)); + + NAPI_GRO_CB(p)->last = skb; + NAPI_GRO_CB(p)->count++; + p->data_len += skb->len; + + /* sk ownership - if any - completely transferred to the aggregated packet */ + skb->destructor = NULL; + skb->sk = NULL; + p->truesize += skb->truesize; + p->len += skb->len; + + NAPI_GRO_CB(skb)->same_flow = 1; + + return 0; +} + static void napi_gro_complete(struct napi_struct *napi, struct sk_buff *skb) { diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 3498dd1d0694..a3cd546a1aea 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -433,33 +433,6 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, return segs; } -static int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb) -{ - if (unlikely(p->len + skb->len >= 65536)) - return -E2BIG; - - if (NAPI_GRO_CB(p)->last == p) - skb_shinfo(p)->frag_list = skb; - else - NAPI_GRO_CB(p)->last->next = skb; - - skb_pull(skb, skb_gro_offset(skb)); - - NAPI_GRO_CB(p)->last = skb; - NAPI_GRO_CB(p)->count++; - p->data_len += skb->len; - - /* sk ownership - if any - completely transferred to the aggregated packet */ - skb->destructor = NULL; - skb->sk = NULL; - p->truesize += skb->truesize; - p->len += skb->len; - - NAPI_GRO_CB(skb)->same_flow = 1; - - return 0; -} - #define UDP_GRO_CNT_MAX 64 static struct sk_buff *udp_gro_receive_segment(struct list_head *head, -- 2.44.0