提交 3ccc6c6f 编写于 作者: L linzhang 提交者: David S. Miller

skbuff: optimize the pull_pages code in __pskb_pull_tail()

In the pull_pages code block, if the first frag size > eat,
we can end the loop in advance to avoid extra copy.
Signed-off-by: NLin Zhang <xiaolou4617@gmail.com>
Acked-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b3a703c7
...@@ -1719,6 +1719,8 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta) ...@@ -1719,6 +1719,8 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta)
if (eat) { if (eat) {
skb_shinfo(skb)->frags[k].page_offset += eat; skb_shinfo(skb)->frags[k].page_offset += eat;
skb_frag_size_sub(&skb_shinfo(skb)->frags[k], eat); skb_frag_size_sub(&skb_shinfo(skb)->frags[k], eat);
if (!i)
goto end;
eat = 0; eat = 0;
} }
k++; k++;
...@@ -1726,6 +1728,7 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta) ...@@ -1726,6 +1728,7 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta)
} }
skb_shinfo(skb)->nr_frags = k; skb_shinfo(skb)->nr_frags = k;
end:
skb->tail += delta; skb->tail += delta;
skb->data_len -= delta; skb->data_len -= delta;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册