* [PATCH mptcp-next v2 1/3] mptcp: implement psock_update_sk_prot
2026-01-04 5:29 [PATCH mptcp-next v2 0/3] implement psock_update_sk_prot Geliang Tang
@ 2026-01-04 5:29 ` Geliang Tang
2026-01-04 5:29 ` [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked Geliang Tang
` (2 subsequent siblings)
3 siblings, 0 replies; 13+ messages in thread
From: Geliang Tang @ 2026-01-04 5:29 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang, kernel test robot, Cong Wang
From: Geliang Tang <tanggeliang@kylinos.cn>
Add MPTCP support for BPF sockmap by implementing psock_update_sk_prot
callback. This allows MPTCP sockets to dynamically switch protocol
handlers when attached to or detached from sockmap programs. Separate
protocol structures are maintained for IPv4/IPv6 and TX/RX configurations.
tcp_bpf_update_proto() in net/ipv4/tcp_bpf.c is a frame of reference for
this patch.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512261144.DxrvwMS3-lkp@intel.com/
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/521
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/mptcp/protocol.c | 105 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 900f26e21acd..0b655efb9bd8 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -11,6 +11,7 @@
#include <linux/netdevice.h>
#include <linux/sched/signal.h>
#include <linux/atomic.h>
+#include <linux/skmsg.h>
#include <net/aligned_data.h>
#include <net/rps.h>
#include <net/sock.h>
@@ -4017,6 +4018,98 @@ static int mptcp_connect(struct sock *sk, struct sockaddr_unsized *uaddr,
return 0;
}
+#ifdef CONFIG_BPF_SYSCALL
+enum {
+ MPTCP_BPF_IPV4,
+ MPTCP_BPF_IPV6,
+ MPTCP_BPF_NUM_PROTS,
+};
+
+enum {
+ MPTCP_BPF_BASE,
+ MPTCP_BPF_TX,
+ MPTCP_BPF_RX,
+ MPTCP_BPF_TXRX,
+ MPTCP_BPF_NUM_CFGS,
+};
+
+static struct proto mptcp_bpf_prots[MPTCP_BPF_NUM_PROTS][MPTCP_BPF_NUM_CFGS];
+
+static void mptcp_bpf_rebuild_protos(struct proto prot[MPTCP_BPF_NUM_CFGS],
+ struct proto *base)
+{
+ prot[MPTCP_BPF_BASE] = *base;
+ prot[MPTCP_BPF_BASE].destroy = sock_map_destroy;
+ prot[MPTCP_BPF_BASE].close = sock_map_close;
+ prot[MPTCP_BPF_BASE].sock_is_readable = sk_msg_is_readable;
+
+ prot[MPTCP_BPF_TX] = prot[MPTCP_BPF_BASE];
+ prot[MPTCP_BPF_RX] = prot[MPTCP_BPF_BASE];
+ prot[MPTCP_BPF_TXRX] = prot[MPTCP_BPF_TX];
+}
+
+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
+static struct proto *mptcpv6_prot_saved __read_mostly;
+static DEFINE_SPINLOCK(mptcpv6_prot_lock);
+
+static void mptcp_bpf_check_v6_needs_rebuild(struct proto *ops)
+{
+ /*
+ * Load with acquire semantics to ensure we see the latest protocol
+ * structure before checking for rebuild.
+ */
+ if (unlikely(ops != smp_load_acquire(&mptcpv6_prot_saved))) {
+ spin_lock_bh(&mptcpv6_prot_lock);
+ if (likely(ops != mptcpv6_prot_saved)) {
+ mptcp_bpf_rebuild_protos(mptcp_bpf_prots[MPTCP_BPF_IPV6], ops);
+ /* Ensure mptcpv6_prot_saved update is visible before releasing lock */
+ smp_store_release(&mptcpv6_prot_saved, ops);
+ }
+ spin_unlock_bh(&mptcpv6_prot_lock);
+ }
+}
+
+static int mptcp_bpf_assert_proto_ops(struct proto *ops)
+{
+ /* In order to avoid retpoline, we make assumptions when we call
+ * into ops if e.g. a psock is not present. Make sure they are
+ * indeed valid assumptions.
+ */
+ return ops->recvmsg == mptcp_recvmsg &&
+ ops->sendmsg == mptcp_sendmsg ? 0 : -EOPNOTSUPP;
+}
+#endif
+
+static int mptcp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)
+{
+ int family = sk->sk_family == AF_INET6 ? MPTCP_BPF_IPV6 : MPTCP_BPF_IPV4;
+ int config = psock->progs.msg_parser ? MPTCP_BPF_TX : MPTCP_BPF_BASE;
+
+ if (psock->progs.stream_verdict || psock->progs.skb_verdict)
+ config = (config == MPTCP_BPF_TX) ? MPTCP_BPF_TXRX : MPTCP_BPF_RX;
+
+ if (restore) {
+ sk->sk_write_space = psock->saved_write_space;
+ /* Pairs with lockless read in sk_clone_lock() */
+ sock_replace_proto(sk, psock->sk_proto);
+ return 0;
+ }
+
+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
+ if (sk->sk_family == AF_INET6) {
+ if (mptcp_bpf_assert_proto_ops(psock->sk_proto))
+ return -EINVAL;
+
+ mptcp_bpf_check_v6_needs_rebuild(psock->sk_proto);
+ }
+#endif
+
+ /* Pairs with lockless read in sk_clone_lock() */
+ sock_replace_proto(sk, &mptcp_bpf_prots[family][config]);
+ return 0;
+}
+#endif
+
static struct proto mptcp_prot = {
.name = "MPTCP",
.owner = THIS_MODULE,
@@ -4048,8 +4141,20 @@ static struct proto mptcp_prot = {
.obj_size = sizeof(struct mptcp_sock),
.slab_flags = SLAB_TYPESAFE_BY_RCU,
.no_autobind = true,
+#ifdef CONFIG_BPF_SYSCALL
+ .psock_update_sk_prot = mptcp_bpf_update_proto,
+#endif
};
+#ifdef CONFIG_BPF_SYSCALL
+static int __init mptcp_bpf_v4_build_proto(void)
+{
+ mptcp_bpf_rebuild_protos(mptcp_bpf_prots[MPTCP_BPF_IPV4], &mptcp_prot);
+ return 0;
+}
+late_initcall(mptcp_bpf_v4_build_proto);
+#endif
+
static int mptcp_bind(struct socket *sock, struct sockaddr_unsized *uaddr, int addr_len)
{
struct mptcp_sock *msk = mptcp_sk(sock->sk);
--
2.51.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked
2026-01-04 5:29 [PATCH mptcp-next v2 0/3] implement psock_update_sk_prot Geliang Tang
2026-01-04 5:29 ` [PATCH mptcp-next v2 1/3] mptcp: " Geliang Tang
@ 2026-01-04 5:29 ` Geliang Tang
2026-02-03 6:54 ` Geliang Tang
2026-02-04 11:56 ` Matthieu Baerts
2026-01-04 5:29 ` [PATCH mptcp-next v2 3/3] selftests/bpf: Update sockmap tests for MPTCP Geliang Tang
2026-01-04 6:38 ` [PATCH mptcp-next v2 0/3] implement psock_update_sk_prot MPTCP CI
3 siblings, 2 replies; 13+ messages in thread
From: Geliang Tang @ 2026-01-04 5:29 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang, Paolo Abeni, Gang Yan
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
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked
2026-01-04 5:29 ` [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked Geliang Tang
@ 2026-02-03 6:54 ` Geliang Tang
2026-02-03 9:42 ` Matthieu Baerts
2026-02-04 11:56 ` Matthieu Baerts
1 sibling, 1 reply; 13+ messages in thread
From: Geliang Tang @ 2026-02-03 6:54 UTC (permalink / raw)
To: Matthieu Baerts, Mat Martineau, Paolo Abeni; +Cc: Gang Yan, mptcp
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)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked
2026-02-03 6:54 ` Geliang Tang
@ 2026-02-03 9:42 ` Matthieu Baerts
2026-02-03 10:31 ` Geliang Tang
0 siblings, 1 reply; 13+ messages in thread
From: Matthieu Baerts @ 2026-02-03 9:42 UTC (permalink / raw)
To: Geliang Tang, Mat Martineau, Paolo Abeni; +Cc: Gang Yan, mptcp
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked
2026-02-03 9:42 ` Matthieu Baerts
@ 2026-02-03 10:31 ` Geliang Tang
2026-02-03 10:56 ` Matthieu Baerts
0 siblings, 1 reply; 13+ messages in thread
From: Geliang Tang @ 2026-02-03 10:31 UTC (permalink / raw)
To: Matthieu Baerts, Mat Martineau, Paolo Abeni; +Cc: Gang Yan, mptcp
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked
2026-02-03 10:31 ` Geliang Tang
@ 2026-02-03 10:56 ` Matthieu Baerts
2026-02-03 11:13 ` Matthieu Baerts
0 siblings, 1 reply; 13+ messages in thread
From: Matthieu Baerts @ 2026-02-03 10:56 UTC (permalink / raw)
To: Geliang Tang, Mat Martineau, Paolo Abeni; +Cc: Gang Yan, mptcp
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked
2026-02-03 10:56 ` Matthieu Baerts
@ 2026-02-03 11:13 ` Matthieu Baerts
2026-02-03 11:14 ` Matthieu Baerts
0 siblings, 1 reply; 13+ messages in thread
From: Matthieu Baerts @ 2026-02-03 11:13 UTC (permalink / raw)
To: Geliang Tang, Mat Martineau, Paolo Abeni; +Cc: Gang Yan, mptcp
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked
2026-02-03 11:13 ` Matthieu Baerts
@ 2026-02-03 11:14 ` Matthieu Baerts
0 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2026-02-03 11:14 UTC (permalink / raw)
To: Geliang Tang, Mat Martineau, Paolo Abeni; +Cc: Gang Yan, mptcp
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked
2026-01-04 5:29 ` [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked Geliang Tang
2026-02-03 6:54 ` Geliang Tang
@ 2026-02-04 11:56 ` Matthieu Baerts
2026-02-05 9:46 ` Geliang Tang
1 sibling, 1 reply; 13+ messages in thread
From: Matthieu Baerts @ 2026-02-04 11:56 UTC (permalink / raw)
To: Geliang Tang, Paolo Abeni; +Cc: Geliang Tang, Gang Yan, mptcp
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked
2026-02-04 11:56 ` Matthieu Baerts
@ 2026-02-05 9:46 ` Geliang Tang
0 siblings, 0 replies; 13+ messages in thread
From: Geliang Tang @ 2026-02-05 9:46 UTC (permalink / raw)
To: Matthieu Baerts, Paolo Abeni; +Cc: Geliang Tang, Gang Yan, mptcp
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH mptcp-next v2 3/3] selftests/bpf: Update sockmap tests for MPTCP
2026-01-04 5:29 [PATCH mptcp-next v2 0/3] implement psock_update_sk_prot Geliang Tang
2026-01-04 5:29 ` [PATCH mptcp-next v2 1/3] mptcp: " Geliang Tang
2026-01-04 5:29 ` [PATCH mptcp-next v2 2/3] mptcp: allow overridden write_space to be invoked Geliang Tang
@ 2026-01-04 5:29 ` Geliang Tang
2026-01-04 6:38 ` [PATCH mptcp-next v2 0/3] implement psock_update_sk_prot MPTCP CI
3 siblings, 0 replies; 13+ messages in thread
From: Geliang Tang @ 2026-01-04 5:29 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
From: Geliang Tang <tanggeliang@kylinos.cn>
Update sockmap tests to reflect new MPTCP support. MPTCP sockets are now
allowed in sockmap, so test expectations are adjusted accordingly.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
tools/testing/selftests/bpf/prog_tests/mptcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 7f48fd9e94e1..217ecc59c8a2 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -570,13 +570,13 @@ static void test_sockmap_reject_mptcp(struct mptcp_sockmap *skel)
server_fd = accept(listen_fd, NULL, 0);
err = bpf_map_update_elem(bpf_map__fd(skel->maps.sock_map),
&zero, &server_fd, BPF_NOEXIST);
- if (!ASSERT_EQ(err, -EOPNOTSUPP, "server should be disallowed"))
+ if (!ASSERT_EQ(err, 0, "server should be allowed"))
goto end;
/* MPTCP client should also be disallowed */
err = bpf_map_update_elem(bpf_map__fd(skel->maps.sock_map),
&zero, &client_fd1, BPF_NOEXIST);
- if (!ASSERT_EQ(err, -EOPNOTSUPP, "client should be disallowed"))
+ if (!ASSERT_EQ(err, -EEXIST, "client should be allowed"))
goto end;
end:
if (client_fd1 >= 0)
--
2.51.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH mptcp-next v2 0/3] implement psock_update_sk_prot
2026-01-04 5:29 [PATCH mptcp-next v2 0/3] implement psock_update_sk_prot Geliang Tang
` (2 preceding siblings ...)
2026-01-04 5:29 ` [PATCH mptcp-next v2 3/3] selftests/bpf: Update sockmap tests for MPTCP Geliang Tang
@ 2026-01-04 6:38 ` MPTCP CI
3 siblings, 0 replies; 13+ messages in thread
From: MPTCP CI @ 2026-01-04 6:38 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/20688424112
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/6ca2d68f2a7c
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1038151
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normal
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
^ permalink raw reply [flat|nested] 13+ messages in thread