diff options
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index cfd7edda0a8e..1272a88c2a63 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -701,11 +701,12 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp) | |||
701 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | 701 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); |
702 | if (skb) { | 702 | if (skb) { |
703 | if (sk_wmem_schedule(sk, skb->truesize)) { | 703 | if (sk_wmem_schedule(sk, skb->truesize)) { |
704 | skb_reserve(skb, sk->sk_prot->max_header); | ||
704 | /* | 705 | /* |
705 | * Make sure that we have exactly size bytes | 706 | * Make sure that we have exactly size bytes |
706 | * available to the caller, no more, no less. | 707 | * available to the caller, no more, no less. |
707 | */ | 708 | */ |
708 | skb_reserve(skb, skb_tailroom(skb) - size); | 709 | skb->avail_size = size; |
709 | return skb; | 710 | return skb; |
710 | } | 711 | } |
711 | __kfree_skb(skb); | 712 | __kfree_skb(skb); |
@@ -860,7 +861,7 @@ wait_for_memory: | |||
860 | } | 861 | } |
861 | 862 | ||
862 | out: | 863 | out: |
863 | if (copied) | 864 | if (copied && !(flags & MSG_SENDPAGE_NOTLAST)) |
864 | tcp_push(sk, flags, mss_now, tp->nonagle); | 865 | tcp_push(sk, flags, mss_now, tp->nonagle); |
865 | return copied; | 866 | return copied; |
866 | 867 | ||
@@ -995,10 +996,9 @@ new_segment: | |||
995 | copy = seglen; | 996 | copy = seglen; |
996 | 997 | ||
997 | /* Where to copy to? */ | 998 | /* Where to copy to? */ |
998 | if (skb_tailroom(skb) > 0) { | 999 | if (skb_availroom(skb) > 0) { |
999 | /* We have some space in skb head. Superb! */ | 1000 | /* We have some space in skb head. Superb! */ |
1000 | if (copy > skb_tailroom(skb)) | 1001 | copy = min_t(int, copy, skb_availroom(skb)); |
1001 | copy = skb_tailroom(skb); | ||
1002 | err = skb_add_data_nocache(sk, skb, from, copy); | 1002 | err = skb_add_data_nocache(sk, skb, from, copy); |
1003 | if (err) | 1003 | if (err) |
1004 | goto do_fault; | 1004 | goto do_fault; |
@@ -1452,7 +1452,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1452 | if ((available < target) && | 1452 | if ((available < target) && |
1453 | (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && | 1453 | (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && |
1454 | !sysctl_tcp_low_latency && | 1454 | !sysctl_tcp_low_latency && |
1455 | dma_find_channel(DMA_MEMCPY)) { | 1455 | net_dma_find_channel()) { |
1456 | preempt_enable_no_resched(); | 1456 | preempt_enable_no_resched(); |
1457 | tp->ucopy.pinned_list = | 1457 | tp->ucopy.pinned_list = |
1458 | dma_pin_iovec_pages(msg->msg_iov, len); | 1458 | dma_pin_iovec_pages(msg->msg_iov, len); |
@@ -1667,7 +1667,7 @@ do_prequeue: | |||
1667 | if (!(flags & MSG_TRUNC)) { | 1667 | if (!(flags & MSG_TRUNC)) { |
1668 | #ifdef CONFIG_NET_DMA | 1668 | #ifdef CONFIG_NET_DMA |
1669 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1669 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1670 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1670 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1671 | 1671 | ||
1672 | if (tp->ucopy.dma_chan) { | 1672 | if (tp->ucopy.dma_chan) { |
1673 | tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( | 1673 | tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( |
@@ -3243,7 +3243,7 @@ void __init tcp_init(void) | |||
3243 | { | 3243 | { |
3244 | struct sk_buff *skb = NULL; | 3244 | struct sk_buff *skb = NULL; |
3245 | unsigned long limit; | 3245 | unsigned long limit; |
3246 | int max_share, cnt; | 3246 | int max_rshare, max_wshare, cnt; |
3247 | unsigned int i; | 3247 | unsigned int i; |
3248 | unsigned long jiffy = jiffies; | 3248 | unsigned long jiffy = jiffies; |
3249 | 3249 | ||
@@ -3302,17 +3302,17 @@ void __init tcp_init(void) | |||
3302 | 3302 | ||
3303 | tcp_init_mem(&init_net); | 3303 | tcp_init_mem(&init_net); |
3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ | 3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ |
3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10); | 3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); |
3306 | limit = max(limit, 128UL); | 3306 | max_wshare = min(4UL*1024*1024, limit); |
3307 | max_share = min(4UL*1024*1024, limit); | 3307 | max_rshare = min(6UL*1024*1024, limit); |
3308 | 3308 | ||
3309 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; | 3309 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; |
3310 | sysctl_tcp_wmem[1] = 16*1024; | 3310 | sysctl_tcp_wmem[1] = 16*1024; |
3311 | sysctl_tcp_wmem[2] = max(64*1024, max_share); | 3311 | sysctl_tcp_wmem[2] = max(64*1024, max_wshare); |
3312 | 3312 | ||
3313 | sysctl_tcp_rmem[0] = SK_MEM_QUANTUM; | 3313 | sysctl_tcp_rmem[0] = SK_MEM_QUANTUM; |
3314 | sysctl_tcp_rmem[1] = 87380; | 3314 | sysctl_tcp_rmem[1] = 87380; |
3315 | sysctl_tcp_rmem[2] = max(87380, max_share); | 3315 | sysctl_tcp_rmem[2] = max(87380, max_rshare); |
3316 | 3316 | ||
3317 | pr_info("Hash tables configured (established %u bind %u)\n", | 3317 | pr_info("Hash tables configured (established %u bind %u)\n", |
3318 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); | 3318 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); |