diff options
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 1c839c99114c..0bc9e46a5369 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1806,40 +1806,6 @@ static bool tcp_snd_wnd_test(const struct tcp_sock *tp, | |||
1806 | return !after(end_seq, tcp_wnd_end(tp)); | 1806 | return !after(end_seq, tcp_wnd_end(tp)); |
1807 | } | 1807 | } |
1808 | 1808 | ||
1809 | /* This checks if the data bearing packet SKB (usually tcp_send_head(sk)) | ||
1810 | * should be put on the wire right now. If so, it returns the number of | ||
1811 | * packets allowed by the congestion window. | ||
1812 | */ | ||
1813 | static unsigned int tcp_snd_test(const struct sock *sk, struct sk_buff *skb, | ||
1814 | unsigned int cur_mss, int nonagle) | ||
1815 | { | ||
1816 | const struct tcp_sock *tp = tcp_sk(sk); | ||
1817 | unsigned int cwnd_quota; | ||
1818 | |||
1819 | tcp_init_tso_segs(skb, cur_mss); | ||
1820 | |||
1821 | if (!tcp_nagle_test(tp, skb, cur_mss, nonagle)) | ||
1822 | return 0; | ||
1823 | |||
1824 | cwnd_quota = tcp_cwnd_test(tp, skb); | ||
1825 | if (cwnd_quota && !tcp_snd_wnd_test(tp, skb, cur_mss)) | ||
1826 | cwnd_quota = 0; | ||
1827 | |||
1828 | return cwnd_quota; | ||
1829 | } | ||
1830 | |||
1831 | /* Test if sending is allowed right now. */ | ||
1832 | bool tcp_may_send_now(struct sock *sk) | ||
1833 | { | ||
1834 | const struct tcp_sock *tp = tcp_sk(sk); | ||
1835 | struct sk_buff *skb = tcp_send_head(sk); | ||
1836 | |||
1837 | return skb && | ||
1838 | tcp_snd_test(sk, skb, tcp_current_mss(sk), | ||
1839 | (tcp_skb_is_last(sk, skb) ? | ||
1840 | tp->nonagle : TCP_NAGLE_PUSH)); | ||
1841 | } | ||
1842 | |||
1843 | /* Trim TSO SKB to LEN bytes, put the remaining data into a new packet | 1809 | /* Trim TSO SKB to LEN bytes, put the remaining data into a new packet |
1844 | * which is put after SKB on the list. It is very much like | 1810 | * which is put after SKB on the list. It is very much like |
1845 | * tcp_fragment() except that it may make several kinds of assumptions | 1811 | * tcp_fragment() except that it may make several kinds of assumptions |
@@ -3423,6 +3389,10 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) | |||
3423 | goto done; | 3389 | goto done; |
3424 | } | 3390 | } |
3425 | 3391 | ||
3392 | /* data was not sent, this is our new send_head */ | ||
3393 | sk->sk_send_head = syn_data; | ||
3394 | tp->packets_out -= tcp_skb_pcount(syn_data); | ||
3395 | |||
3426 | fallback: | 3396 | fallback: |
3427 | /* Send a regular SYN with Fast Open cookie request option */ | 3397 | /* Send a regular SYN with Fast Open cookie request option */ |
3428 | if (fo->cookie.len > 0) | 3398 | if (fo->cookie.len > 0) |
@@ -3475,6 +3445,11 @@ int tcp_connect(struct sock *sk) | |||
3475 | */ | 3445 | */ |
3476 | tp->snd_nxt = tp->write_seq; | 3446 | tp->snd_nxt = tp->write_seq; |
3477 | tp->pushed_seq = tp->write_seq; | 3447 | tp->pushed_seq = tp->write_seq; |
3448 | buff = tcp_send_head(sk); | ||
3449 | if (unlikely(buff)) { | ||
3450 | tp->snd_nxt = TCP_SKB_CB(buff)->seq; | ||
3451 | tp->pushed_seq = TCP_SKB_CB(buff)->seq; | ||
3452 | } | ||
3478 | TCP_INC_STATS(sock_net(sk), TCP_MIB_ACTIVEOPENS); | 3453 | TCP_INC_STATS(sock_net(sk), TCP_MIB_ACTIVEOPENS); |
3479 | 3454 | ||
3480 | /* Timer for repeating the SYN until an answer. */ | 3455 | /* Timer for repeating the SYN until an answer. */ |