Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp515744lqa; Sat, 27 Apr 2024 11:23:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU7BDnLsCJvBVtZSBRFAjKx/+tAPSXyeNDSCc+2D2MRWVYdzOOmQyL4aynxoQm7HtVxotLK+1WeE6OGpnUWoGUNdyg+3Io54UWM7XKJmA== X-Google-Smtp-Source: AGHT+IHQHD7PvSPQAzwxTMqcFDHmib0imS6pWs7KR5kcBI9M2oBAqxebSuoM5uomFvAUEBIJxbAb X-Received: by 2002:a05:6808:6043:b0:3c8:64bd:1f06 with SMTP id dd3-20020a056808604300b003c864bd1f06mr527893oib.22.1714242218210; Sat, 27 Apr 2024 11:23:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714242218; cv=pass; d=google.com; s=arc-20160816; b=jfbko6xc5RAv6/y7szQpl2QXBk+gB6E5LXWiP+vp6Wqbb67VqOp3GUD5VIuXHrrbje 4n1AZqw4Ng/5TUCaUFOGCbqg3bUa+SeJOTOdY5Xt1ExNyyMEj0JJT1yhgbO/mW4O3Np+ b1aG44VAudjGba/J0KDc1OHsC51AElHMP8YppoYa38vR1SgeK8wu3KOnKSYS+ydTImy5 Grsj2yirKZbeM5iGriS/BfeqJmIfljkNMERskgFo+5QUmlTtJeLWDqTtM7hIq87M9isa TxxNatIwlgmxaFxNiRgIzw84i/jvhV2p6vSCflkETlZaU6h5j4FLgd6foi8QveAegdY7 HLSw== 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=Cq8n8jrG14bmuzs7U9Y1DCj9OT+YXwhjK7j49hc1cBM=; fh=9iJrMgK1q8MSPg7EjJjGAIHnUpOIOHcnmLG6NGJ0Rxw=; b=YIv/liEgo7FLWgEAXoQZQIonG8Z00k22F8PHxNklQFFrIWOt+T0niB8xSChswrLikm 6LrF9zpeARS9BwxXa0BYRSFv9pUS088o18JEfm9t2NNQXyrABAV5d9bJn0btRZLBCWj2 m1gAZVbhQt5frEsrf0AvaEa+dHTC3P8sohOz4gnl9SaW0Loc76UK4ryMuO5EEqOigH6B JfxDL2okvhzaLywc8D3arJecX6X4qFV1U5vxyAIHsKX5LfQHYo0eReRZ6fYcvwKopPfi E9jS1Fhk5nbsMNEWfTCKieqM/+Y5hulDLttO1qlyhlU5FOe5XIB46+Ek+YUeXBIFvGhr 97Ew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=WW8EEfZS; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-161119-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161119-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id m12-20020a6562cc000000b005dc6d16aba7si17206782pgv.344.2024.04.27.11.23.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 11:23:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161119-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=WW8EEfZS; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-161119-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161119-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 15FFBB219EE for ; Sat, 27 Apr 2024 18:23:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 160AF145B31; Sat, 27 Apr 2024 18:23:18 +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="WW8EEfZS" 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 7EEDA1772F; Sat, 27 Apr 2024 18:23:14 +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=1714242197; cv=none; b=ps2VBClmiZj9BScZhzI1ig9vLFS/nhFE3mAmll5CCyWK4mYHzUYP6H4k9N+bIE2DOspX5+zL6Ony41EqhJJ6sqm3giecBV8pZi27b7o4KzJahej0ChmEZtQZrUyUbJ1+IfbFCwzC4fAiGhDM5DdH40hdcPJTq7PSBlDtEDdnrKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714242197; c=relaxed/simple; bh=YmEyf6SItFd5CxZHd4mM08KlmULEDODxPglVfQj0qOk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F2InsdzOFwynvovgIxvE3ropwfWxXswqQkZV6jM4GVu2sWzt0u03gQYSzFuIqxc0bom4gsRf8Bh6qmSjg7jyrDbbYuphWvAZf9InJtjt3yR2s3sGV4ns/I+cbSpYzrw54shPLJqGGisDnefIVcSjmr4jQhX/00+DJTJAAOlXzEQ= 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=WW8EEfZS; 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=Cq8n8jrG14bmuzs7U9Y1DCj9OT+YXwhjK7j49hc1cBM=; b=WW8EEfZSpI8MhLpcAVmByhNtbP 2QUdLf7si37LXRwNGKqyjbbQYVFmwx2PBMsfe31ZELt46A75VS31C1hHJbvkUWh1am2Epe2o2KPGi npvKlDARWfk/klqh0gQQHff11nwLbyfT2fehrcKzTpuznqRVu+U7+YwEIfCPOnWBehEc=; 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 1s0mhX-008hH3-0g; Sat, 27 Apr 2024 20:23:07 +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 v4 net-next v4 1/6] net: move skb_gro_receive_list from udp to core Date: Sat, 27 Apr 2024 20:22:57 +0200 Message-ID: <20240427182305.24461-2-nbd@nbd.name> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240427182305.24461-1-nbd@nbd.name> References: <20240427182305.24461-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 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