From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Geliang Tang <geliangtang@gmail.com>
Cc: mptcp@lists.linux.dev, Geliang Tang <geliangtang@xiaomi.com>
Subject: Re: [PATCH mptcp-next 1/6] mptcp: add noncontiguous flag
Date: Wed, 8 Sep 2021 16:39:21 -0700 (PDT) [thread overview]
Message-ID: <75aea2-c940-53aa-cc75-644ff532b73b@linux.intel.com> (raw)
In-Reply-To: <fed5c608544799a51138d6fb56871811e3ad71ab.1630914699.git.geliangtang@xiaomi.com>
On Mon, 6 Sep 2021, Geliang Tang wrote:
> From: Geliang Tang <geliangtang@xiaomi.com>
>
> This patch added a "noncontiguous" flag in the msk to track whether the
> data is contiguous on a subflow. When retransmission happens, we could
> set this flag, and once all retransmissions are DATA_ACK'd that flag
> could be cleared.
>
> When a bad checksum is detected and a single contiguous subflow is in
> use, don't send RST + MP_FAIL, send data_ack + MP_FAIL instead.
>
> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
> ---
> net/mptcp/protocol.c | 13 ++++++++++---
> net/mptcp/protocol.h | 1 +
> net/mptcp/subflow.c | 12 ++++++------
> 3 files changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 2a525c7ae920..553082eb1206 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1098,8 +1098,10 @@ static void __mptcp_clean_una(struct sock *sk)
> }
>
> /* all retransmitted data acked, recovery completed */
> - if (unlikely(msk->recovery) && after64(msk->snd_una, msk->recovery_snd_nxt))
> + if (unlikely(msk->recovery) && after64(msk->snd_una, msk->recovery_snd_nxt)) {
> msk->recovery = false;
> + WRITE_ONCE(msk->noncontiguous, false);
This will only clear msk->noncontiguous if msk->recovery was also set,
msk->noncontiguous would not get cleared if retransmission was triggered
by mptcp_retransmit_timer() instead of __mptcp_retransmit_pending_data().
We could add a resend_count (or similar) field to struct mptcp_data_frag
to keep track of how many times a frag has been resent. Since resending
always happens at the rtx_head, a resend_count == 0 on the rtx_head dfrag
would indicate that all retransmitted data had been acknowledged and
msk->noncontiguous can be cleared.
> + }
>
> out:
> if (cleaned && tcp_under_memory_pressure(sk))
> @@ -2502,8 +2504,10 @@ static void mptcp_worker(struct work_struct *work)
> if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags))
> __mptcp_close_subflow(msk);
>
> - if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags))
> + if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags)) {
> + WRITE_ONCE(msk->noncontiguous, true);
This write could be done inside __mptcp_retrans(). Then it can be added in
one place, and then only set if data was actually resent.
- Mat
> __mptcp_retrans(sk);
> + }
>
> unlock:
> release_sock(sk);
> @@ -2872,6 +2876,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk,
> WRITE_ONCE(msk->fully_established, false);
> if (mp_opt->suboptions & OPTION_MPTCP_CSUMREQD)
> WRITE_ONCE(msk->csum_enabled, true);
> + WRITE_ONCE(msk->noncontiguous, false);
>
> msk->write_seq = subflow_req->idsn + 1;
> msk->snd_nxt = msk->write_seq;
> @@ -3040,8 +3045,10 @@ static void mptcp_release_cb(struct sock *sk)
> spin_unlock_bh(&sk->sk_lock.slock);
> if (flags & BIT(MPTCP_PUSH_PENDING))
> __mptcp_push_pending(sk, 0);
> - if (flags & BIT(MPTCP_RETRANSMIT))
> + if (flags & BIT(MPTCP_RETRANSMIT)) {
> + WRITE_ONCE(mptcp_sk(sk)->noncontiguous, true);
> __mptcp_retrans(sk);
> + }
>
> cond_resched();
> spin_lock_bh(&sk->sk_lock.slock);
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 99a23fff7b03..29322e09e7d6 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -249,6 +249,7 @@ struct mptcp_sock {
> bool rcv_fastclose;
> bool use_64bit_ack; /* Set when we received a 64-bit DSN */
> bool csum_enabled;
> + bool noncontiguous;
> spinlock_t join_list_lock;
> struct work_struct work;
> struct sk_buff *ooo_last_skb;
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index 1de7ce883c37..951aafb6021e 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -1166,15 +1166,15 @@ static bool subflow_check_data_avail(struct sock *ssk)
> fallback:
> /* RFC 8684 section 3.7. */
> if (subflow->send_mp_fail) {
> - if (mptcp_has_another_subflow(ssk)) {
> + if (mptcp_has_another_subflow(ssk) || READ_ONCE(msk->noncontiguous)) {
> + ssk->sk_err = EBADMSG;
> + tcp_set_state(ssk, TCP_CLOSE);
> + subflow->reset_transient = 0;
> + subflow->reset_reason = MPTCP_RST_EMIDDLEBOX;
> + tcp_send_active_reset(ssk, GFP_ATOMIC);
> while ((skb = skb_peek(&ssk->sk_receive_queue)))
> sk_eat_skb(ssk, skb);
> }
> - ssk->sk_err = EBADMSG;
> - tcp_set_state(ssk, TCP_CLOSE);
> - subflow->reset_transient = 0;
> - subflow->reset_reason = MPTCP_RST_EMIDDLEBOX;
> - tcp_send_active_reset(ssk, GFP_ATOMIC);
> WRITE_ONCE(subflow->data_avail, 0);
> return true;
> }
> --
> 2.31.1
>
>
>
--
Mat Martineau
Intel
next prev parent reply other threads:[~2021-09-08 23:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 7:58 [PATCH mptcp-next 0/6] The infinite mapping support Geliang Tang
2021-09-06 7:58 ` [PATCH mptcp-next 1/6] mptcp: add noncontiguous flag Geliang Tang
2021-09-08 23:39 ` Mat Martineau [this message]
2021-09-06 7:58 ` [PATCH mptcp-next 2/6] mptcp: infinite mapping sending Geliang Tang
2021-09-09 0:01 ` Mat Martineau
2021-09-06 7:58 ` [PATCH mptcp-next 3/6] mptcp: infinite mapping receiving Geliang Tang
2021-09-09 0:04 ` Mat Martineau
2021-09-06 7:58 ` [PATCH mptcp-next 4/6] mptcp: add a mib for the infinite mapping sending Geliang Tang
2021-09-06 7:58 ` [PATCH mptcp-next 5/6] selftests: mptcp: add infinite map mibs check Geliang Tang
2021-09-06 7:58 ` [PATCH mptcp-next 6/6] DO-NOT-MERGE: mptcp: mp_fail test Geliang Tang
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=75aea2-c940-53aa-cc75-644ff532b73b@linux.intel.com \
--to=mathew.j.martineau@linux.intel.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