mptcp: track window announced to peer
[sfrench/cifs-2.6.git] / net / ipv4 / tcp_output.c
index 99905bc01d40c11f6832142adaa776ecad7b695b..41880d3521ed73b479abb08adf2de0a73f5aa0e2 100644 (file)
@@ -445,11 +445,12 @@ struct tcp_out_options {
        struct mptcp_out_options mptcp;
 };
 
-static void mptcp_options_write(__be32 *ptr, struct tcp_out_options *opts)
+static void mptcp_options_write(__be32 *ptr, const struct tcp_sock *tp,
+                               struct tcp_out_options *opts)
 {
 #if IS_ENABLED(CONFIG_MPTCP)
        if (unlikely(OPTION_MPTCP & opts->options))
-               mptcp_write_options(ptr, &opts->mptcp);
+               mptcp_write_options(ptr, tp, &opts->mptcp);
 #endif
 }
 
@@ -701,7 +702,7 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
 
        smc_options_write(ptr, &options);
 
-       mptcp_options_write(ptr, opts);
+       mptcp_options_write(ptr, tp, opts);
 }
 
 static void smc_set_option(const struct tcp_sock *tp,
@@ -1346,7 +1347,6 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
                }
        }
 
-       tcp_options_write((__be32 *)(th + 1), tp, &opts);
        skb_shinfo(skb)->gso_type = sk->sk_gso_type;
        if (likely(!(tcb->tcp_flags & TCPHDR_SYN))) {
                th->window      = htons(tcp_select_window(sk));
@@ -1357,6 +1357,9 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
                 */
                th->window      = htons(min(tp->rcv_wnd, 65535U));
        }
+
+       tcp_options_write((__be32 *)(th + 1), tp, &opts);
+
 #ifdef CONFIG_TCP_MD5SIG
        /* Calculate the MD5 hash, as we have all we need now */
        if (md5) {