All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geliang Tang <geliang@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>, mptcp@lists.linux.dev
Subject: Re: [MPTCP next v3 09/12] mptcp: cleanup fallback dummy mapping generation.
Date: Sun, 21 Sep 2025 09:01:26 +0800	[thread overview]
Message-ID: <71ec0d4b89140d421e953d1ca03009f960fd9de8.camel@kernel.org> (raw)
In-Reply-To: <4d3650ef680da6d172bf69223bda3dea2bb4a71c.camel@kernel.org>

On Sat, 2025-09-20 at 08:06 +0800, Geliang Tang wrote:
> On Fri, 2025-09-19 at 17:53 +0200, Paolo Abeni wrote:
> > MPTCP currently access ack_seq outside the msk socket log scope to
> > generate the dummy mapping for fallback socket. Soon we are going
> > to introduce backlog usage and even for fallback socket the ack_seq
> > value will be significantly off outside of the msk socket lock
> > scope.
> > 
> > Avoid relying on ack_seq for dummy mapping generation, using
> > instead
> > the subflow sequence number. Note that in case of disconnect() and
> > (re)connect() we must ensure that any previous state is re-set.
> > 
> > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> > ---
> > v2 -> v3:
> >  - reordered before the backlog introduction to avoid transiently
> >    break the fallback
> >  - explicitly reset ack_seq
> > ---
> >  net/mptcp/protocol.c | 3 +++
> >  net/mptcp/subflow.c  | 8 +++++++-
> >  2 files changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> > index fce70cdad2a7f..c8b02048126a9 100644
> > --- a/net/mptcp/protocol.c
> > +++ b/net/mptcp/protocol.c
> > @@ -3224,6 +3224,9 @@ static int mptcp_disconnect(struct sock *sk,
> > int flags)
> >  	msk->bytes_retrans = 0;
> >  	msk->rcvspace_init = 0;
> >  
> > +	/* for fallback's sake */
> > +	WRITE_ONCE(msk->ack_seq, 0);
> > +
> >  	WRITE_ONCE(sk->sk_shutdown, 0);
> >  	sk_error_report(sk);
> >  	return 0;
> > diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> > index b9455c04e8a46..ac8616e7521e8 100644
> > --- a/net/mptcp/subflow.c
> > +++ b/net/mptcp/subflow.c
> > @@ -491,6 +491,9 @@ static void subflow_set_remote_key(struct
> > mptcp_sock *msk,
> >  	mptcp_crypto_key_sha(subflow->remote_key, NULL, &subflow-
> > > iasn);
> >  	subflow->iasn++;
> >  
> > +	/* for fallback's sake */
> > +	subflow->map_seq = subflow->iasn;
> > +
> >  	WRITE_ONCE(msk->remote_key, subflow->remote_key);
> >  	WRITE_ONCE(msk->ack_seq, subflow->iasn);
> >  	WRITE_ONCE(msk->can_ack, true);
> > @@ -1435,9 +1438,12 @@ static bool subflow_check_data_avail(struct
> > sock *ssk)
> >  
> >  	skb = skb_peek(&ssk->sk_receive_queue);
> >  	subflow->map_valid = 1;
> > -	subflow->map_seq = READ_ONCE(msk->ack_seq);
> 
> nit:
> 
> How about replacing this line in place? I mean, do not move it to a
> later position:
> 
> +	subflow->map_seq = __mptcp_expand_seq(subflow->map_seq,
> +					      subflow->iasn +
> +					      TCP_SKB_CB(skb)->seq -
> +					      subflow->ssn_offset -
> 1);
> 
> Reviewed-by: Geliang Tang <geliang@kernel.org>
> Tested-by: Geliang Tang <geliang@kernel.org>

Please delete the sentence in the subject of this patch too.

Thanks,
-Geliang

> 
> Thanks,
> -Geliang
> 
> >  	subflow->map_data_len = skb->len;
> >  	subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq -
> > subflow->ssn_offset;
> > +	subflow->map_seq = __mptcp_expand_seq(subflow->map_seq,
> > +					      subflow->iasn +
> > +					      TCP_SKB_CB(skb)->seq
> > -
> > +					      subflow->ssn_offset
> > -
> > 1);
> >  	WRITE_ONCE(subflow->data_avail, true);
> >  	return true;
> >  }

  reply	other threads:[~2025-09-21  1:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 15:53 [MPTCP next v3 00/12] mptcp: receive path improvement Paolo Abeni
2025-09-19 15:53 ` [MPTCP next v3 01/12] mptcp: leverage skb deferral free Paolo Abeni
2025-09-19 15:53 ` [MPTCP next v3 02/12] tcp: make tcp_rcvbuf_grow() accessible to mptcp code Paolo Abeni
2025-09-19 15:53 ` [MPTCP next v3 03/12] mptcp: rcvbuf auto-tuning improvement Paolo Abeni
2025-09-19 21:10   ` Matthieu Baerts
2025-09-19 15:53 ` [MPTCP next v3 04/12] mptcp: introduce the mptcp_init_skb helper Paolo Abeni
2025-09-20  0:01   ` Geliang Tang
2025-09-22 10:44     ` Paolo Abeni
2025-09-20  0:03   ` Geliang Tang
2025-09-21  0:23     ` Geliang Tang
2025-09-21  0:48       ` Geliang Tang
2025-09-19 15:53 ` [MPTCP next v3 05/12] mptcp: remove unneeded mptcp_move_skb() Paolo Abeni
2025-09-19 15:53 ` [MPTCP next v3 06/12] mptcp: factor out a basic skb coalesce helper Paolo Abeni
2025-09-19 15:53 ` [MPTCP next v3 07/12] mptcp: minor move_skbs_to_msk() cleanup Paolo Abeni
2025-09-19 15:53 ` [MPTCP next v3 08/12] mptcp: cleanup fallback data fin reception Paolo Abeni
2025-09-20  0:04   ` Geliang Tang
2025-09-19 15:53 ` [MPTCP next v3 09/12] mptcp: cleanup fallback dummy mapping generation Paolo Abeni
2025-09-20  0:06   ` Geliang Tang
2025-09-21  1:01     ` Geliang Tang [this message]
2025-09-19 15:53 ` [MPTCP next v3 10/12] mptcp: leverage the sk backlog for RX packet processing Paolo Abeni
2025-09-20  0:09   ` Geliang Tang
2025-09-21  0:27     ` Geliang Tang
2025-09-19 15:53 ` [MPTCP next v3 11/12] mptcp: prevernt __mptcp_move_skbs() interfering with the fastpath Paolo Abeni
2025-09-21  0:27   ` Geliang Tang
2025-09-19 15:53 ` [MPTCP next v3 12/12] mptcp: borrow forward memory from subflow Paolo Abeni
2025-09-21  0:28   ` Geliang Tang
2025-09-19 18:36 ` [MPTCP next v3 00/12] mptcp: receive path improvement MPTCP CI
2025-09-19 21:13 ` Matthieu Baerts
2025-09-20  4:13   ` Geliang Tang
2025-09-20  4:15   ` Geliang Tang
2025-09-23 16:15   ` 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=71ec0d4b89140d421e953d1ca03009f960fd9de8.camel@kernel.org \
    --to=geliang@kernel.org \
    --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.