From: Paolo Abeni <pabeni@redhat.com>
To: Geliang Tang <geliang.tang@suse.com>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v3] mptcp: refactor MP_FAIL response
Date: Wed, 08 Jun 2022 18:51:14 +0200 [thread overview]
Message-ID: <ed3e810dacb60c72ad1cf9ab73284a7623d12ba6.camel@redhat.com> (raw)
In-Reply-To: <527414fccf0c041908900aadb2f043134a0ec09c.1654694739.git.geliang.tang@suse.com>
On Wed, 2022-06-08 at 21:26 +0800, Geliang Tang wrote:
> This patch refactors the MP_FAIL response logic.
>
> Add fail_sock in struct mptcp_sock to record the MP_FAIL subflow. Add
> fail_timeout in mptcp_sock to record the MP_FAIL timestamp. Check them
> in mptcp_mp_fail_no_response() to reset the subflow when MP_FAIL response
> timeout occurs.
>
> Drop mp_fail_response_expect flag in struct mptcp_subflow_context and
> the code to reuse sk_timer.
>
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/281
> Fixes: d9fb797046c5 ("mptcp: Do not traverse the subflow connection list without lock")
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> v3:
> - update as Paolo suggested.
> ---
> net/mptcp/pm.c | 7 ++-----
> net/mptcp/protocol.c | 26 ++++++--------------------
> net/mptcp/protocol.h | 3 ++-
> net/mptcp/subflow.c | 12 +++---------
> 4 files changed, 13 insertions(+), 35 deletions(-)
>
> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index 59a85220edc9..c780e5d11b89 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -299,23 +299,20 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
> {
> struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
> struct mptcp_sock *msk = mptcp_sk(subflow->conn);
> - struct sock *s = (struct sock *)msk;
>
> pr_debug("fail_seq=%llu", fail_seq);
>
> if (!READ_ONCE(msk->allow_infinite_fallback))
> return;
>
> - if (!READ_ONCE(subflow->mp_fail_response_expect)) {
> + if (!msk->fail_sock) {
> pr_debug("send MP_FAIL response and infinite map");
>
> subflow->send_mp_fail = 1;
> MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
> subflow->send_infinite_map = 1;
> - } else if (!sock_flag(sk, SOCK_DEAD)) {
> + } else {
> pr_debug("MP_FAIL response received");
> -
> - sk_stop_timer(s, &s->sk_timer);
> }
> }
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index d6aef4b13b8a..9ffc96ddce01 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2167,21 +2167,6 @@ static void mptcp_retransmit_timer(struct timer_list *t)
> sock_put(sk);
> }
>
> -static struct mptcp_subflow_context *
> -mp_fail_response_expect_subflow(struct mptcp_sock *msk)
> -{
> - struct mptcp_subflow_context *subflow, *ret = NULL;
> -
> - mptcp_for_each_subflow(msk, subflow) {
> - if (READ_ONCE(subflow->mp_fail_response_expect)) {
> - ret = subflow;
> - break;
> - }
> - }
> -
> - return ret;
> -}
> -
> static void mptcp_timeout_timer(struct timer_list *t)
> {
> struct sock *sk = from_timer(sk, t, sk_timer);
> @@ -2507,18 +2492,17 @@ static void __mptcp_retrans(struct sock *sk)
>
> static void mptcp_mp_fail_no_response(struct mptcp_sock *msk)
> {
> - struct mptcp_subflow_context *subflow;
> - struct sock *ssk;
> + struct sock *ssk = msk->fail_sock;
> bool slow;
>
> - subflow = mp_fail_response_expect_subflow(msk);
> - if (subflow) {
> + if (ssk && time_after(jiffies, msk->fail_timeout)) {
The patch LGTM, thanks!
Acked-by: Paolo Abeni <pabeni@redhat.com>
As minor nits I *think* that 'fail_sock' could be renamed to
'fail_ssk', for consistency (a 'sock' is usally a 'struct socket') and
I *think* that the above msk->fail_sock/msk->fail_ssk check could be
moved into mptcp_worker() function to make it clear that the
fail_no_response thing is not unconditional.
As said, minor things, could be handled with a squash-to patch, if
there is agreement on them.
Cheers,
Paolo
prev parent reply other threads:[~2022-06-08 16:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 13:26 [PATCH mptcp-next v3] mptcp: refactor MP_FAIL response Geliang Tang
2022-06-08 14:36 ` mptcp: refactor MP_FAIL response: Tests Results MPTCP CI
2022-06-08 16:51 ` Paolo Abeni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ed3e810dacb60c72ad1cf9ab73284a7623d12ba6.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=geliang.tang@suse.com \
--cc=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox