diff mbox series

[net-next] net: ipv4: Move ip_options_fragment() out of loop

Message ID 20210823031759.25395-1-yajun.deng@linux.dev (mailing list archive)
State Accepted
Commit faf482ca196a5b16007190529b3b2dd32ab3f761
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ipv4: Move ip_options_fragment() out of loop | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 35 this patch: 35
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 48 lines checked
netdev/build_allmodconfig_warn fail Errors and warnings before: 35 this patch: 35
netdev/header_inline success Link

Commit Message

Yajun Deng Aug. 23, 2021, 3:17 a.m. UTC
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 <yajun.deng@linux.dev>
---
 net/ipv4/ip_output.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Aug. 24, 2021, 8:30 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon, 23 Aug 2021 11:17:59 +0800 you wrote:
> 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 <yajun.deng@linux.dev>
> ---
>  net/ipv4/ip_output.c | 19 ++++---------------
>  1 file changed, 4 insertions(+), 15 deletions(-)

Here is the summary with links:
  - [net-next] net: ipv4: Move ip_options_fragment() out of loop
    https://git.kernel.org/netdev/net-next/c/faf482ca196a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 6b04a88466b2..9a8f05d5476e 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -606,18 +606,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;
@@ -663,7 +651,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;
@@ -837,12 +825,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);
 			}
 
@@ -897,7 +886,7 @@  int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
 			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.