aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 170737a9d56d..e6bb8256e59f 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -65,6 +65,9 @@ int sysctl_tcp_base_mss __read_mostly = TCP_BASE_MSS;
65/* By default, RFC2861 behavior. */ 65/* By default, RFC2861 behavior. */
66int sysctl_tcp_slow_start_after_idle __read_mostly = 1; 66int sysctl_tcp_slow_start_after_idle __read_mostly = 1;
67 67
68unsigned int sysctl_tcp_notsent_lowat __read_mostly = UINT_MAX;
69EXPORT_SYMBOL(sysctl_tcp_notsent_lowat);
70
68static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, 71static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
69 int push_one, gfp_t gfp); 72 int push_one, gfp_t gfp);
70 73
@@ -892,8 +895,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
892 895
893 skb_orphan(skb); 896 skb_orphan(skb);
894 skb->sk = sk; 897 skb->sk = sk;
895 skb->destructor = (sysctl_tcp_limit_output_bytes > 0) ? 898 skb->destructor = tcp_wfree;
896 tcp_wfree : sock_wfree;
897 atomic_add(skb->truesize, &sk->sk_wmem_alloc); 899 atomic_add(skb->truesize, &sk->sk_wmem_alloc);
898 900
899 /* Build TCP header and checksum it. */ 901 /* Build TCP header and checksum it. */
@@ -1628,7 +1630,7 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)
1628 1630
1629 /* If a full-sized TSO skb can be sent, do it. */ 1631 /* If a full-sized TSO skb can be sent, do it. */
1630 if (limit >= min_t(unsigned int, sk->sk_gso_max_size, 1632 if (limit >= min_t(unsigned int, sk->sk_gso_max_size,
1631 sk->sk_gso_max_segs * tp->mss_cache)) 1633 tp->xmit_size_goal_segs * tp->mss_cache))
1632 goto send_now; 1634 goto send_now;
1633 1635
1634 /* Middle in queue won't get any more data, full sendable already? */ 1636 /* Middle in queue won't get any more data, full sendable already? */
@@ -1837,7 +1839,6 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
1837 while ((skb = tcp_send_head(sk))) { 1839 while ((skb = tcp_send_head(sk))) {
1838 unsigned int limit; 1840 unsigned int limit;
1839 1841
1840
1841 tso_segs = tcp_init_tso_segs(sk, skb, mss_now); 1842 tso_segs = tcp_init_tso_segs(sk, skb, mss_now);
1842 BUG_ON(!tso_segs); 1843 BUG_ON(!tso_segs);
1843 1844
@@ -1866,13 +1867,20 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
1866 break; 1867 break;
1867 } 1868 }
1868 1869
1869 /* TSQ : sk_wmem_alloc accounts skb truesize, 1870 /* TCP Small Queues :
1870 * including skb overhead. But thats OK. 1871 * Control number of packets in qdisc/devices to two packets / or ~1 ms.
1872 * This allows for :
1873 * - better RTT estimation and ACK scheduling
1874 * - faster recovery
1875 * - high rates
1871 */ 1876 */
1872 if (atomic_read(&sk->sk_wmem_alloc) >= sysctl_tcp_limit_output_bytes) { 1877 limit = max(skb->truesize, sk->sk_pacing_rate >> 10);
1878
1879 if (atomic_read(&sk->sk_wmem_alloc) > limit) {
1873 set_bit(TSQ_THROTTLED, &tp->tsq_flags); 1880 set_bit(TSQ_THROTTLED, &tp->tsq_flags);
1874 break; 1881 break;
1875 } 1882 }
1883
1876 limit = mss_now; 1884 limit = mss_now;
1877 if (tso_segs > 1 && !tcp_urg_mode(tp)) 1885 if (tso_segs > 1 && !tcp_urg_mode(tp))
1878 limit = tcp_mss_split_point(sk, skb, mss_now, 1886 limit = tcp_mss_split_point(sk, skb, mss_now,