--- zzzz-none-000/linux-4.1.52/net/ipv4/af_inet.c 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/net/ipv4/af_inet.c 2022-03-02 11:37:13.000000000 +0000 @@ -104,6 +104,9 @@ #include #include #include +#if defined(CONFIG_BCM_MPTCP) && defined(CONFIG_BCM_KF_MPTCP) +#include +#endif #include #include #include @@ -147,6 +150,11 @@ return; } +#if defined(CONFIG_BCM_MPTCP) && defined(CONFIG_BCM_KF_MPTCP) + if (sock_flag(sk, SOCK_MPTCP)) + mptcp_disable_static_key(); + +#endif WARN_ON(atomic_read(&sk->sk_rmem_alloc)); WARN_ON(atomic_read(&sk->sk_wmem_alloc)); WARN_ON(sk->sk_wmem_queued); @@ -248,8 +256,12 @@ * Create an inet socket. */ +#if !defined(CONFIG_BCM_MPTCP) || !defined(CONFIG_BCM_KF_MPTCP) static int inet_create(struct net *net, struct socket *sock, int protocol, int kern) +#else +int inet_create(struct net *net, struct socket *sock, int protocol, int kern) +#endif { struct sock *sk; struct inet_protosw *answer; @@ -675,6 +687,25 @@ lock_sock(sk2); sock_rps_record_flow(sk2); +#if defined(CONFIG_BCM_MPTCP) && defined(CONFIG_BCM_KF_MPTCP) + + if (sk2->sk_protocol == IPPROTO_TCP && mptcp(tcp_sk(sk2))) { + struct sock *sk_it = sk2; + + mptcp_for_each_sk(tcp_sk(sk2)->mpcb, sk_it) + sock_rps_record_flow(sk_it); + + if (tcp_sk(sk2)->mpcb->master_sk) { + sk_it = tcp_sk(sk2)->mpcb->master_sk; + + write_lock_bh(&sk_it->sk_callback_lock); + sk_it->sk_wq = newsock->wq; + sk_it->sk_socket = newsock; + write_unlock_bh(&sk_it->sk_callback_lock); + } + } + +#endif WARN_ON(!((1 << sk2->sk_state) & (TCPF_ESTABLISHED | TCPF_SYN_RECV | TCPF_CLOSE_WAIT | TCPF_CLOSE))); @@ -1787,6 +1818,11 @@ ip_init(); +#if defined(CONFIG_BCM_MPTCP) && defined(CONFIG_BCM_KF_MPTCP) + /* We must initialize MPTCP before TCP. */ + mptcp_init(); + +#endif tcp_v4_init(); /* Setup TCP slab cache for open requests. */