From: Geliang Tang <tanggeliang@kylinos.cn>
psock may override its own sk_write_space functions. This patch ensures
that the overridden sk_write_space can be invoked by MPTCP.
Note: This patch was initially included in the NVME MPTCP set.
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>
---
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 cd5266099993..f5d4d7d030f2 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -1014,7 +1014,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
Hi Geliang, Paolo, On 04/01/2026 06:29, Geliang Tang wrote: > From: Geliang Tang <tanggeliang@kylinos.cn> > > psock may override its own sk_write_space functions. This patch ensures > that the overridden sk_write_space can be invoked by MPTCP. > > Note: This patch was initially included in the NVME MPTCP set. > > 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> > --- > 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 cd5266099993..f5d4d7d030f2 100644 > --- a/net/mptcp/protocol.h > +++ b/net/mptcp/protocol.h > @@ -1014,7 +1014,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); As I mentioned on the netdev ML when sending this patch upstream, there is something fishy here: sk->sk_write_space is never set to sk_stream_write_space here with the MPTCP sockets, but to sock_def_write_space. (Subflow sockets use sk_stream_write_space.) In other words, this patch changes the behaviour, which was not supposed to be the case, now calling sock_def_write_space() instead of sk_stream_write_space(). So either sk->sk_write_space should be set to sk_stream_write_space for the MPTCP sockets (I guess, I don't think sk->sk_write_space() is ever called with an MPTCP socket for the moment), or sock_def_write_space() should have been called before (then a fix is needed). Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Matt, On Wed, 2026-02-04 at 12:56 +0100, Matthieu Baerts wrote: > Hi Geliang, Paolo, > > On 04/01/2026 06:29, Geliang Tang wrote: > > From: Geliang Tang <tanggeliang@kylinos.cn> > > > > psock may override its own sk_write_space functions. This patch > > ensures > > that the overridden sk_write_space can be invoked by MPTCP. > > > > Note: This patch was initially included in the NVME MPTCP set. > > > > 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> > > --- > > 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 cd5266099993..f5d4d7d030f2 100644 > > --- a/net/mptcp/protocol.h > > +++ b/net/mptcp/protocol.h > > @@ -1014,7 +1014,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); > > As I mentioned on the netdev ML when sending this patch upstream, Sorry for the trouble. > there > is something fishy here: sk->sk_write_space is never set to > sk_stream_write_space here with the MPTCP sockets, but to > sock_def_write_space. (Subflow sockets use sk_stream_write_space.) > > In other words, this patch changes the behaviour, which was not > supposed > to be the case, now calling sock_def_write_space() instead of > sk_stream_write_space(). > > So either sk->sk_write_space should be set to sk_stream_write_space > for > the MPTCP sockets (I guess, I don't think sk->sk_write_space() is > ever I just sent a squash-to patch to set it to sk_stream_write_space for the MPTCP sockets. Thanks, -Geliang > called with an MPTCP socket for the moment), or > sock_def_write_space() > should have been called before (then a fix is needed). > > Cheers, > Matt
Hi Matt, Mat, Paolo, On Sun, 2026-01-04 at 13:29 +0800, Geliang Tang wrote: > From: Geliang Tang <tanggeliang@kylinos.cn> > > psock may override its own sk_write_space functions. This patch > ensures > that the overridden sk_write_space can be invoked by MPTCP. > > Note: This patch was initially included in the NVME MPTCP set. This patch was initially developed to resolve the "timeout" errors observed in the NVMe MPTCP tests described in [1], because NVMe TCP overrides its own sk_write_space. During subsequent development, I discovered that not only NVMe TCP overrides its own sk_write_space, but KTLS and psock also override it. Therefore, this patch is needed in all three series. To reduce dependencies between these three series, I propose to merge this patch into the mainline first. [1] https://patchwork.kernel.org/project/mptcp/patch/cfdce3d91ca30abcf2ff9b77ecc146ad48f31d07.1762485513.git.tanggeliang@kylinos.cn/ Thanks, -Geliang > > 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> > --- > 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 cd5266099993..f5d4d7d030f2 100644 > --- a/net/mptcp/protocol.h > +++ b/net/mptcp/protocol.h > @@ -1014,7 +1014,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)
Hi Geliang, On 03/02/2026 07:54, Geliang Tang wrote: > Hi Matt, Mat, Paolo, > > On Sun, 2026-01-04 at 13:29 +0800, Geliang Tang wrote: >> From: Geliang Tang <tanggeliang@kylinos.cn> >> >> psock may override its own sk_write_space functions. This patch >> ensures >> that the overridden sk_write_space can be invoked by MPTCP. >> >> Note: This patch was initially included in the NVME MPTCP set. > > This patch was initially developed to resolve the "timeout" errors > observed in the NVMe MPTCP tests described in [1], because NVMe TCP > overrides its own sk_write_space. During subsequent development, I > discovered that not only NVMe TCP overrides its own sk_write_space, but > KTLS and psock also override it. > > Therefore, this patch is needed in all three series. To reduce > dependencies between these three series, I propose to merge this patch > into the mainline first. Just to be sure, when you say "mainline", do you mean our MPTCP tree with the export branch? Because we are at the end of a cycle here, my priority is to flush patches that are ready or fix issues. If I'm not mistaken, this patch is needed for new features that are not in our tree, not in net or net-next trees, right? Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Matt, Thanks for your reply. On Tue, 2026-02-03 at 10:42 +0100, Matthieu Baerts wrote: > Hi Geliang, > > On 03/02/2026 07:54, Geliang Tang wrote: > > Hi Matt, Mat, Paolo, > > > > On Sun, 2026-01-04 at 13:29 +0800, Geliang Tang wrote: > > > From: Geliang Tang <tanggeliang@kylinos.cn> > > > > > > psock may override its own sk_write_space functions. This patch > > > ensures > > > that the overridden sk_write_space can be invoked by MPTCP. > > > > > > Note: This patch was initially included in the NVME MPTCP set. > > > > This patch was initially developed to resolve the "timeout" errors > > observed in the NVMe MPTCP tests described in [1], because NVMe TCP > > overrides its own sk_write_space. During subsequent development, I > > discovered that not only NVMe TCP overrides its own sk_write_space, > > but > > KTLS and psock also override it. > > > > Therefore, this patch is needed in all three series. To reduce > > dependencies between these three series, I propose to merge this > > patch > > into the mainline first. > > Just to be sure, when you say "mainline", do you mean our MPTCP tree > with the export branch? > > Because we are at the end of a cycle here, my priority is to flush > patches that are ready or fix issues. If I'm not mistaken, this patch > is > needed for new features that are not in our tree, not in net or net- > next > trees, right? Yes, it is needed for new features. In this case, merging it into the export branch first is also an option. It can be sent to net-next in the next cycle. I plan to submit the KTLS series and the NVMe series to the KTLS and NVMe communities for feedback respectively. If this write_space patch enters net-next early, it would be more convenient. Thanks, -Geliang > > Cheers, > Matt
On 03/02/2026 11:31, Geliang Tang wrote: > Hi Matt, > > Thanks for your reply. > > On Tue, 2026-02-03 at 10:42 +0100, Matthieu Baerts wrote: >> Hi Geliang, >> >> On 03/02/2026 07:54, Geliang Tang wrote: >>> Hi Matt, Mat, Paolo, >>> >>> On Sun, 2026-01-04 at 13:29 +0800, Geliang Tang wrote: >>>> From: Geliang Tang <tanggeliang@kylinos.cn> >>>> >>>> psock may override its own sk_write_space functions. This patch >>>> ensures >>>> that the overridden sk_write_space can be invoked by MPTCP. >>>> >>>> Note: This patch was initially included in the NVME MPTCP set. >>> >>> This patch was initially developed to resolve the "timeout" errors >>> observed in the NVMe MPTCP tests described in [1], because NVMe TCP >>> overrides its own sk_write_space. During subsequent development, I >>> discovered that not only NVMe TCP overrides its own sk_write_space, >>> but >>> KTLS and psock also override it. >>> >>> Therefore, this patch is needed in all three series. To reduce >>> dependencies between these three series, I propose to merge this >>> patch >>> into the mainline first. >> >> Just to be sure, when you say "mainline", do you mean our MPTCP tree >> with the export branch? >> >> Because we are at the end of a cycle here, my priority is to flush >> patches that are ready or fix issues. If I'm not mistaken, this patch >> is >> needed for new features that are not in our tree, not in net or net- >> next >> trees, right? > > Yes, it is needed for new features. In this case, merging it into the > export branch first is also an option. It can be sent to net-next in > the next cycle. I plan to submit the KTLS series and the NVMe series to > the KTLS and NVMe communities for feedback respectively. If this > write_space patch enters net-next early, it would be more convenient. I see. Is only this patch 2/3 from this series needed? Or the whole series? Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Geliang, On 03/02/2026 11:56, Matthieu Baerts wrote: > On 03/02/2026 11:31, Geliang Tang wrote: >> Hi Matt, >> >> Thanks for your reply. >> >> On Tue, 2026-02-03 at 10:42 +0100, Matthieu Baerts wrote: >>> Hi Geliang, >>> >>> On 03/02/2026 07:54, Geliang Tang wrote: >>>> Hi Matt, Mat, Paolo, >>>> >>>> On Sun, 2026-01-04 at 13:29 +0800, Geliang Tang wrote: >>>>> From: Geliang Tang <tanggeliang@kylinos.cn> >>>>> >>>>> psock may override its own sk_write_space functions. This patch >>>>> ensures >>>>> that the overridden sk_write_space can be invoked by MPTCP. >>>>> >>>>> Note: This patch was initially included in the NVME MPTCP set. >>>> >>>> This patch was initially developed to resolve the "timeout" errors >>>> observed in the NVMe MPTCP tests described in [1], because NVMe TCP >>>> overrides its own sk_write_space. During subsequent development, I >>>> discovered that not only NVMe TCP overrides its own sk_write_space, >>>> but >>>> KTLS and psock also override it. >>>> >>>> Therefore, this patch is needed in all three series. To reduce >>>> dependencies between these three series, I propose to merge this >>>> patch >>>> into the mainline first. >>> >>> Just to be sure, when you say "mainline", do you mean our MPTCP tree >>> with the export branch? >>> >>> Because we are at the end of a cycle here, my priority is to flush >>> patches that are ready or fix issues. If I'm not mistaken, this patch >>> is >>> needed for new features that are not in our tree, not in net or net- >>> next >>> trees, right? >> >> Yes, it is needed for new features. In this case, merging it into the >> export branch first is also an option. It can be sent to net-next in >> the next cycle. I plan to submit the KTLS series and the NVMe series to >> the KTLS and NVMe communities for feedback respectively. If this >> write_space patch enters net-next early, it would be more convenient. > > I see. > > Is only this patch 2/3 from this series needed? Or the whole series? I just applied this patch (only this one) and I will try to send it this cycle. Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Cheers, Matt -- Sponsored by the NGI0 Core fund.
On 03/02/2026 12:13, Matthieu Baerts wrote: > Hi Geliang, > > On 03/02/2026 11:56, Matthieu Baerts wrote: >> On 03/02/2026 11:31, Geliang Tang wrote: >>> Hi Matt, >>> >>> Thanks for your reply. >>> >>> On Tue, 2026-02-03 at 10:42 +0100, Matthieu Baerts wrote: >>>> Hi Geliang, >>>> >>>> On 03/02/2026 07:54, Geliang Tang wrote: >>>>> Hi Matt, Mat, Paolo, >>>>> >>>>> On Sun, 2026-01-04 at 13:29 +0800, Geliang Tang wrote: >>>>>> From: Geliang Tang <tanggeliang@kylinos.cn> >>>>>> >>>>>> psock may override its own sk_write_space functions. This patch >>>>>> ensures >>>>>> that the overridden sk_write_space can be invoked by MPTCP. >>>>>> >>>>>> Note: This patch was initially included in the NVME MPTCP set. >>>>> >>>>> This patch was initially developed to resolve the "timeout" errors >>>>> observed in the NVMe MPTCP tests described in [1], because NVMe TCP >>>>> overrides its own sk_write_space. During subsequent development, I >>>>> discovered that not only NVMe TCP overrides its own sk_write_space, >>>>> but >>>>> KTLS and psock also override it. >>>>> >>>>> Therefore, this patch is needed in all three series. To reduce >>>>> dependencies between these three series, I propose to merge this >>>>> patch >>>>> into the mainline first. >>>> >>>> Just to be sure, when you say "mainline", do you mean our MPTCP tree >>>> with the export branch? >>>> >>>> Because we are at the end of a cycle here, my priority is to flush >>>> patches that are ready or fix issues. If I'm not mistaken, this patch >>>> is >>>> needed for new features that are not in our tree, not in net or net- >>>> next >>>> trees, right? >>> >>> Yes, it is needed for new features. In this case, merging it into the >>> export branch first is also an option. It can be sent to net-next in >>> the next cycle. I plan to submit the KTLS series and the NVMe series to >>> the KTLS and NVMe communities for feedback respectively. If this >>> write_space patch enters net-next early, it would be more convenient. >> >> I see. >> >> Is only this patch 2/3 from this series needed? Or the whole series? > > I just applied this patch (only this one) and I will try to send it this > cycle. New patches for t/upstream: - d8af4a2b24b5: mptcp: allow overridden write_space to be invoked - Results: 9577d6866c4a..a5bb737958a3 (export) Tests are now in progress: - export: https://github.com/multipath-tcp/mptcp_net-next/commit/9dd2299cd09c36fd30169ecf0f0d984746c0ea66/checks Cheers, Matt -- Sponsored by the NGI0 Core fund.
© 2016 - 2026 Red Hat, Inc.