Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp990775lqm; Thu, 2 May 2024 01:45:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8CjSFYjv/bpmhyScotzh1IgSxqZMTXqYEdCF7CFH3E0o5Dxvc/Iy7idv+UALWGCQNqHMpFuw74h967/81XlEleI/oq1AHyeqjx70Ksg== X-Google-Smtp-Source: AGHT+IGJEn/lhxFlmBhLzOjacHKusm669b+OtM/rTvKf6Vy/qr5Beu4c1B8bNkjZNVUySPisgZKj X-Received: by 2002:a17:907:8691:b0:a55:77fa:80d7 with SMTP id qa17-20020a170907869100b00a5577fa80d7mr1879874ejc.8.1714639517881; Thu, 02 May 2024 01:45:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714639517; cv=pass; d=google.com; s=arc-20160816; b=YHxN7ErW8u4qVln7/++tZM79Gnu0cbzGBSFJAEe0l3u+UpdNroc/WURQLzAGQ34qe2 ivy5yG3b1D1sBeS/JuBKwcISxLXoRLI87oEYhOVGBiaENa3t+qVeTV24O7D+nuHz27un uPZ4Iucg1r64xMYwfYYLTNn2Zk7SyxLigoGeIlUy1zd1c0WVja4cHRKVddIE1fm2csOS UCrDokpX344P6I4ojs7njKoApsPouxKXrR4IPmaqVDBYeRTEqC8hrlK+34HuSxzT9FIh WW+vT4DJLzpGj0GVBunZcwujdf4+RntLXRZHhp9s5uSS8uZNExtOQF0YxKWP4bNlF4P4 tpuA== 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=ucBFctV4yvQkEZT4G46tkfmHw4p+c5I3e3Kf1G9tARg=; fh=9iJrMgK1q8MSPg7EjJjGAIHnUpOIOHcnmLG6NGJ0Rxw=; b=XUAEKYmjNRgTHXqvYmS5nIyaAOVcEAlYOWxLpT9XXGjmIekyrgJdHumq7GP7KVxG/X osyxUAhRab+6XET0ghyj7o01qXIWtqPVIBjEduLFkotioJHiO3WPRUbKaUMYuNbURU58 uUM3NjhYeD6EDh5ZpCIVTFI/J+9PVwo5dFrkOx4sSJweEVJkfnKV3lzJbG/6jd9sb8Sr uK7TD8+f5AUicHUpGfRNUiyx0PUcsDXVYcAeK6U6LOjyIRAvBy/3Tpqc4Jf/m7wzKo36 BfRsC0zZN9bIv88DS42kHXJtQngczLEBDpiqd7WHDpXfkiM6QYf89ELrupSdJ/X4aQWZ UVMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=oGb4qsUl; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-166131-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166131-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 t5-20020a170906a10500b00a593d95f876si295272ejy.233.2024.05.02.01.45.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 01:45:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166131-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=oGb4qsUl; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-166131-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166131-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 9DAA01F2272E for ; Thu, 2 May 2024 08:45:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06B7B524A6; 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="oGb4qsUl" 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 9135D46525; Thu, 2 May 2024 08:44:59 +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=LKyatSNkCW4HeV6/BOmQTumjT2Aot7jfYoBa9IRsGzEWqkoTchK1P8Q9dxn7fHyH3uj8nzoGjYoSdMtkwl6TlPQYikI0R6z97frk4ezjggh3vXVC3tw8+gm8eU0QblQ630HH4Ycg+HJsnXhHy1QK+lwWIUUXE6KosoyHs011ib4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714639503; c=relaxed/simple; bh=Z2IXMCDg2WGF6g/b+b8hoQ/vakbIALNU7+GZl0p6OqM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b92tElOLnAEP0Wr3UM0vn5ycSSxWJv8r2bICHslfixJfVfWBjAX6jIb+5YvzaSLFPWTwWnwA2JfmA33KqgMPVQlLf5PRqm0rtJZsodg0nSYEltlMF+Qf/np7efAqvR34ZyujbFeT0M4ZaZNiFaH4ui1+iumEOkrO02+kHFCJti0= 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=oGb4qsUl; 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=ucBFctV4yvQkEZT4G46tkfmHw4p+c5I3e3Kf1G9tARg=; b=oGb4qsUldRMkxkeOpYhRQ6C5B4 /oXOzNFAhDuaYJfHvQWBPmhnqwXDKQFr5GBzMF8TyKzWJpU4jaaJsLqJzXo+CcUuzGwLhB6t+85tf QREfRy3xjishW3+bzahQ29BuCJKz4tFGpNeLDfSsA8UBXdKh02kXyA1UjSr9iCMaJyUA=; 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 1s2S3g-00BKKn-0h; Thu, 02 May 2024 10:44:52 +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 v5 net-next v5 1/6] net: move skb_gro_receive_list from udp to core Date: Thu, 2 May 2024 10:44:42 +0200 Message-ID: <20240502084450.44009-2-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 helper function will be used for TCP fraglist GRO support Acked-by: Paolo Abeni Reviewed-by: Eric Dumazet 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