--- zzzz-none-000/linux-4.1.52/net/core/sock.c 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/net/core/sock.c 2022-03-02 11:37:13.000000000 +0000 @@ -136,6 +136,13 @@ #include +#if defined(CONFIG_BCM_MPTCP) && defined(CONFIG_BCM_KF_MPTCP) +#ifdef CONFIG_MPTCP +#include +#include +#endif + +#endif #include #include @@ -277,7 +284,11 @@ "slock-AF_IEEE802154", "slock-AF_CAIF" , "slock-AF_ALG" , "slock-AF_NFC" , "slock-AF_VSOCK" ,"slock-AF_MAX" }; +#if !defined(CONFIG_BCM_MPTCP) || !defined(CONFIG_BCM_KF_MPTCP) static const char *const af_family_clock_key_strings[AF_MAX+1] = { +#else +char *const af_family_clock_key_strings[AF_MAX+1] = { +#endif "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" , "clock-AF_AX25" , "clock-AF_IPX" , "clock-AF_APPLETALK", "clock-AF_NETROM", "clock-AF_BRIDGE" , "clock-AF_ATMPVC" , @@ -298,7 +309,11 @@ * sk_callback_lock locking rules are per-address-family, * so split the lock classes by using a per-AF key: */ +#if !defined(CONFIG_BCM_MPTCP) || !defined(CONFIG_BCM_KF_MPTCP) static struct lock_class_key af_callback_keys[AF_MAX]; +#else +struct lock_class_key af_callback_keys[AF_MAX]; +#endif /* Take into consideration the size of the struct sk_buff overhead in the * determination of these values, since that is non-constant across @@ -1265,8 +1280,30 @@ * * (We also register the sk_lock with the lock validator.) */ +#if !defined(CONFIG_BCM_MPTCP) || !defined(CONFIG_BCM_KF_MPTCP) static inline void sock_lock_init(struct sock *sk) { +#else +void sock_lock_init(struct sock *sk) +{ +#ifdef CONFIG_MPTCP + /* Reclassify the lock-class for subflows */ + if (sk->sk_type == SOCK_STREAM && sk->sk_protocol == IPPROTO_TCP) + if (mptcp(tcp_sk(sk)) || tcp_sk(sk)->is_master_sk) { + sock_lock_init_class_and_name(sk, "slock-AF_INET-MPTCP", + &meta_slock_key, + "sk_lock-AF_INET-MPTCP", + &meta_key); + + /* We don't yet have the mptcp-point. + * Thus we still need inet_sock_destruct + */ + sk->sk_destruct = inet_sock_destruct; + return; + } +#endif + +#endif sock_lock_init_class_and_name(sk, af_family_slock_key_strings[sk->sk_family], af_family_slock_keys + sk->sk_family, @@ -1313,7 +1350,11 @@ } EXPORT_SYMBOL(sk_prot_clear_portaddr_nulls); +#if !defined(CONFIG_BCM_MPTCP) || !defined(CONFIG_BCM_KF_MPTCP) static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority, +#else +struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority, +#endif int family) { struct sock *sk; @@ -1534,6 +1575,9 @@ newsk->sk_userlocks = sk->sk_userlocks & ~SOCK_BINDPORT_LOCK; sock_reset_flag(newsk, SOCK_DONE); +#if defined(CONFIG_BCM_MPTCP) && defined(CONFIG_BCM_KF_MPTCP) + sock_reset_flag(newsk, SOCK_MPTCP); +#endif skb_queue_head_init(&newsk->sk_error_queue); filter = rcu_dereference_protected(newsk->sk_filter, 1);