mptcp.lists.linux.dev archive mirror
 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 2/5] mptcp: MP_FAIL suboption receiving
Date: Wed, 28 Jul 2021 12:36:00 +0200	[thread overview]
Message-ID: <eb3602e3f2a3550e9c1c27e2b5e3428562ac1010.camel@redhat.com> (raw)
In-Reply-To: <a39b8f2a49c2798d4ff80ed527cd8990e64f8def.1627464017.git.geliangtang@xiaomi.com>

On Wed, 2021-07-28 at 17:35 +0800, Geliang Tang wrote:
> From: Geliang Tang <geliangtang@xiaomi.com>
> 
> This patch added handling for receiving MP_FAIL suboption.
> 
> Add a new members mp_fail and fail_seq in struct mptcp_options_received.
> When MP_FAIL suboption is received, set mp_fail to 1 and save the sequence
> number to fail_seq.
> 
> Then invoke mptcp_pm_mp_fail_received to deal with the MP_FAIL suboption.
> 
> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
> ---
>  net/mptcp/options.c  | 16 ++++++++++++++++
>  net/mptcp/pm.c       |  5 +++++
>  net/mptcp/protocol.h |  3 +++
>  3 files changed, 24 insertions(+)
> 
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 2b15063c8009..cd9ec4acf127 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -336,6 +336,16 @@ static void mptcp_parse_option(const struct sk_buff *skb,
>  		mp_opt->reset_reason = *ptr;
>  		break;
>  
> +	case MPTCPOPT_MP_FAIL:
> +		if (opsize != TCPOLEN_MPTCP_FAIL)
> +			break;
> +
> +		ptr += 2;
> +		mp_opt->mp_fail = 1;
> +		mp_opt->fail_seq = get_unaligned_be64(ptr);
> +		pr_debug("MP_FAIL: data_seq=%llu", mp_opt->fail_seq);
> +		break;
> +
>  	default:
>  		break;
>  	}
> @@ -364,6 +374,7 @@ void mptcp_get_options(const struct sock *sk,
>  	mp_opt->reset = 0;
>  	mp_opt->csum_reqd = READ_ONCE(msk->csum_enabled);
>  	mp_opt->deny_join_id0 = 0;
> +	mp_opt->mp_fail = 0;
>  
>  	length = (th->doff * 4) - sizeof(struct tcphdr);
>  	ptr = (const unsigned char *)(th + 1);
> @@ -1147,6 +1158,11 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
>  		mp_opt.mp_prio = 0;
>  	}
>  
> +	if (mp_opt.mp_fail) {
> +		mptcp_pm_mp_fail_received(sk, mp_opt.fail_seq);
> +		mp_opt.mp_fail = 0;
> +	}
> +

Side note not specifically related to this patch: usually we get a
single MPTCP subopt per packet: a DSS. So we could optimize this code
path with something alike:

	if (unlikely(any subopt other than dss is present))
		// go checking all of them individually

To do the above we likely need to wrap all the 'mp_capable',
'fastclose', 'rm_addr' flags in a single bitmask. e.v. using a union.

/P


  parent reply	other threads:[~2021-07-28 10:36 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     ` Paolo Abeni [this message]
2021-08-12  7:09       ` [MPTCP][PATCH v6 mptcp-next 2/5] mptcp: MP_FAIL suboption receiving Geliang Tang
2021-07-28 10:31   ` [MPTCP][PATCH v6 mptcp-next 1/5] mptcp: MP_FAIL suboption sending Paolo Abeni
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=eb3602e3f2a3550e9c1c27e2b5e3428562ac1010.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 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).