--- zzzz-none-000/linux-4.19.183/net/core/sock.c 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/net/core/sock.c 2023-06-28 08:54:21.000000000 +0000 @@ -140,6 +140,13 @@ #include +#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP) +#ifdef CONFIG_MPTCP +#include +#include +#endif + +#endif #include #include @@ -1412,6 +1419,25 @@ */ static inline void sock_lock_init(struct sock *sk) { +#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP) +#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, meta_slock_key_name, + &meta_slock_key, + meta_key_name, + &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 if (sk->sk_kern_sock) sock_lock_init_class_and_name( sk, @@ -1460,8 +1486,17 @@ sk = kmem_cache_alloc(slab, priority & ~__GFP_ZERO); if (!sk) return sk; +#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP) if (priority & __GFP_ZERO) sk_prot_clear_nulls(sk, prot->obj_size); +#else + if (priority & __GFP_ZERO) { + if (prot->clear_sk) + prot->clear_sk(sk, prot->obj_size); + else + sk_prot_clear_nulls(sk, prot->obj_size); + } +#endif } else sk = kmalloc(prot->obj_size, priority); @@ -1690,7 +1725,9 @@ atomic_set(&newsk->sk_zckey, 0); sock_reset_flag(newsk, SOCK_DONE); - +#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP) + sock_reset_flag(newsk, SOCK_MPTCP); +#endif /* sk->sk_memcg will be populated at accept() time */ newsk->sk_memcg = NULL; @@ -1850,6 +1887,13 @@ #endif skb->destructor = sock_wfree; skb_set_hash_from_sk(skb, sk); + +#ifdef CONFIG_AVM_SK_TC_INDEX +#ifdef CONFIG_NET_SCHED + skb->tc_index = sk->sk_tc_index; +#endif +#endif + /* * We used to take a refcount on sk, but following operation * is enough to guarantee sk_free() wont free this sock until