* [PATCH net 0/7] mptcp: fix inconsistent backup usage
@ 2024-07-27 10:01 Matthieu Baerts (NGI0)
2024-07-27 10:01 ` [PATCH net 1/7] mptcp: sched: check both directions for backup Matthieu Baerts (NGI0)
2024-07-30 8:50 ` [PATCH net 0/7] mptcp: fix inconsistent backup usage patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Matthieu Baerts (NGI0) @ 2024-07-27 10:01 UTC (permalink / raw)
To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Florian Westphal, Shuah Khan
Cc: netdev, linux-kernel, linux-kselftest, Matthieu Baerts (NGI0),
stable, Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
linux-trace-kernel
In all the MPTCP backup related tests, the backup flag was set on one
side, and the expected behaviour is to have both sides respecting this
decision. That's also the "natural" way, and what the users seem to
expect.
On the scheduler side, only the 'backup' field was checked, which is
supposed to be set only if the other peer flagged a subflow as backup.
But in various places, this flag was also set when the local host
flagged the subflow as backup, certainly to have the expected behaviour
mentioned above.
Patch 1 modifies the packet scheduler to check if the backup flag has
been set on both directions, not to change its behaviour after having
applied the following patches. That's what the default packet scheduler
should have done since the beginning in v5.7.
Patch 2 fixes the backup flag being mirrored on the MPJ+SYN+ACK by
accident since its introduction in v5.7. Instead, the received and sent
backup flags are properly distinguished in requests.
Patch 3 stops setting the received backup flag as well when sending an
MP_PRIO, something that was done since the MP_PRIO support in v5.12.
Patch 4 adds related and missing MIB counters to be able to easily check
if MP_JOIN are sent with a backup flag. Certainly because these counters
were not there, the behaviour that is fixed by patches here was not
properly verified.
Patch 5 validates the previous patch by extending the MPTCP Join
selftest.
Patch 6 fixes the backup support in signal endpoints: if a signal
endpoint had the backup flag, it was not set in the MPJ+SYN+ACK as
expected. It was only set for ongoing connections, but not future ones
as expected, since the introduction of the backup flag in endpoints in
v5.10.
Patch 7 validates the previous patch by extending the MPTCP Join
selftest as well.
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Matthieu Baerts (NGI0) (7):
mptcp: sched: check both directions for backup
mptcp: distinguish rcv vs sent backup flag in requests
mptcp: pm: only set request_bkup flag when sending MP_PRIO
mptcp: mib: count MPJ with backup flag
selftests: mptcp: join: validate backup in MPJ
mptcp: pm: fix backup support in signal endpoints
selftests: mptcp: join: check backup support in signal endp
include/trace/events/mptcp.h | 2 +-
net/mptcp/mib.c | 2 +
net/mptcp/mib.h | 2 +
net/mptcp/options.c | 2 +-
net/mptcp/pm.c | 12 +++++
net/mptcp/pm_netlink.c | 19 ++++++-
net/mptcp/pm_userspace.c | 18 +++++++
net/mptcp/protocol.c | 10 ++--
net/mptcp/protocol.h | 4 ++
net/mptcp/subflow.c | 10 ++++
tools/testing/selftests/net/mptcp/mptcp_join.sh | 72 ++++++++++++++++++++-----
11 files changed, 132 insertions(+), 21 deletions(-)
---
base-commit: 301927d2d2eb8e541357ba850bc7a1a74dbbd670
change-id: 20240727-upstream-net-20240727-mptcp-backup-signal-948235f2ad08
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH net 1/7] mptcp: sched: check both directions for backup
2024-07-27 10:01 [PATCH net 0/7] mptcp: fix inconsistent backup usage Matthieu Baerts (NGI0)
@ 2024-07-27 10:01 ` Matthieu Baerts (NGI0)
2024-07-30 8:50 ` [PATCH net 0/7] mptcp: fix inconsistent backup usage patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Matthieu Baerts (NGI0) @ 2024-07-27 10:01 UTC (permalink / raw)
To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Florian Westphal, Shuah Khan
Cc: netdev, linux-kernel, linux-kselftest, Matthieu Baerts (NGI0),
stable, Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
linux-trace-kernel
The 'mptcp_subflow_context' structure has two items related to the
backup flags:
- 'backup': the subflow has been marked as backup by the other peer
- 'request_bkup': the backup flag has been set by the host
Before this patch, the scheduler was only looking at the 'backup' flag.
That can make sense in some cases, but it looks like that's not what we
wanted for the general use, because either the path-manager was setting
both of them when sending an MP_PRIO, or the receiver was duplicating
the 'backup' flag in the subflow request.
Note that the use of these two flags in the path-manager are going to be
fixed in the next commits, but this change here is needed not to modify
the behaviour.
Fixes: f296234c98a8 ("mptcp: Add handling of incoming MP_JOIN requests")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
To: Steven Rostedt <rostedt@goodmis.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: linux-trace-kernel@vger.kernel.org
---
include/trace/events/mptcp.h | 2 +-
net/mptcp/protocol.c | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/trace/events/mptcp.h b/include/trace/events/mptcp.h
index 09e72215b9f9..085b749cdd97 100644
--- a/include/trace/events/mptcp.h
+++ b/include/trace/events/mptcp.h
@@ -34,7 +34,7 @@ TRACE_EVENT(mptcp_subflow_get_send,
struct sock *ssk;
__entry->active = mptcp_subflow_active(subflow);
- __entry->backup = subflow->backup;
+ __entry->backup = subflow->backup || subflow->request_bkup;
if (subflow->tcp_sock && sk_fullsock(subflow->tcp_sock))
__entry->free = sk_stream_memory_free(subflow->tcp_sock);
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index a26c2c840fd9..a2fc54ed68c0 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1422,13 +1422,15 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
}
mptcp_for_each_subflow(msk, subflow) {
+ bool backup = subflow->backup || subflow->request_bkup;
+
trace_mptcp_subflow_get_send(subflow);
ssk = mptcp_subflow_tcp_sock(subflow);
if (!mptcp_subflow_active(subflow))
continue;
tout = max(tout, mptcp_timeout_from_subflow(subflow));
- nr_active += !subflow->backup;
+ nr_active += !backup;
pace = subflow->avg_pacing_rate;
if (unlikely(!pace)) {
/* init pacing rate from socket */
@@ -1439,9 +1441,9 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
}
linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace);
- if (linger_time < send_info[subflow->backup].linger_time) {
- send_info[subflow->backup].ssk = ssk;
- send_info[subflow->backup].linger_time = linger_time;
+ if (linger_time < send_info[backup].linger_time) {
+ send_info[backup].ssk = ssk;
+ send_info[backup].linger_time = linger_time;
}
}
__mptcp_set_timeout(sk, tout);
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net 0/7] mptcp: fix inconsistent backup usage
2024-07-27 10:01 [PATCH net 0/7] mptcp: fix inconsistent backup usage Matthieu Baerts (NGI0)
2024-07-27 10:01 ` [PATCH net 1/7] mptcp: sched: check both directions for backup Matthieu Baerts (NGI0)
@ 2024-07-30 8:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-30 8:50 UTC (permalink / raw)
To: Matthieu Baerts
Cc: mptcp, martineau, geliang, davem, edumazet, kuba, pabeni, fw,
shuah, netdev, linux-kernel, linux-kselftest, stable, rostedt,
mhiramat, mathieu.desnoyers, linux-trace-kernel
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Sat, 27 Jul 2024 12:01:22 +0200 you wrote:
> In all the MPTCP backup related tests, the backup flag was set on one
> side, and the expected behaviour is to have both sides respecting this
> decision. That's also the "natural" way, and what the users seem to
> expect.
>
> On the scheduler side, only the 'backup' field was checked, which is
> supposed to be set only if the other peer flagged a subflow as backup.
> But in various places, this flag was also set when the local host
> flagged the subflow as backup, certainly to have the expected behaviour
> mentioned above.
>
> [...]
Here is the summary with links:
- [net,1/7] mptcp: sched: check both directions for backup
https://git.kernel.org/netdev/net/c/b6a66e521a20
- [net,2/7] mptcp: distinguish rcv vs sent backup flag in requests
https://git.kernel.org/netdev/net/c/efd340bf3d77
- [net,3/7] mptcp: pm: only set request_bkup flag when sending MP_PRIO
https://git.kernel.org/netdev/net/c/4258b94831bb
- [net,4/7] mptcp: mib: count MPJ with backup flag
https://git.kernel.org/netdev/net/c/4dde0d72ccec
- [net,5/7] selftests: mptcp: join: validate backup in MPJ
https://git.kernel.org/netdev/net/c/935ff5bb8a1c
- [net,6/7] mptcp: pm: fix backup support in signal endpoints
https://git.kernel.org/netdev/net/c/6834097fc38c
- [net,7/7] selftests: mptcp: join: check backup support in signal endp
https://git.kernel.org/netdev/net/c/f833470c2783
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-30 8:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-27 10:01 [PATCH net 0/7] mptcp: fix inconsistent backup usage Matthieu Baerts (NGI0)
2024-07-27 10:01 ` [PATCH net 1/7] mptcp: sched: check both directions for backup Matthieu Baerts (NGI0)
2024-07-30 8:50 ` [PATCH net 0/7] mptcp: fix inconsistent backup usage patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).