linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] skbuff: remove some unnecessary operation in skb_segment_list()
@ 2021-03-10  8:28 l00371289
  2021-03-10 21:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: l00371289 @ 2021-03-10  8:28 UTC (permalink / raw)
  To: davem, kuba
  Cc: alobakin, jonathan.lemon, willemb, linmiaohe, gnault, netdev,
	linux-kernel, linuxarm

From: Yunsheng Lin <linyunsheng@huawei.com>

gro list uses skb_shinfo(skb)->frag_list to link two skb together,
and NAPI_GRO_CB(p)->last->next is used when there are more skb,
see skb_gro_receive_list(). gso expects that each segmented skb is
linked together using skb->next, so only the first skb->next need
to set to skb_shinfo(skb)-> frag_list when doing gso list segment.

It is the same reason that nskb->next does not need to be set to
list_skb before goto the error handling, because nskb->next already
pointers to list_skb.

And nskb is also the last skb at the end of loop, so remove tail
variable and use nskb instead.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
 net/core/skbuff.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index c421c8f..e8320b5 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3732,13 +3732,13 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,
 	unsigned int tnl_hlen = skb_tnl_header_len(skb);
 	unsigned int delta_truesize = 0;
 	unsigned int delta_len = 0;
-	struct sk_buff *tail = NULL;
 	struct sk_buff *nskb, *tmp;
 	int err;
 
 	skb_push(skb, -skb_network_offset(skb) + offset);
 
 	skb_shinfo(skb)->frag_list = NULL;
+	skb->next = list_skb;
 
 	do {
 		nskb = list_skb;
@@ -3756,17 +3756,8 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,
 			}
 		}
 
-		if (!tail)
-			skb->next = nskb;
-		else
-			tail->next = nskb;
-
-		if (unlikely(err)) {
-			nskb->next = list_skb;
+		if (unlikely(err))
 			goto err_linearize;
-		}
-
-		tail = nskb;
 
 		delta_len += nskb->len;
 		delta_truesize += nskb->truesize;
@@ -3793,7 +3784,7 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,
 
 	skb_gso_reset(skb);
 
-	skb->prev = tail;
+	skb->prev = nskb;
 
 	if (skb_needs_linearize(skb, features) &&
 	    __skb_linearize(skb))
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] skbuff: remove some unnecessary operation in skb_segment_list()
  2021-03-10  8:28 [PATCH net-next] skbuff: remove some unnecessary operation in skb_segment_list() l00371289
@ 2021-03-10 21:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-10 21:00 UTC (permalink / raw)
  To: l00371289
  Cc: davem, kuba, alobakin, jonathan.lemon, willemb, linmiaohe,
	gnault, netdev, linux-kernel, linuxarm

Hello:

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

On Wed, 10 Mar 2021 16:28:58 +0800 you wrote:
> From: Yunsheng Lin <linyunsheng@huawei.com>
> 
> gro list uses skb_shinfo(skb)->frag_list to link two skb together,
> and NAPI_GRO_CB(p)->last->next is used when there are more skb,
> see skb_gro_receive_list(). gso expects that each segmented skb is
> linked together using skb->next, so only the first skb->next need
> to set to skb_shinfo(skb)-> frag_list when doing gso list segment.
> 
> [...]

Here is the summary with links:
  - [net-next] skbuff: remove some unnecessary operation in skb_segment_list()
    https://git.kernel.org/netdev/net-next/c/1ddc3229ad3c

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-10 21:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10  8:28 [PATCH net-next] skbuff: remove some unnecessary operation in skb_segment_list() l00371289
2021-03-10 21:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).