--- zzzz-none-000/linux-4.19.183/net/ipv4/af_inet.c 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/net/ipv4/af_inet.c 2023-06-28 08:54:21.000000000 +0000 @@ -104,6 +104,9 @@ #include #include #include +#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP) +#include +#endif #include #include #include @@ -150,6 +153,11 @@ return; } +#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP) + if (sock_flag(sk, SOCK_MPTCP)) + mptcp_disable_static_key(); + +#endif WARN_ON(atomic_read(&sk->sk_rmem_alloc)); WARN_ON(refcount_read(&sk->sk_wmem_alloc)); WARN_ON(sk->sk_wmem_queued); @@ -244,8 +252,12 @@ * Create an inet socket. */ +#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_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; @@ -739,6 +751,26 @@ lock_sock(sk2); sock_rps_record_flow(sk2); +#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP) + + if (sk2->sk_protocol == IPPROTO_TCP && mptcp(tcp_sk(sk2))) { + struct mptcp_tcp_sock *mptcp; + + mptcp_for_each_sub(tcp_sk(sk2)->mpcb, mptcp) { + sock_rps_record_flow(mptcp_to_sock(mptcp)); + } + + if (tcp_sk(sk2)->mpcb->master_sk) { + struct sock *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))); @@ -1955,6 +1987,13 @@ ip_init(); + ip_input_init(); + +#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP) + /* We must initialize MPTCP before TCP. */ + mptcp_init(); + +#endif /* Setup TCP slab cache for open requests. */ tcp_init();