aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2012-05-02 17:19:04 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-03 04:21:33 -0400
commit57b55a7ec684d8b846d6d5e67f4982363a83db7e (patch)
tree29ea3a30a701d10ba2dbcb4a003952fe8e2f23f6 /net/ipv4
parentc73c3d9c49daae8acbac4cd14bcd81626887c0e6 (diff)
tcp: Move code related to head frag in tcp_try_coalesce
This change reorders the code related to the use of an skb->head_frag so it is placed before we check the rest of the frags. This allows the code to read more linearly instead of like some sort of loop. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Cc: Eric Dumazet <edumazet@google.com> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_input.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 3cb273ac8821..41fa5df9abbc 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4562,9 +4562,31 @@ merge:
4562 if (skb_has_frag_list(to) || skb_has_frag_list(from)) 4562 if (skb_has_frag_list(to) || skb_has_frag_list(from))
4563 return false; 4563 return false;
4564 4564
4565 if (skb_headlen(from) == 0 && 4565 if (skb_headlen(from) != 0) {
4566 (skb_shinfo(to)->nr_frags + 4566 struct page *page;
4567 skb_shinfo(from)->nr_frags <= MAX_SKB_FRAGS)) { 4567 unsigned int offset;
4568
4569 if (skb_shinfo(to)->nr_frags +
4570 skb_shinfo(from)->nr_frags >= MAX_SKB_FRAGS)
4571 return false;
4572
4573 if (!from->head_frag || skb_cloned(from))
4574 return false;
4575
4576 delta = from->truesize - SKB_DATA_ALIGN(sizeof(struct sk_buff));
4577
4578 page = virt_to_head_page(from->head);
4579 offset = from->data - (unsigned char *)page_address(page);
4580
4581 skb_fill_page_desc(to, skb_shinfo(to)->nr_frags,
4582 page, offset, skb_headlen(from));
4583 *fragstolen = true;
4584 goto copyfrags;
4585 } else {
4586 if (skb_shinfo(to)->nr_frags +
4587 skb_shinfo(from)->nr_frags > MAX_SKB_FRAGS)
4588 return false;
4589
4568 delta = from->truesize - 4590 delta = from->truesize -
4569 SKB_TRUESIZE(skb_end_pointer(from) - from->head); 4591 SKB_TRUESIZE(skb_end_pointer(from) - from->head);
4570copyfrags: 4592copyfrags:
@@ -4587,20 +4609,6 @@ copyfrags:
4587 to->data_len += len; 4609 to->data_len += len;
4588 goto merge; 4610 goto merge;
4589 } 4611 }
4590 if (from->head_frag && !skb_cloned(from)) {
4591 struct page *page;
4592 unsigned int offset;
4593
4594 if (skb_shinfo(to)->nr_frags + skb_shinfo(from)->nr_frags >= MAX_SKB_FRAGS)
4595 return false;
4596 page = virt_to_head_page(from->head);
4597 offset = from->data - (unsigned char *)page_address(page);
4598 skb_fill_page_desc(to, skb_shinfo(to)->nr_frags,
4599 page, offset, skb_headlen(from));
4600 *fragstolen = true;
4601 delta = from->truesize - SKB_DATA_ALIGN(sizeof(struct sk_buff));
4602 goto copyfrags;
4603 }
4604 return false; 4612 return false;
4605} 4613}
4606 4614