From patchwork Mon Sep 6 07:58:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12476537 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A63212FB6 for ; Mon, 6 Sep 2021 07:58:14 +0000 (UTC) Received: by mail-pg1-f172.google.com with SMTP id g184so5986263pgc.6 for ; Mon, 06 Sep 2021 00:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WVrvNqfHSWjrH1vjE2sONj5OfBOz/ynCKbMy/GXaOtM=; b=mCiKn5JJhAu/K71Nh5PQZ67S46WaJ7jzhgvDimIWq7iYRu1mmDhKGt3dMvB3qxsgrr F8FQ01jVIWSHYaKt05XWBo6weR6JZG6bcrnUpS042j/ThFf3hnpem1IFhZDwvBdlryBt e1YDSnpVCttAswQt6h7kmL3S0RUJEJTkApGFh2M5qvBcPNX8q8qFTLjzFFrDgrhK390s Il2hkH3i4nA0yV4kPKG3nIIavhyoB9xygn8q6JjUREv1OdIr1HwOtZJAdpmfHmEuBlqg 7+LN7yL8K9IdJbHVR9HpfQ8832+f6CdDEu6/WFfcW0TUTRpFsjuzNK1eEB7iZHi4ghb5 Bguw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WVrvNqfHSWjrH1vjE2sONj5OfBOz/ynCKbMy/GXaOtM=; b=FYH6hBGeOLrmWkdE2gh3cRBM15wP8W/LYA0C40nwbSYbFWRO9424CB+de5BUwbEyvo i9MRhszq4DVk9IZlzzmOL5jzG9vPqSwD9BYFGx7xdu3eUHgDq/K1iSeICvqFTqqvJY0U ngvziAeP+91b43CTEONz56B183T0EVo2MjfvZYV0i0dn6rt9CMEZwbLaJYFf9cUsYZn5 vuLofc2g6BrIvCsChDsjxpV6eLX54NVZ/0/ifNzcmk2uAw5sEzPy3qcmC2wQuxaAio8U oGxWMpACjMpGqLzboEpo5jpXVym9VDNnTjJb1kkSWaKxUg5cfAtUBojFUKFDzbBwhel/ 2oXQ== X-Gm-Message-State: AOAM5338848I4ODP08SuYpUJufpat+K3idFc0sdXhXvjQV5WcGBD9vWX eLNXa7jSRZpkvQRAi5iPspZEwYh3l58= X-Google-Smtp-Source: ABdhPJzqvFM0s+kp5xNHixEgtJFF460rPBl8kW2zHTpy2MZFvt1QqHysjvhiM9A7tayGc5ZQra+kpg== X-Received: by 2002:a05:6a00:1245:b029:30f:2098:fcf4 with SMTP id u5-20020a056a001245b029030f2098fcf4mr10914653pfi.66.1630915094074; Mon, 06 Sep 2021 00:58:14 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id c24sm6895702pfd.145.2021.09.06.00.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 00:58:13 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next 1/6] mptcp: add noncontiguous flag Date: Mon, 6 Sep 2021 15:58:02 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang 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 --- 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); + } 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); __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; } From patchwork Mon Sep 6 07:58:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12476539 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 298093FC1 for ; Mon, 6 Sep 2021 07:58:16 +0000 (UTC) Received: by mail-pf1-f179.google.com with SMTP id e16so5023695pfc.6 for ; Mon, 06 Sep 2021 00:58:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DVBdfXA4zfpgg+g2/KHcZC8I3yZ20VtSUV6QaLJfwlo=; b=f2bdfcde6c1C4qqE2rDUh1LksAqCucgbvDWjxDh8z5RJ6rHYOPoFId2ejjB2VSlU36 IWgw4ItwhWaPreDtHkfVP9NBF2u9OqVIYTpPUfenWPUHK+ACBokeBCTBsCD+olnNbpHJ VwRnK7LWrgW+jsC8vdeRwdn96fgERc9uzkZhzHtcDK82brqH907ZFV8VTCqVhh+PeXP/ Tm9NgL1Bh7JwKUx6z1zI3BLaxHX6b2bEVpK9QaUFHin82Bzq/DWVK8z7lxI7HdoxgYxC e/Xf0bURXzTXtPDJOoUrZf+FQMzJsUtHPOJz+OlMpEAw/8DAKBa3uzkt25trUzroGvgU QCTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DVBdfXA4zfpgg+g2/KHcZC8I3yZ20VtSUV6QaLJfwlo=; b=bNz7QOO3HjT/RMc9oZ5MlWQHO/WY9ruKtRaRDyuIPjDutlT6etAKz1LxsZDekkBfD+ 0ApLAwp356VYpgAr6YhlrmWFmoZQo+SiX6WR0FbVKB/uZDsz0yChHhiJ2FjuvpIR4dSB zQERLyi/fBZu/Z7gxtmNEDIIjts1G/Mh1Sf6zuoy3fwtHx6JNGrQ7Mi54Dvq0EfYz7KU Q5NMKFSUHyvuW8dlSMqy9uG66tr2QN6CFRQmAPXNRCKZSNlx/s1h2Fc4bpWs3bGclsiJ wgRNkrV5S/irqGdK0uIxNFulKwbjQsxjhefho4Sk7b84z75m/ZaZyZe6DpJ+cIvD5QYy 7CKA== X-Gm-Message-State: AOAM530ue1kZJ5xNPPhLLZPV2wI8CAOhB14gCuuLyjIRimG4vhfqgrJo mVmIIofizYqdBGpXiJQkuLv8W9TT4DY= X-Google-Smtp-Source: ABdhPJyU76NEIT0KhB9klmVA0TN9ji15mMr0bOkmsOeCRR++r6tidXuQW/eL+MFMRr+H3A9vGYqGyA== X-Received: by 2002:a05:6a00:2d4:b0:409:6830:f66d with SMTP id b20-20020a056a0002d400b004096830f66dmr10678878pft.54.1630915095587; Mon, 06 Sep 2021 00:58:15 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id c24sm6895702pfd.145.2021.09.06.00.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 00:58:15 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next 2/6] mptcp: infinite mapping sending Date: Mon, 6 Sep 2021 15:58:03 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added the infinite mapping sending logic. Added a new flag snd_infinite_mapping_enable in mptcp_sock. Set it true when a single contiguous subflow is in use in mptcp_pm_mp_fail_received. In mptcp_sendmsg_frag, if this flag is true, call the new function mptcp_update_infinite_mapping to set the infinite mapping. Added a new flag infinite_mapping_snd in struct mptcp_subflow_context. In mptcp_write_options, if the infinite mapping has been sent, set this flag. In subflow_check_data_avail, if the infinite_mapping_snd flag is set, don't reset this subflow. Signed-off-by: Geliang Tang --- net/mptcp/options.c | 8 ++++++++ net/mptcp/pm.c | 6 ++++++ net/mptcp/protocol.c | 15 +++++++++++++++ net/mptcp/protocol.h | 2 ++ net/mptcp/subflow.c | 4 +++- 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 422f4acfb3e6..09768cacd2a8 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1325,6 +1325,14 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); } } + + if (mpext->data_len == 0) { + const struct sock *ssk = (const struct sock *)tp; + struct mptcp_subflow_context *subflow; + + subflow = mptcp_subflow_ctx(ssk); + subflow->infinite_mapping_snd = 1; + } } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { u8 len, flag = MPTCP_CAP_HMAC_SHA256; diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 6ab386ff3294..2830adf64f79 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -251,7 +251,13 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup) void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq) { + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + struct mptcp_sock *msk = mptcp_sk(subflow->conn); + pr_debug("fail_seq=%llu", fail_seq); + + if (!mptcp_has_another_subflow(sk) && !READ_ONCE(msk->noncontiguous)) + WRITE_ONCE(msk->snd_infinite_mapping_enable, true); } /* path manager helpers */ diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 553082eb1206..3082eb367df2 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1274,6 +1274,18 @@ static void mptcp_update_data_checksum(struct sk_buff *skb, int added) mpext->csum = csum_fold(csum_block_add(csum, skb_checksum(skb, offset, added, 0), offset)); } +static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_ext *mpext) +{ + if (!mpext) + return; + + mpext->data_len = 0; + if (READ_ONCE(msk->csum_enabled)) + mpext->csum = 0; + + WRITE_ONCE(msk->snd_infinite_mapping_enable, false); +} + static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, struct mptcp_data_frag *dfrag, struct mptcp_sendmsg_info *info) @@ -1406,6 +1418,8 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, out: if (READ_ONCE(msk->csum_enabled)) mptcp_update_data_checksum(skb, copy); + if (READ_ONCE(msk->snd_infinite_mapping_enable)) + mptcp_update_infinite_mapping(msk, mpext); mptcp_subflow_ctx(ssk)->rel_write_seq += copy; return copy; } @@ -2877,6 +2891,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk, if (mp_opt->suboptions & OPTION_MPTCP_CSUMREQD) WRITE_ONCE(msk->csum_enabled, true); WRITE_ONCE(msk->noncontiguous, false); + WRITE_ONCE(msk->snd_infinite_mapping_enable, false); msk->write_seq = subflow_req->idsn + 1; msk->snd_nxt = msk->write_seq; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 29322e09e7d6..a058af61cf7c 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -250,6 +250,7 @@ struct mptcp_sock { bool use_64bit_ack; /* Set when we received a 64-bit DSN */ bool csum_enabled; bool noncontiguous; + bool snd_infinite_mapping_enable; spinlock_t join_list_lock; struct work_struct work; struct sk_buff *ooo_last_skb; @@ -433,6 +434,7 @@ struct mptcp_subflow_context { backup : 1, send_mp_prio : 1, send_mp_fail : 1, + infinite_mapping_snd : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */ diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 951aafb6021e..87f42ba7c09c 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1179,7 +1179,9 @@ static bool subflow_check_data_avail(struct sock *ssk) return true; } - if (subflow->mp_join || subflow->fully_established) { + if (subflow->mp_join || + (subflow->fully_established && + !subflow->infinite_mapping_snd)) { /* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */ From patchwork Mon Sep 6 07:58:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12476541 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4FEB3FC0 for ; Mon, 6 Sep 2021 07:58:17 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id z24-20020a17090acb1800b0018e87a24300so4023808pjt.0 for ; Mon, 06 Sep 2021 00:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IPVAbN2Pszc3GxBgz5n1fPb7njB/Un/qvtIVtcEAhC0=; b=PSFskLf+7iwKXqd/eG/hjs67AGCa8crtyrMfbIEOY2TQvEvu2aKr0qc1/Bp9iLBtgl 7k0QBS3kvv+fLZexSIAITrMyqlDIMcl1VBlVKDBguisuMwV6pKPJYggZ3K58vPf1tGTs 7NgFxC+Ylgq+1O4Y0pBindq6F0x2aT6JPOoTfKwVE9DPfqhwn2LeOdkrscISgT3b5vQZ D0jY+PBBoA1VAXw+x34IKKaGFcEuNRTUdTqWJOkA3xlD9CzZCytXtVRO5oshxIB4KtYf FJmSWkAn0Fsr5q8Iq7aarAvpMiHzW0iOOcYMfdigyejdjYiTQ38gjaXOko1nWEWGdqhF 2Vuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IPVAbN2Pszc3GxBgz5n1fPb7njB/Un/qvtIVtcEAhC0=; b=RggTEehoYH+hRxtS98C3xk07qX/sldkLHWzcTvfDvfgKvuNEygSgRzX4YGDNuj/5LR D9ae9+VwxwoDvGQ28vSQMtEDteB6cFoT0g8VX5yvNij0pLKVMJXDJtw0Sizi+WRZcyii OOuqaKhezg3c+Ay+udqpe7aGEz+LH0/PKWx8dIlGGVIQqM7SigJ4+KN5h+gTx5+c6q/D cEJ0k/MB3/xTbc9oeG/wRfY30LbTuBTPH4hWN1aXPdhz6YnaM0ooLczHnZq1hBdRLtWO P2Mg/yz9pZeTBAl28CUPU4ivj1z3f01P1pXWw661ByTpUDw4Qbeq7kGYG0MJru4HGFDU t5Og== X-Gm-Message-State: AOAM532PG4GxKoBJxKPwU27jxUJShcoKUMEX3zsa+u8yZbiYz7DTTK4r W399nZA4OGIa2DVHpSskFCh+LEA2Ug4= X-Google-Smtp-Source: ABdhPJwhcuJKEqTlfYTCWs6P/xMO2kJ1dUBCpBHKb0tiJ2H8pbDtK8jh95xBC7dEUseVWzYDeWj6Qg== X-Received: by 2002:a17:90a:5513:: with SMTP id b19mr13036973pji.16.1630915097249; Mon, 06 Sep 2021 00:58:17 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id c24sm6895702pfd.145.2021.09.06.00.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 00:58:17 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next 3/6] mptcp: infinite mapping receiving Date: Mon, 6 Sep 2021 15:58:04 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added the infinite mapping receiving logic. Added a new struct member infinite_mapping_rcv in struct mptcp_subflow_context, set it true when the infinite mapping is received. In subflow_check_data_avail, if the infinite_mapping_rcv flag is set, don't reset this subflow. Signed-off-by: Geliang Tang --- net/mptcp/protocol.h | 1 + net/mptcp/subflow.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index a058af61cf7c..b92b02c2ba61 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -435,6 +435,7 @@ struct mptcp_subflow_context { send_mp_prio : 1, send_mp_fail : 1, infinite_mapping_snd : 1, + infinite_mapping_rcv : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */ diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 87f42ba7c09c..e7ede61c712a 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -968,6 +968,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk, data_len = mpext->data_len; if (data_len == 0) { MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX); + subflow->infinite_mapping_rcv = 1; return MAPPING_INVALID; } @@ -1181,7 +1182,7 @@ static bool subflow_check_data_avail(struct sock *ssk) if (subflow->mp_join || (subflow->fully_established && - !subflow->infinite_mapping_snd)) { + !(subflow->infinite_mapping_snd || subflow->infinite_mapping_rcv))) { /* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */ @@ -1201,6 +1202,7 @@ static bool subflow_check_data_avail(struct sock *ssk) subflow->map_data_len = skb->len; subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; WRITE_ONCE(subflow->data_avail, MPTCP_SUBFLOW_DATA_AVAIL); + subflow->infinite_mapping_rcv = 0; return true; } From patchwork Mon Sep 6 07:58:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12476543 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8802F3FC0 for ; Mon, 6 Sep 2021 07:58:19 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so3791437pjr.1 for ; Mon, 06 Sep 2021 00:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tbR46yEwetFmr74l5qKWaXcQ1UG6B9A96OmGxbAsp+o=; b=EbAXcCQyGZkW1eTrx6hA5ZWski00dP7oW4O3iP9EhaQPLJvUTHQbVOJntpPNCo8IkF OeFLIiBeOB6GxXGeZLKfuAt3jvaefGz7T3nko8TzyAGCGT4m2PrwgrGBh2l53/sL8sLu e1u7PVHLzPyGY3DffM2P4QJmG7+NG/s3WMIJhoIi8QCzW15bfPC9DhCWW93NRFU4+Anp 6z8oP+Ulei0iWC/mcnDSDHv3S+yJrxNiXwQMqmMeZRYd6qAKCFhHkOmKIAmwXm4HYzmE 18PA1EaFXxOP1vYguh5M6n3QMaObOFlzQQC8sMft9z5U5RhlhWls7uQ345eVSrxgYusg oSfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tbR46yEwetFmr74l5qKWaXcQ1UG6B9A96OmGxbAsp+o=; b=DpKSDSV94T3Xq4ub+MismtJq85xSPcD2aTJWL01Le5br0H9chT2eJoNwIyN52rRokv 8MiR7JcnFSbHI7+w1EpuObu1L9T7V42YsyRESE/RGOg+uqpZaOO/5GjKa9GB01LlxMy2 jC5QxwNuNZUqU2CWdJ4LYwDH4NA/D92QQeqmDKvssiz4ZwVnwrf5ku/jNwKQ21chu2Jl rZklUndAASqY/RN0AuavJAgNBga/g9v6Zqi1fZRcJJekDpZt+gF1Ken9SjXib6V8WWUl Tu762H+hNJdeC6Q7XTThuHp4g/d7Oe/8ZRfg427ZhJH/MIN3UAgeg0y5c0mOKOlcBkv/ FcxA== X-Gm-Message-State: AOAM533JfqYvJsgxN+7fENbEcKIT+gOxJH8LGjYLVl70i+N+DVeN01lw 5niKv0aWL7e7jG6XvrEuRr+u4Od80yU= X-Google-Smtp-Source: ABdhPJxEWCmkz/FTKK66MQGKkHB6pVa9sd089KzSAOhvWZAmWahpi0h5D5SQWy5uOYODSQU3sk/wXw== X-Received: by 2002:a17:90b:ec9:: with SMTP id gz9mr12642609pjb.24.1630915098998; Mon, 06 Sep 2021 00:58:18 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id c24sm6895702pfd.145.2021.09.06.00.58.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 00:58:18 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next 4/6] mptcp: add a mib for the infinite mapping sending Date: Mon, 6 Sep 2021 15:58:05 +0800 Message-Id: <792d3d4c024442df1eeac2d24e200ec34ac47cbd.1630914699.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added a new mib named MPTCP_MIB_INFINITEMAPTX, increase it when a infinite mapping has been sent out. Signed-off-by: Geliang Tang --- net/mptcp/mib.c | 1 + net/mptcp/mib.h | 1 + net/mptcp/protocol.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c index b21ff9be04c6..ab55afdcae22 100644 --- a/net/mptcp/mib.c +++ b/net/mptcp/mib.c @@ -24,6 +24,7 @@ static const struct snmp_mib mptcp_snmp_list[] = { SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX), SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC), SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH), + SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX), SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX), SNMP_MIB_ITEM("DSSNoMatchTCP", MPTCP_MIB_DSSTCPMISMATCH), SNMP_MIB_ITEM("DataCsumErr", MPTCP_MIB_DATACSUMERR), diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index ecd3d8b117e0..7901f1338d15 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -17,6 +17,7 @@ enum linux_mptcp_mib_field { MPTCP_MIB_JOINACKRX, /* Received an ACK + MP_JOIN */ MPTCP_MIB_JOINACKMAC, /* HMAC was wrong on ACK + MP_JOIN */ MPTCP_MIB_DSSNOMATCH, /* Received a new mapping that did not match the previous one */ + MPTCP_MIB_INFINITEMAPTX, /* Sent an infinite mapping */ MPTCP_MIB_INFINITEMAPRX, /* Received an infinite mapping */ MPTCP_MIB_DSSTCPMISMATCH, /* DSS-mapping did not map with TCP's sequence numbers */ MPTCP_MIB_DATACSUMERR, /* The data checksum fail */ diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 3082eb367df2..b14023301975 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1276,6 +1276,8 @@ static void mptcp_update_data_checksum(struct sk_buff *skb, int added) static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_ext *mpext) { + struct sock *sk = (struct sock *)msk; + if (!mpext) return; @@ -1283,6 +1285,7 @@ static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_e if (READ_ONCE(msk->csum_enabled)) mpext->csum = 0; + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_INFINITEMAPTX); WRITE_ONCE(msk->snd_infinite_mapping_enable, false); } From patchwork Mon Sep 6 07:58:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12476545 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A4733FC0 for ; Mon, 6 Sep 2021 07:58:21 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id i13so3776911pjv.5 for ; Mon, 06 Sep 2021 00:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KYx3YyFoHwDg4nx5uFvbO2npW+beq7yD9VEjzpnMdSw=; b=bOZin4pPJGYYFb7LDt6NpIcHc69PKQ2hPic6VzbjFF4UA1qsa9XRkqDVKefzsDIUWz 1/SxWAcl8+nGAn9KkrGLbYQHtOIdWrmTv4Hcgqmi+s0F17iuTK+d85onPUklTDQKXhGc pzizeOsbBaFvxncZolaYlSKS3bHI5EFNRcnluN7onmyBn7YoHvSiIeNUGHbpvVWyjJdm uN/MCRUDJQvgT9FRjraUytyaomNfxQbo4Bh2q29snHUqpPEu7BKzO8WaoQZt9xz2LIjG hCnJ7xpzPv0ssXM/feS62CvZ6f4XR7DfwU9OkCPMTI/qlG1UspL9HTaSVPd9S8mhzsas uWig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KYx3YyFoHwDg4nx5uFvbO2npW+beq7yD9VEjzpnMdSw=; b=sG+JceQRrazIEq7kTO2Q2N24PrlYYNPeXQKAkQgBl/1UrPM4Y5YZZBWCJ7WjikdbYZ aHk2QfgznAsRttREWluJHUASeczq39b3ghNIeyRrnwMabpvjRsjBdcFRAuUuVXTkj2hu D0RszTk3Nucl/HSc2wm/JgXbcRzHf4RPAMCx4+p5CQolkXNVOjFXkO+YSpkwFQJ6aG0M Ng1tewt+t8suUaf0+ixFcPzmWa8fRogt5jHd2feeurENMnT4WLixqF0DqdlC97aJ0+su //ILVf/GETpCWFv4IpK/zOugD+nO6ViAjX3YjIFC96m4O8r7zDKTI4zGTeg9xs/ZYWOD QmQw== X-Gm-Message-State: AOAM530N4iaaPDiGcDSAAjJ8+LIMMZktzjDOjyXSheUnv3s56ihpV90R CYNiU2am7wUtXrIu7xmlpRP92v9qKAQ= X-Google-Smtp-Source: ABdhPJwyb02bwIzysMxk3IwtdSIdFKIXND2+2NpSjHDqmaQBW0WDe+SIJLkxrGj+o6a3XmNof7VX0A== X-Received: by 2002:a17:90a:8c8b:: with SMTP id b11mr12703699pjo.14.1630915100605; Mon, 06 Sep 2021 00:58:20 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id c24sm6895702pfd.145.2021.09.06.00.58.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 00:58:20 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next 5/6] selftests: mptcp: add infinite map mibs check Date: Mon, 6 Sep 2021 15:58:06 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added a function chk_infi_nr to check the mibs for the infinite mapping. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 255793c5ac4f..fe0c8f3164a7 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -615,6 +615,43 @@ chk_fail_nr() fi } +chk_infi_nr() +{ + local mp_infi_nr_tx=$1 + local mp_infi_nr_rx=$2 + local count + local dump_stats + + printf "%-39s %s" " " "itx" + count=`ip netns exec $ns1 nstat -as | grep InfiniteMapTx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$mp_infi_nr_tx" ]; then + echo "[fail] got $count infinite map[s] TX expected $mp_infi_nr_tx" + ret=1 + dump_stats=1 + else + echo -n "[ ok ]" + fi + + echo -n " - irx " + count=`ip netns exec $ns2 nstat -as | grep InfiniteMapRx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$mp_infi_nr_rx" ]; then + echo "[fail] got $count infinite map[s] RX expected $mp_infi_nr_rx" + ret=1 + dump_stats=1 + else + echo "[ ok ]" + fi + + if [ "${dump_stats}" = 1 ]; then + echo Server ns stats + ip netns exec $ns1 nstat -as | grep MPTcp + echo Client ns stats + ip netns exec $ns2 nstat -as | grep MPTcp + fi +} + chk_join_nr() { local msg="$1" @@ -665,6 +702,7 @@ chk_join_nr() if [ $checksum -eq 1 ]; then chk_csum_nr chk_fail_nr 0 0 + chk_infi_nr 0 0 fi } From patchwork Mon Sep 6 07:58:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12476547 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D75193FC0 for ; Mon, 6 Sep 2021 07:58:22 +0000 (UTC) Received: by mail-pf1-f171.google.com with SMTP id y17so4997816pfl.13 for ; Mon, 06 Sep 2021 00:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xPzm3L6Lm/y9qXXvjV3D7Ueebj6tefIxr2YJ9fwBYtI=; b=PvwJ1k4tqPas6r/zbuLXkGEwt+u1f7vxU660yGFK3PjWqJGn405WBG2cNGpTyJM6Ld iVruUlLA6I+7TGxts4ZcsHxhTS7juqiG59DP1HY2TKFLjwi27gYzn1lFxIHhZRIYCBkE BRdn9CHCwUxOzQ8xOO18ByX/dySpTceUoPyZSAAyOns63ita27ig6SY+gZStrIk2frVI CYjxo23Q+0EMOxuiLraMIlAish7WlXb16KaM0Iucf71ubmkk1Z3o3vOwUO2Qr6Kcc/D6 Ek1Uc0hv1o4ueQFDFmrc1X3HGtSyRJIdPnP+naSNJZx22A/VRmACPvV11Yt06yme7tsf rVIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xPzm3L6Lm/y9qXXvjV3D7Ueebj6tefIxr2YJ9fwBYtI=; b=qmt+dYcK9JIqCJ3QiNFw1caUZRobxwYQ93eA8dYX/8AEcl0ZsDakmsjZh81H6N49Rs rHyNEkGcM4pdzhyEmWhMPVAHpeQqp1g/WY1be6f2emaxmHOleW8OzMYPaqEE8vh7xFX/ 9aXwclJr9XKiHxjDWbOqYBHnTDDIQfTiN8gQgEa/KnmGkupiBpM8wZllKfDQuTfJHyfj IJCb16a8Pu0HUp4vphZ9Qmsg8O8me52tB60UhVTzOR/A6MnPt3jVsZ6JYAsDE2D+CA9h 8c147hqW5q+pr2YW1S+mHe1bMoxiVvLRW2zjqMRjdO45fCxO20IbYcviQZIrk5oA0KGB sU9w== X-Gm-Message-State: AOAM532dYVyJqrvEWjoRdEKk12pglS8UU/+opJczXwhTOyi/2duHhT+T NPt+ScJij4ZAPPUV//a1pSfb41b8YRk= X-Google-Smtp-Source: ABdhPJxl/MQKxUvigGzDfDYMYztYcOOQ/AI/eQlLeEdktTYr8BZhSM4NIDiyb4LIAZ8kvlx+xmJg3w== X-Received: by 2002:a63:e50a:: with SMTP id r10mr11171860pgh.84.1630915102345; Mon, 06 Sep 2021 00:58:22 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id c24sm6895702pfd.145.2021.09.06.00.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 00:58:22 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next 6/6] DO-NOT-MERGE: mptcp: mp_fail test Date: Mon, 6 Sep 2021 15:58:07 +0800 Message-Id: <004a49d4abdafdd8965d6da07a702db1c310e5a1.1630914699.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang ./mptcp_join.sh -Cf Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 9 +++++++++ .../testing/selftests/net/mptcp/mptcp_join.sh | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index b14023301975..b7f344fbe322 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1289,6 +1289,8 @@ static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_e WRITE_ONCE(msk->snd_infinite_mapping_enable, false); } +static int j; + static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, struct mptcp_data_frag *dfrag, struct mptcp_sendmsg_info *info) @@ -1423,6 +1425,13 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, mptcp_update_data_checksum(skb, copy); if (READ_ONCE(msk->snd_infinite_mapping_enable)) mptcp_update_infinite_mapping(msk, mpext); + + pr_debug("%s j=%d", __func__, j++); + if (j == 20) + skb->data_len = 1; + if (j > 40) + j = 0; + mptcp_subflow_ctx(ssk)->rel_write_seq += copy; return copy; } diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index fe0c8f3164a7..38663f6373b8 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -977,6 +977,24 @@ chk_link_usage() subflows_tests() { + # 1 subflow + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "1 subflow" 0 0 0 + + exit + + # multiple subflows + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "multiple subflows" 2 2 2 + reset run_tests $ns1 $ns2 10.0.1.1 chk_join_nr "no JOIN" "0" "0" "0"