All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next 2/3] mptcp: reset the packet scheduler on incoming MP_PRIO.
Date: Mon, 21 Mar 2022 17:21:49 -0700 (PDT)	[thread overview]
Message-ID: <8e593068-fb24-252-6980-19aa9c4fe577@linux.intel.com> (raw)
In-Reply-To: <4982f05aedd915cdc486399696d8c5b492fd2d9a.1647601548.git.pabeni@redhat.com>

On Fri, 18 Mar 2022, Paolo Abeni wrote:

> When an incoming MP_PRIO option changes the backup
> status of any subflow, we need to reset the packet
> scheduler status, or the next send could keep using
> the previously selected subflow, without taking in account
> the new priorities.
>
> Reported-by: Davide Caratti <dcaratti@redhat.com>
> Fixes: 40453a5c61f4 ("mptcp: add the incoming MP_PRIO support")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> net/mptcp/pm.c       | 19 +++++++++++++++----
> net/mptcp/protocol.c |  2 ++
> net/mptcp/protocol.h |  1 +
> 3 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index d0d31d5c198a..2f6ee422c6df 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -262,14 +262,25 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,
> 	spin_unlock_bh(&pm->lock);
> }
>
> -void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup)
> +void mptcp_pm_mp_prio_received(struct sock *ssk, u8 bkup)
> {
> -	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
> +	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
> +	struct sock *sk = subflow->conn;
> +	struct mptcp_sock *msk;
>
> 	pr_debug("subflow->backup=%d, bkup=%d\n", subflow->backup, bkup);
> -	subflow->backup = bkup;
> +	msk = mptcp_sk(sk);
> +	if (subflow->backup == bkup) {

Above should be "if (subflow->backup != bkup)"?

> +		subflow->backup = bkup;
> +		mptcp_data_lock(sk);
> +		if (!sock_owned_by_user(sk))
> +			msk->last_snd = NULL;
> +		else
> +			__set_bit(MPTCP_RESET_SCHEDULER,  &msk->cb_flags);
> +		mptcp_data_unlock(sk);
> +	}
>
> -	mptcp_event(MPTCP_EVENT_SUB_PRIORITY, mptcp_sk(subflow->conn), sk, GFP_ATOMIC);
> +	mptcp_event(MPTCP_EVENT_SUB_PRIORITY, msk, ssk, GFP_ATOMIC);
> }
>
> void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index bdba1ddee2a7..cec42bc16d12 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -3128,6 +3128,8 @@ static void mptcp_release_cb(struct sock *sk)
> 			__mptcp_set_connected(sk);
> 		if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags))
> 			__mptcp_error_report(sk);
> +		if (__test_and_clear_bit(MPTCP_RESET_SCHEDULER, &msk->cb_flags))
> +			msk->last_snd = NULL;
> 	}
>
> 	__mptcp_update_rmem(sk);
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index c8bada4537e2..d59c16d248a4 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -124,6 +124,7 @@
> #define MPTCP_RETRANSMIT	4
> #define MPTCP_FLUSH_JOIN_LIST	5
> #define MPTCP_CONNECTED		6
> +#define MPTCP_RESET_SCHEDULER	7
>
> static inline bool before64(__u64 seq1, __u64 seq2)
> {
> -- 
> 2.35.1



--
Mat Martineau
Intel

  reply	other threads:[~2022-03-22  0:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 11:06 [PATCH mptcp-next 1/3] mptcp: optimize release_cb for the common case Paolo Abeni
2022-03-18 11:06 ` [PATCH mptcp-next 2/3] mptcp: reset the packet scheduler on incoming MP_PRIO Paolo Abeni
2022-03-22  0:21   ` Mat Martineau [this message]
2022-03-22 14:46     ` Paolo Abeni
2022-03-18 11:06 ` [PATCH mptcp-next 3/3] mptcp: reset the packet scheduler on PRIO change Paolo Abeni
2022-03-22  0:22   ` Mat Martineau
2022-03-22  0:22 ` [PATCH mptcp-next 1/3] mptcp: optimize release_cb for the common case Mat Martineau

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=8e593068-fb24-252-6980-19aa9c4fe577@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.