Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp862518pxb; Tue, 1 Feb 2022 12:00:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhavmiM7cNx2XUvZ2yfnWUB3iw3Jv4LJo2xvbS/WZtEFzRlU4qZHOaGB644KE/2hf2IS61 X-Received: by 2002:a17:907:7e8c:: with SMTP id qb12mr21981493ejc.539.1643745645456; Tue, 01 Feb 2022 12:00:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745645; cv=none; d=google.com; s=arc-20160816; b=pJvR80NfpD9PBSC/aSubyC+jE3UyokMoP35g3n56wtNZIsM+j0+rxBO1xADiPpCRAW b602sO70+nCEyvZLwW631S7qQqymhQqNUgD9FbjlILyu2aRDi2HT6AMdC5nLjI2UuDwI 5fECZTANvUqhVluHwRQmaW9iGW6HDsjysTvAmlumXdsvgDYpnrhgd1U5VjWk8x5nIbdi Gs+OS/XKaAEPiOcjjMXpxliQ6d5hyH0zvEjXjikSGMGQg5xZyXJHuM60/XFeltLtNFMt Xbi4uE7wfmgPy1B1Q6aEWmHXOSZHnIc8pHeg5zoiGS7U2CnGvI2nyJLiLZ5tWecFB8i+ YNaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1QgXXmOrPrr+bXzNlGR1sxl792v/LedErJ4Jw4xYr3I=; b=KMn5FH5SUTsBusi3kA6krxIDY4L7LSW1Pw7j/lCiMbNMxLhZ16w9mnzsluzYYnrVtr 7nLAnOg1uNnZp6BkHsy/u3H9A5XbelPGd84twz04Tyk+kJN4U9iHpVP5ezin+chzLZl7 g6DqNtY/KtqKZs5oKNxVUWoHSiIIabRni0i2byI8v6M+c78xfGgqxyaQhnS0vwz5f8Vl 8VOvhjHxImso/LVIKn9GCXI5/H0Jx26SeURy+ghFnIEjJL/3+ZSAoEGbvxkVBvaSy4LP 9Rhpih40fBWMSTpYuychf6FTL6moaDTEqN7QLaN9Nj7JqIrjK4IkmoZRPS41jCz9pNzW Vnyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v4YoXnq0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du8si9592090ejc.413.2022.02.01.12.00.19; Tue, 01 Feb 2022 12:00:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v4YoXnq0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359832AbiAaLMN (ORCPT + 99 others); Mon, 31 Jan 2022 06:12:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376504AbiAaLIe (ORCPT ); Mon, 31 Jan 2022 06:08:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C859BC0619C0; Mon, 31 Jan 2022 03:05:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 92001B82A5F; Mon, 31 Jan 2022 11:05:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA563C340E8; Mon, 31 Jan 2022 11:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627117; bh=I0uXQkDbhcrgFlOrWUKs2lEyJYwQN3pii/jlSjzk5Z0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v4YoXnq0U2NoZGCn/J83NydPWzjXIUpBk7HxFCNFazQZHnR5MOqWrTezbOYQbuO1l PMK+shbyDDOGR4JLMQOp5nlPVJUPAX/KN9wTXtFS5eB5F3VPFtcejR7SajtBMrsLrc YlOMVIVvPlvVtQVOfbU5lcPDNdxE73QxFPtVmVGw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yajun Deng , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 080/100] net: ipv4: Move ip_options_fragment() out of loop Date: Mon, 31 Jan 2022 11:56:41 +0100 Message-Id: <20220131105223.127439495@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yajun Deng [ Upstream commit faf482ca196a5b16007190529b3b2dd32ab3f761 ] The ip_options_fragment() only called when iter->offset is equal to zero, so move it out of loop, and inline 'Copy the flags to each fragment.' As also, remove the unused parameter in ip_frag_ipcb(). Signed-off-by: Yajun Deng Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/ip_output.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 10d4cde31c6bf..fb91a466b2d34 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -614,18 +614,6 @@ void ip_fraglist_init(struct sk_buff *skb, struct iphdr *iph, } EXPORT_SYMBOL(ip_fraglist_init); -static void ip_fraglist_ipcb_prepare(struct sk_buff *skb, - struct ip_fraglist_iter *iter) -{ - struct sk_buff *to = iter->frag; - - /* Copy the flags to each fragment. */ - IPCB(to)->flags = IPCB(skb)->flags; - - if (iter->offset == 0) - ip_options_fragment(to); -} - void ip_fraglist_prepare(struct sk_buff *skb, struct ip_fraglist_iter *iter) { unsigned int hlen = iter->hlen; @@ -671,7 +659,7 @@ void ip_frag_init(struct sk_buff *skb, unsigned int hlen, EXPORT_SYMBOL(ip_frag_init); static void ip_frag_ipcb(struct sk_buff *from, struct sk_buff *to, - bool first_frag, struct ip_frag_state *state) + bool first_frag) { /* Copy the flags to each fragment. */ IPCB(to)->flags = IPCB(from)->flags; @@ -845,12 +833,13 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, /* Everything is OK. Generate! */ ip_fraglist_init(skb, iph, hlen, &iter); + ip_options_fragment(iter.frag); for (;;) { /* Prepare header of the next frame, * before previous one went down. */ if (iter.frag) { - ip_fraglist_ipcb_prepare(skb, &iter); + IPCB(iter.frag)->flags = IPCB(skb)->flags; ip_fraglist_prepare(skb, &iter); } @@ -905,7 +894,7 @@ slow_path: err = PTR_ERR(skb2); goto fail; } - ip_frag_ipcb(skb, skb2, first_frag, &state); + ip_frag_ipcb(skb, skb2, first_frag); /* * Put this fragment into the sending queue. -- 2.34.1