diff options
author | Eric Dumazet <edumazet@google.com> | 2014-09-15 07:19:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-15 14:41:08 -0400 |
commit | b3d6cb92fd190d720a01075c4d20cdca896663fc (patch) | |
tree | c0686708da032f9f6f842903163fa6da23ef649f /net/ipv4 | |
parent | e93a0435f809d009919a743fb6e93076faac8aa7 (diff) |
tcp: do not copy headers in tcp_collapse()
tcp_collapse() wants to shrink skb so that the overhead is minimal.
Now we store tcp flags into TCP_SKB_CB(skb)->tcp_flags, we no longer
need to keep around full headers.
Whole available space is dedicated to the payload.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/tcp_input.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 228bf0c5ff19..ea92f23ffaf1 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4535,26 +4535,13 @@ restart: | |||
4535 | return; | 4535 | return; |
4536 | 4536 | ||
4537 | while (before(start, end)) { | 4537 | while (before(start, end)) { |
4538 | int copy = min_t(int, SKB_MAX_ORDER(0, 0), end - start); | ||
4538 | struct sk_buff *nskb; | 4539 | struct sk_buff *nskb; |
4539 | unsigned int header = skb_headroom(skb); | ||
4540 | int copy = SKB_MAX_ORDER(header, 0); | ||
4541 | 4540 | ||
4542 | /* Too big header? This can happen with IPv6. */ | 4541 | nskb = alloc_skb(copy, GFP_ATOMIC); |
4543 | if (copy < 0) | ||
4544 | return; | ||
4545 | if (end - start < copy) | ||
4546 | copy = end - start; | ||
4547 | nskb = alloc_skb(copy + header, GFP_ATOMIC); | ||
4548 | if (!nskb) | 4542 | if (!nskb) |
4549 | return; | 4543 | return; |
4550 | 4544 | ||
4551 | skb_set_mac_header(nskb, skb_mac_header(skb) - skb->head); | ||
4552 | skb_set_network_header(nskb, (skb_network_header(skb) - | ||
4553 | skb->head)); | ||
4554 | skb_set_transport_header(nskb, (skb_transport_header(skb) - | ||
4555 | skb->head)); | ||
4556 | skb_reserve(nskb, header); | ||
4557 | memcpy(nskb->head, skb->head, header); | ||
4558 | memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); | 4545 | memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); |
4559 | TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(nskb)->end_seq = start; | 4546 | TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(nskb)->end_seq = start; |
4560 | __skb_queue_before(list, skb, nskb); | 4547 | __skb_queue_before(list, skb, nskb); |