Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1180436lqd; Thu, 25 Apr 2024 08:06:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXiRCkZoKBFc4FFLDkpsnNuVnSngWejjCj8doA04uWlb2nG05ciazy9hVeKhipxtiUgpcMkwu/tPwsJJIanUKk/cIKBXAaS/f7+8oVaaQ== X-Google-Smtp-Source: AGHT+IH4Rm7peqyp8AW48kgYXajwBLQ0EdxVVl4yS96++oG+sp/XT4mvjI/NCSD9wuyPGS6ev/mm X-Received: by 2002:a05:6a20:948d:b0:1aa:5ca9:c564 with SMTP id hs13-20020a056a20948d00b001aa5ca9c564mr5390869pzb.5.1714057599669; Thu, 25 Apr 2024 08:06:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714057599; cv=pass; d=google.com; s=arc-20160816; b=PQMgfXv3dM50l9QBP9JkB/ENk5y/xR3agvYei1vFUmUYrOVEQ4prm5UDjCZYNfyIV7 WPPhzteNCKx6fFPb3o9LOvAs2z3auqB+3ugCjP/4Sw6pgeNB0wM/Or07wUJOIQ5wVQUc IyVt0R0Mob6CL132UnQxdq36xTOxD9cMwOmZjdnU/7L5kRFi0XO+/d1y9F+LS5+o+Yj3 Uxtechdr9LtDDotxQGC/ksZvZvZYpzAlpZvrLEkSQXMsnofdOeQIkVRNO+XVBkwQXvvi sW/iCUsmUOxol/aCZrtyLo0tfaruTIcf/EXEJHRlgwaoYxsE1tWrL64nMA3+RI2OOCLB SWcQ== 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=szWEDKKugLXCZZTnUmzajcmY+Rg8YMMI6BDBDVVWdw9C1J7g9HFrN0WyTIfITpuavS wjcjYAW9Le+jmtIiKsZnhokkofcKeJXrAgCOuVzEvs86GyKPZQiDzt7+EeZ0dABbCkML IshSikbkNW+s9LM9xbT8B8doXT1PVyiTmr7CPDRqhhYEojKCXZE/dofxyyLD1T2EDnlu A45rZFPQU97wXSFhG1JyOLwlVftX+GxkIPn+fmtC6DQEWJlEjODBpoV7UpuQSDOYGduF L1SC0cvYbK0qHTU5jLR2agapCn/WmfcDHTx3LM50rf79ha9ezczR4nV3+5e8PoyPrUY+ zQoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=pdVuGTe5; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-158759-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158759-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 c32-20020a631c20000000b005dbf4efa1f8si13193214pgc.852.2024.04.25.08.06.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 08:06:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158759-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=pdVuGTe5; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-158759-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158759-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 80017285BC5 for ; Thu, 25 Apr 2024 15:05:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 881F614A4FC; Thu, 25 Apr 2024 15:04:48 +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="pdVuGTe5" 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 83CA214A632; Thu, 25 Apr 2024 15:04:42 +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=1714057486; cv=none; b=aWEoGv457iafbUhfC6PXrqfJqxOdm4wNJwJ0aAtBg9FpPKHhgUtfUH0gcn/KU0Kd3kV4nhQGQmqJJhc25eOB/VbIzWwLMmuX4RzyM29EwFrH9ccRozIQofZs6a4PC+SoV4GxmNsn4uGhurbgSorVGkpkUKLQK9JimZd8Ggkm0Ng= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714057486; c=relaxed/simple; bh=IXZq04hiu+Pn+sF7BKtV+tVHTOSfOBndsfo4YDuDbeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c8ZsclHfXlDzoC3LCLXJVH6G4fkWibNlT5sk6tbRmhE6Ij1HyLDGK3s254WQTQODJa7OvC7IIDIYxdpTInAF0oe4pBGhrGs4oOoUk/4b3f2N/RprKMCAAydPePKfcffBeHmmgFyb+1n4jfqY0jR/84enKWxCmD7cM/079Imycss= 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=pdVuGTe5; 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=pdVuGTe5qp3xdEIL1WukCCnQy9 a8V/oy2Vc+imIoWzCjmcGeVHdPI4MrQSOfDcYPhEqaJ6GB2FmEptvjc4zoNEgjyKUqv2Zq0V158p5 6+StQG7Gz6NCE0hAIafUnrCs6z/htE4mClHpjGGR9UMExdM9cNUh22AOHJPS9k0aVPnQ=; 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 1s00eI-007MWz-16; Thu, 25 Apr 2024 17:04:34 +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 v2 net-next v2 1/5] net: move skb_gro_receive_list from udp to core Date: Thu, 25 Apr 2024 17:04:24 +0200 Message-ID: <20240425150432.44142-2-nbd@nbd.name> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240425150432.44142-1-nbd@nbd.name> References: <20240425150432.44142-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