Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mptcp: allow overridden write_space to be invoked

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.

Note that sk->sk_write_space was never called directly with MPTCP
sockets, so changing it to sk_stream_write_space in the init, and using
it from mptcp_write_space() is not supposed to change the current
behaviour.

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>
Link: https://patch.msgid.link/20260206-net-next-mptcp-write_space-override-v2-1-e0b12be818c6@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Geliang Tang and committed by
Jakub Kicinski
e5e2e430 f2c7fdeb

+2 -1
+1
net/mptcp/protocol.c
··· 3058 3058 sk_sockets_allocated_inc(sk); 3059 3059 sk->sk_rcvbuf = READ_ONCE(net->ipv4.sysctl_tcp_rmem[1]); 3060 3060 sk->sk_sndbuf = READ_ONCE(net->ipv4.sysctl_tcp_wmem[1]); 3061 + sk->sk_write_space = sk_stream_write_space; 3061 3062 3062 3063 return 0; 3063 3064 }
+1 -1
net/mptcp/protocol.h
··· 975 975 /* pairs with memory barrier in mptcp_poll */ 976 976 smp_mb(); 977 977 if (mptcp_stream_memory_free(sk, 1)) 978 - sk_stream_write_space(sk); 978 + INDIRECT_CALL_1(sk->sk_write_space, sk_stream_write_space, sk); 979 979 } 980 980 981 981 static inline void __mptcp_sync_sndbuf(struct sock *sk)