]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/ipv4/tcp.c
Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
[linux.git] / net / ipv4 / tcp.c
index d885ba868822a32b55c4dcf730b5e57282373792..484485ae74c26eb43d49d972e068bcf5d0e33d58 100644 (file)
 #include <net/icmp.h>
 #include <net/inet_common.h>
 #include <net/tcp.h>
+#include <net/mptcp.h>
 #include <net/xfrm.h>
 #include <net/ip.h>
 #include <net/sock.h>
@@ -443,8 +444,6 @@ void tcp_init_sock(struct sock *sk)
        tp->tsoffset = 0;
        tp->rack.reo_wnd_steps = 1;
 
-       sk->sk_state = TCP_CLOSE;
-
        sk->sk_write_space = sk_stream_write_space;
        sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
 
@@ -692,8 +691,8 @@ static bool tcp_should_autocork(struct sock *sk, struct sk_buff *skb,
               refcount_read(&sk->sk_wmem_alloc) > skb->truesize;
 }
 
-static void tcp_push(struct sock *sk, int flags, int mss_now,
-                    int nonagle, int size_goal)
+void tcp_push(struct sock *sk, int flags, int mss_now,
+             int nonagle, int size_goal)
 {
        struct tcp_sock *tp = tcp_sk(sk);
        struct sk_buff *skb;
@@ -927,7 +926,7 @@ static unsigned int tcp_xmit_size_goal(struct sock *sk, u32 mss_now,
        return max(size_goal, mss_now);
 }
 
-static int tcp_send_mss(struct sock *sk, int *size_goal, int flags)
+int tcp_send_mss(struct sock *sk, int *size_goal, int flags)
 {
        int mss_now;
 
@@ -1778,6 +1777,8 @@ static int tcp_zerocopy_receive(struct sock *sk,
        while (length + PAGE_SIZE <= zc->length) {
                if (zc->recv_skip_hint < PAGE_SIZE) {
                        if (skb) {
+                               if (zc->recv_skip_hint > 0)
+                                       break;
                                skb = skb->next;
                                offset = seq - TCP_SKB_CB(skb)->seq;
                        } else {
@@ -2524,6 +2525,7 @@ static void tcp_rtx_queue_purge(struct sock *sk)
 {
        struct rb_node *p = rb_first(&sk->tcp_rtx_queue);
 
+       tcp_sk(sk)->highest_sack = NULL;
        while (p) {
                struct sk_buff *skb = rb_to_skb(p);
 
@@ -2614,7 +2616,6 @@ int tcp_disconnect(struct sock *sk, int flags)
        WRITE_ONCE(tp->write_seq, seq);
 
        icsk->icsk_backoff = 0;
-       tp->snd_cwnd = 2;
        icsk->icsk_probes_out = 0;
        icsk->icsk_rto = TCP_TIMEOUT_INIT;
        tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
@@ -3336,6 +3337,7 @@ static size_t tcp_opt_stats_get_size(void)
                nla_total_size(sizeof(u32)) + /* TCP_NLA_DSACK_DUPS */
                nla_total_size(sizeof(u32)) + /* TCP_NLA_REORD_SEEN */
                nla_total_size(sizeof(u32)) + /* TCP_NLA_SRTT */
+               nla_total_size(sizeof(u16)) + /* TCP_NLA_TIMEOUT_REHASH */
                0;
 }
 
@@ -3390,6 +3392,7 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk)
        nla_put_u32(stats, TCP_NLA_DSACK_DUPS, tp->dsack_dups);
        nla_put_u32(stats, TCP_NLA_REORD_SEEN, tp->reord_seen);
        nla_put_u32(stats, TCP_NLA_SRTT, tp->srtt_us >> 3);
+       nla_put_u16(stats, TCP_NLA_TIMEOUT_REHASH, tp->timeout_rehash);
 
        return stats;
 }
@@ -4021,4 +4024,5 @@ void __init tcp_init(void)
        tcp_metrics_init();
        BUG_ON(tcp_register_congestion_control(&tcp_reno) != 0);
        tcp_tasklet_init();
+       mptcp_init();
 }