[PATCH net-next 07/15] mptcp: allow overridden write_space to be invoked

Matthieu Baerts (NGI0) posted 15 patches 5 days, 22 hours ago
[PATCH net-next 07/15] mptcp: allow overridden write_space to be invoked
Posted by Matthieu Baerts (NGI0) 5 days, 22 hours ago
From: Geliang Tang <tanggeliang@kylinos.cn>

Future extensions with psock will override their own sk->sk_write_space
callback. This patch ensures that the overridden sk_write_space can be
invoked by MPTCP.

INDIRECT_CALL is used to keep the default path optimised.

This patch is shared early to ease discussions around future RFC and
avoid confusions with this "fix" that is needed for different future
extensions.

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Co-developed-by: Gang Yan <yangang@kylinos.cn>
Signed-off-by: Gang Yan <yangang@kylinos.cn>
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/protocol.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index f4bfe91ca7f9..0bd1ee860316 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -975,7 +975,7 @@ static inline void mptcp_write_space(struct sock *sk)
 	/* pairs with memory barrier in mptcp_poll */
 	smp_mb();
 	if (mptcp_stream_memory_free(sk, 1))
-		sk_stream_write_space(sk);
+		INDIRECT_CALL_1(sk->sk_write_space, sk_stream_write_space, sk);
 }
 
 static inline void __mptcp_sync_sndbuf(struct sock *sk)

-- 
2.51.0
Re: [PATCH net-next 07/15] mptcp: allow overridden write_space to be invoked
Posted by Matthieu Baerts 5 days, 5 hours ago
Hello,

On 03/02/2026 19:41, Matthieu Baerts (NGI0) wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> Future extensions with psock will override their own sk->sk_write_space
> callback. This patch ensures that the overridden sk_write_space can be
> invoked by MPTCP.
> 
> INDIRECT_CALL is used to keep the default path optimised.
> 
> This patch is shared early to ease discussions around future RFC and
> avoid confusions with this "fix" that is needed for different future
> extensions.
> 
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Co-developed-by: Gang Yan <yangang@kylinos.cn>
> Signed-off-by: Gang Yan <yangang@kylinos.cn>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
>  net/mptcp/protocol.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index f4bfe91ca7f9..0bd1ee860316 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -975,7 +975,7 @@ static inline void mptcp_write_space(struct sock *sk)
>  	/* pairs with memory barrier in mptcp_poll */
>  	smp_mb();
>  	if (mptcp_stream_memory_free(sk, 1))
> -		sk_stream_write_space(sk);
> +		INDIRECT_CALL_1(sk->sk_write_space, sk_stream_write_space, sk);

Is it possible to drop only this patch from this series? It is
independent of the rest, and the AI review tool spotted that
sk->sk_write_space is not sk_stream_write_space by default.

I can send a v2 without this patch if preferred.

>  }
>  
>  static inline void __mptcp_sync_sndbuf(struct sock *sk)
> 

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH net-next 07/15] mptcp: allow overridden write_space to be invoked
Posted by Jakub Kicinski 4 days, 13 hours ago
On Wed, 4 Feb 2026 11:47:13 +0100 Matthieu Baerts wrote:
> > diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> > index f4bfe91ca7f9..0bd1ee860316 100644
> > --- a/net/mptcp/protocol.h
> > +++ b/net/mptcp/protocol.h
> > @@ -975,7 +975,7 @@ static inline void mptcp_write_space(struct sock *sk)
> >  	/* pairs with memory barrier in mptcp_poll */
> >  	smp_mb();
> >  	if (mptcp_stream_memory_free(sk, 1))
> > -		sk_stream_write_space(sk);
> > +		INDIRECT_CALL_1(sk->sk_write_space, sk_stream_write_space, sk);  
> 
> Is it possible to drop only this patch from this series? It is
> independent of the rest, and the AI review tool spotted that
> sk->sk_write_space is not sk_stream_write_space by default.
> 
> I can send a v2 without this patch if preferred.

Ack, looks like this is the last patch in terms of real code
so can do. BTW I've been offering other sub-maintainers to
run the AI stuff on their patchwork instances. Looks like
there's a mptcp instance in k.org patchwork. 

LMK if you want me to hook it up (..when time allows).
Re: [PATCH net-next 07/15] mptcp: allow overridden write_space to be invoked
Posted by Matthieu Baerts 4 days, 8 hours ago
Hi Jakub,

On 05/02/2026 03:44, Jakub Kicinski wrote:
> On Wed, 4 Feb 2026 11:47:13 +0100 Matthieu Baerts wrote:
>>> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
>>> index f4bfe91ca7f9..0bd1ee860316 100644
>>> --- a/net/mptcp/protocol.h
>>> +++ b/net/mptcp/protocol.h
>>> @@ -975,7 +975,7 @@ static inline void mptcp_write_space(struct sock *sk)
>>>  	/* pairs with memory barrier in mptcp_poll */
>>>  	smp_mb();
>>>  	if (mptcp_stream_memory_free(sk, 1))
>>> -		sk_stream_write_space(sk);
>>> +		INDIRECT_CALL_1(sk->sk_write_space, sk_stream_write_space, sk);  
>>
>> Is it possible to drop only this patch from this series? It is
>> independent of the rest, and the AI review tool spotted that
>> sk->sk_write_space is not sk_stream_write_space by default.
>>
>> I can send a v2 without this patch if preferred.
> 
> Ack, looks like this is the last patch in terms of real code
> so can do.

Thank you for having applied this series without this patch!

> BTW I've been offering other sub-maintainers to
> run the AI stuff on their patchwork instances. Looks like
> there's a mptcp instance in k.org patchwork. 
> 
> LMK if you want me to hook it up (..when time allows).

That would be great to catch issues early, and avoid multiple versions.
So, yes please, but take your time, that's not urgent. Thank you!

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.