--- zzzz-none-000/linux-4.1.38/net/ipv4/tcp_fastopen.c 2017-01-18 18:48:06.000000000 +0000 +++ bcm63-7582-715/linux-4.1.38/net/ipv4/tcp_fastopen.c 2020-11-25 10:06:48.000000000 +0000 @@ -7,6 +7,9 @@ #include #include #include +#if defined(CONFIG_BCM_MPTCP) && defined(CONFIG_BCM_KF_MPTCP) +#include +#endif int sysctl_tcp_fastopen __read_mostly = TFO_CLIENT_ENABLE; @@ -131,7 +134,11 @@ { struct tcp_sock *tp; struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue; +#if !defined(CONFIG_BCM_MPTCP) || !defined(CONFIG_BCM_KF_MPTCP) struct sock *child; +#else + struct sock *child, *meta_sk; +#endif u32 end_seq; req->num_retrans = 0; @@ -171,6 +178,7 @@ /* Add the child socket directly into the accept queue */ inet_csk_reqsk_queue_add(sk, req, child); +#if !defined(CONFIG_BCM_MPTCP) || !defined(CONFIG_BCM_KF_MPTCP) /* Now finish processing the fastopen child socket. */ inet_csk(child)->icsk_af_ops->rebuild_header(child); tcp_init_congestion_control(child); @@ -178,6 +186,7 @@ tcp_init_metrics(child); tcp_init_buffer_space(child); +#endif /* Queue the data carried in the SYN packet. We need to first * bump skb's refcnt because the caller will attempt to free it. * Note that IPv6 might also have used skb_get() trick @@ -214,8 +223,30 @@ } } tcp_rsk(req)->rcv_nxt = tp->rcv_nxt = end_seq; +#if defined(CONFIG_BCM_MPTCP) && defined(CONFIG_BCM_KF_MPTCP) + + meta_sk = child; + if (!mptcp_check_req_fastopen(meta_sk, req)) { + child = tcp_sk(meta_sk)->mpcb->master_sk; + tp = tcp_sk(child); + } + + /* Now finish processing the fastopen child socket. */ + inet_csk(child)->icsk_af_ops->rebuild_header(child); + tcp_init_congestion_control(child); + tcp_mtup_init(child); + tcp_init_metrics(child); + tp->ops->init_buffer_space(child); + +#endif sk->sk_data_ready(sk); +#if !defined(CONFIG_BCM_MPTCP) || !defined(CONFIG_BCM_KF_MPTCP) bh_unlock_sock(child); +#else + if (mptcp(tcp_sk(child))) + bh_unlock_sock(child); + bh_unlock_sock(meta_sk); +#endif sock_put(child); WARN_ON(!req->sk); return true;