All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Geliang Tang <geliangtang@gmail.com>, mptcp@lists.linux.dev
Cc: Geliang Tang <geliangtang@xiaomi.com>
Subject: Re: [MPTCP][PATCH v6 mptcp-next 1/5] mptcp: MP_FAIL suboption sending
Date: Wed, 28 Jul 2021 12:31:21 +0200	[thread overview]
Message-ID: <8acb4b9a8d6a7032cc64260e86b95ed1e33b1f2b.camel@redhat.com> (raw)
In-Reply-To: <277ac1e6d1fde4c180eba3f1bb1846ea58679915.1627464017.git.geliangtang@xiaomi.com>

Hello,

On Wed, 2021-07-28 at 17:35 +0800, Geliang Tang wrote:
> From: Geliang Tang <geliangtang@xiaomi.com>
> 
> This patch added the MP_FAIL suboption sending support.
> 
> Add a new flag named send_mp_fail in struct mptcp_subflow_context. If
> this flag is set, send out MP_FAIL suboption.
> 
> Add a new member fail_seq in struct mptcp_out_options to save the data
> sequence number to put into the MP_FAIL suboption.
> 
> An MP_FAIL option could be included in a RST or on the subflow-level
> ACK.
> 
> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
> ---
>  include/net/mptcp.h  |  5 +++-
>  net/mptcp/options.c  | 61 +++++++++++++++++++++++++++++++++++++++++---
>  net/mptcp/protocol.h |  3 +++
>  3 files changed, 64 insertions(+), 5 deletions(-)
> 
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index 3236010afa29..6026bbefbffd 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -74,7 +74,10 @@ struct mptcp_out_options {
>  			struct mptcp_addr_info addr;
>  			u64 ahmac;
>  		};
> -		struct mptcp_ext ext_copy;
> +		struct {
> +			struct mptcp_ext ext_copy;
> +			u64 fail_seq;
> +		};
>  		struct {
>  			u32 nonce;
>  			u32 token;
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 753d6ac43bff..2b15063c8009 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -763,7 +763,7 @@ static bool mptcp_established_options_mp_prio(struct sock *sk,
>  	return true;
>  }
>  
> -static noinline void mptcp_established_options_rst(struct sock *sk, struct sk_buff *skb,
> +static noinline bool mptcp_established_options_rst(struct sock *sk, struct sk_buff *skb,
>  						   unsigned int *size,
>  						   unsigned int remaining,
>  						   struct mptcp_out_options *opts)
> @@ -771,12 +771,36 @@ static noinline void mptcp_established_options_rst(struct sock *sk, struct sk_bu
>  	const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
>  
>  	if (remaining < TCPOLEN_MPTCP_RST)
> -		return;
> +		return false;
>  
>  	*size = TCPOLEN_MPTCP_RST;
>  	opts->suboptions |= OPTION_MPTCP_RST;
>  	opts->reset_transient = subflow->reset_transient;
>  	opts->reset_reason = subflow->reset_reason;
> +
> +	return true;
> +}
> +
> +static bool mptcp_established_options_mp_fail(struct sock *sk,
> +					      unsigned int *size,
> +					      unsigned int remaining,
> +					      struct mptcp_out_options *opts)
> +{
> +	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
> +
> +	if (!subflow->send_mp_fail)
> +		return false;
> +
> +	if (remaining < TCPOLEN_MPTCP_FAIL)
> +		return false;
> +
> +	*size = TCPOLEN_MPTCP_FAIL;
> +	opts->suboptions |= OPTION_MPTCP_FAIL;
> +	opts->fail_seq = subflow->map_seq;
> +
> +	pr_debug("MP_FAIL fail_seq=%llu", opts->fail_seq);
> +
> +	return true;
>  }
>  
>  bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
> @@ -795,15 +819,30 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
>  		return false;
>  
>  	if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) {
> -		mptcp_established_options_rst(sk, skb, size, remaining, opts);
> +		if (mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) {
> +			*size += opt_size;
> +			remaining -= opt_size;
> +		}
> +		if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) {
> +			*size += opt_size;
> +			remaining -= opt_size;
> +		}
>  		return true;
>  	}
>  
>  	snd_data_fin = mptcp_data_fin_enabled(msk);
>  	if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, remaining, opts))
>  		ret = true;
> -	else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, remaining, opts))
> +	else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, remaining, opts)) {
>  		ret = true;
> +		if (opts->ext_copy.use_ack) {

I *think* we could drop this check as the RFC says:

"""
   it will send back an MP_FAIL option on
   the subflow-level ACK,
"""

And to me subflow-level ACK really means TCP ack, that is any packet on
a TCP-established subflow will do.

Anyhow I think we can adjust the above with a squash-to patch after
this series is merged, as it already went through several iterations
and overall it LGTM.

While at that a few 'unlikely()' annotation will help ;)

/P


  parent reply	other threads:[~2021-07-28 10:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  9:35 [MPTCP][PATCH v6 mptcp-next 0/5] MP_FAIL support Geliang Tang
2021-07-28  9:35 ` [MPTCP][PATCH v6 mptcp-next 1/5] mptcp: MP_FAIL suboption sending Geliang Tang
2021-07-28  9:35   ` [MPTCP][PATCH v6 mptcp-next 2/5] mptcp: MP_FAIL suboption receiving Geliang Tang
2021-07-28  9:35     ` [MPTCP][PATCH v6 mptcp-next 3/5] mptcp: send out MP_FAIL when data checksum fails Geliang Tang
2021-07-28  9:35       ` [MPTCP][PATCH v6 mptcp-next 4/5] mptcp: add the mibs for MP_FAIL Geliang Tang
2021-07-28  9:35         ` [MPTCP][PATCH v6 mptcp-next 5/5] selftests: mptcp: add MP_FAIL mibs check Geliang Tang
2021-07-28 23:31       ` [MPTCP][PATCH v6 mptcp-next 3/5] mptcp: send out MP_FAIL when data checksum fails Mat Martineau
2021-07-28 10:36     ` [MPTCP][PATCH v6 mptcp-next 2/5] mptcp: MP_FAIL suboption receiving Paolo Abeni
2021-08-12  7:09       ` Geliang Tang
2021-07-28 10:31   ` Paolo Abeni [this message]
2021-07-28 10:37 ` [MPTCP][PATCH v6 mptcp-next 0/5] MP_FAIL support Paolo Abeni

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=8acb4b9a8d6a7032cc64260e86b95ed1e33b1f2b.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=geliangtang@gmail.com \
    --cc=geliangtang@xiaomi.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 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.