From patchwork Tue Sep 14 09:19:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12492583 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 E45E23FC5 for ; Tue, 14 Sep 2021 09:19:17 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so1650459pjr.1 for ; Tue, 14 Sep 2021 02:19: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=k/0zxrnKMI6u5AkUOalDui/GVJQaqxUSXoi4ldLgSC0=; b=jYs2x7JgyievlOKdzl/8o8KjMEUsi9oNmTZtd4c245KlEajBnRkU2yHlFFrlgxGYYe gE1gY/RIdIJXkYgSj6v6oIlkzXo+x42dW1QbBerwjM8BrRdb41O+Kny++w/c1/WlWfTF 77ytgHZj7+nbQjASUKAAQynoEjHjC+v5LEPiXBsCqXrVhH/KltXNij7HER0u//CE7znd EFAOHYaIyJfwNkLDZWn2saJsocvJN8WloW3EtRtZ5uinCv3ugzOcdQS80D/WN2IWoGCU +JHfK6qVHyhpzNooXBXxTIIdhvnRwEx+q+8l0zCZytzvymCqJ6bmLJw2D1ba/R1NBjqU R+xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k/0zxrnKMI6u5AkUOalDui/GVJQaqxUSXoi4ldLgSC0=; b=DBnIoTAO74Zw8GcAJ2wAxeFZtm/IdBZuMmoHCRnUZR0ZMHx8q8b4xI+qZERZK2KuJj 62kTVfbGvRmLTt0R7eGSqWvidHWxpMDeAunQWUy88JDqCFm8uPjzguDVNMxXO3MZKm6v PrS4JbTc8Rh5EsDV+63oPPNS7xwv9U3Bh74Z16TderrdhfkDzWcGk0zCixVj3RKimgzF 9OVo9tKYmpgIQDrCNRcO7XGL2n3r66tGi0eBxsNQ9bNvW5JgonriNGtHJEAZM244DeOs z0xuYH+2fwczSvlaNcBh7HDb5vySsvTKOkVePjizkJQUYWCLAMUMpeN9EcLOKiWgSf/B oKfg== X-Gm-Message-State: AOAM533KcKMWDaEqf137AG48oMuxuyENxq3qp8GoQ5HqXWzWXtwWHyui qtO7wcu8NgtbMraDLmvUgRQlCc08FGE= X-Google-Smtp-Source: ABdhPJws0pgzkzXvwodMD2uTkrlpoBwo3EuKrKFpl3PMIQkgiNhuQvV8GN7cS6GxeMuwT+G7jmCYKQ== X-Received: by 2002:a17:90a:a386:: with SMTP id x6mr999462pjp.56.1631611156726; Tue, 14 Sep 2021 02:19:16 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id i21sm10851317pgn.93.2021.09.14.02.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 02:19:16 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 1/8] mptcp: add mptcp_is_data_contiguous helper Date: Tue, 14 Sep 2021 17:19:00 +0800 Message-Id: <3610b34039bb8e73cd2eecdbc43d5a0cfbc5d2da.1631610729.git.geliangtang@gmail.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 This patch added a new member last_retrans_seq in the msk to track the last retransmitting sequence number. Add a new helper named mptcp_is_data_contiguous() to check whether the data is contiguous on a subflow. 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 | 3 +++ net/mptcp/protocol.h | 6 ++++++ net/mptcp/subflow.c | 12 ++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index ff574d62073f..71a5427609a9 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2464,6 +2464,7 @@ static void __mptcp_retrans(struct sock *sk) dfrag->already_sent = max(dfrag->already_sent, info.sent); tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, info.size_goal); + msk->last_retrans_seq = dfrag->data_seq; } release_sock(ssk); @@ -2889,6 +2890,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk, msk->snd_una = msk->write_seq; msk->wnd_end = msk->snd_nxt + req->rsk_rcv_wnd; msk->setsockopt_seq = mptcp_sk(sk)->setsockopt_seq; + msk->last_retrans_seq = subflow_req->idsn - 1; if (mp_opt->suboptions & OPTIONS_MPTCP_MPC) { msk->can_ack = true; @@ -3145,6 +3147,7 @@ void mptcp_finish_connect(struct sock *ssk) WRITE_ONCE(msk->rcv_wnd_sent, ack_seq); WRITE_ONCE(msk->can_ack, 1); WRITE_ONCE(msk->snd_una, msk->write_seq); + WRITE_ONCE(msk->last_retrans_seq, subflow->idsn - 1); mptcp_pm_new_connection(msk, ssk, 0); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index d516fb6578cc..eb3473d128d4 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -227,6 +227,7 @@ struct mptcp_sock { u64 ack_seq; u64 rcv_wnd_sent; u64 rcv_data_fin_seq; + u64 last_retrans_seq; int wmem_reserved; struct sock *last_snd; int snd_burst; @@ -625,6 +626,11 @@ static inline bool mptcp_has_another_subflow(struct sock *ssk) return false; } +static inline bool mptcp_is_data_contiguous(struct mptcp_sock *msk) +{ + return before64(msk->last_retrans_seq, msk->snd_una); +} + void __init mptcp_proto_init(void); #if IS_ENABLED(CONFIG_MPTCP_IPV6) int __init mptcp_proto_v6_init(void); diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 1de7ce883c37..b07803ed3053 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) || !mptcp_is_data_contiguous(msk)) { + 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 Tue Sep 14 09:19:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12492585 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 797913FC5 for ; Tue, 14 Sep 2021 09:19:19 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id nn5-20020a17090b38c500b0019af1c4b31fso1462432pjb.3 for ; Tue, 14 Sep 2021 02:19: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=JydFJBGFsgTdO0iMCcoiOxHfJVWque9piH4bx6V0zWQ=; b=QPxnmffh1qV4lTpFswvQzUg3i6ImydpyYhubQUU0n2lbXjsrIZvTkoUtm7ZYP7aAkt imUneeRHM47Dtp4z1Kedvli48yxTWiNHn3QEiwMK5ruQfjZjsEsA1+9Y8Ck3U8BbD2DX blHo0zwcmn9+qVfLT6L7L5pwYmjZQ2k2z9zPOnO6IzWOXBLWOl9t6E8RiF8ktGEiGptO rAB8NCRgdLZgvHoxVAF9k9J76n+Q5S8Vn2X2DGfRt0Si1m8Oa6rzOX/peDnZAyzFSUp2 hsT2dUjyBlipudJI7mpaK0twAg/EC3UWQknOLyyUSPai7hIA+tdLnfXiHVwl6FZz6ReH dcLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JydFJBGFsgTdO0iMCcoiOxHfJVWque9piH4bx6V0zWQ=; b=qTpocRFZOuOhxESs8OaoqtI7SrDWeJli8qXC7P+XXx4msZqKXJbNLaXqpIfVKvICRB /zirOIOXlAL5j0cUcYAJbReLW05YaKMFC0HCHmX4X/7h/Mo1sdjkRnKDeeLvP/8xZsDh DpiY5lO/EM+d1lKRn9Lrn4QTROfBwZ6vaU84p8D/S2V0tyV2dQl916y+6C6nZulPmYUf UpMQtCjJyllqCekhiwSj6QzkPO3ki9dca+XXUUtGuK92JgZ9YXY0iWEowjq25Ea/YukB P2izZSFBh4/YoAQqJjcj49Tye3R0pFuQUOmokgLav9EfFiCBNWmTrM+lR1BVKTzVTbkW OQsQ== X-Gm-Message-State: AOAM530ZI6GYxPWSKIWSiBjgkiFs/1nKNhYmHz0sS7PVcxVNJjvuZv2N 1y2Ea9Rn8k+3ddzJRSl7fiyWdAg7yeM= X-Google-Smtp-Source: ABdhPJydLchVYUkVEYWZVxeZhBKPJpvLcvGPl8KzBT8uswCl691/+uxwd9cyxGrXLeuGVPnB2rIKIQ== X-Received: by 2002:a17:90b:194c:: with SMTP id nk12mr1018736pjb.50.1631611158933; Tue, 14 Sep 2021 02:19:18 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id i21sm10851317pgn.93.2021.09.14.02.19.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 02:19:18 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 2/8] mptcp: add start_seq in the msk Date: Tue, 14 Sep 2021 17:19:01 +0800 Message-Id: <7b4984f87a23369f9e4896d959945d01289a721d.1631610729.git.geliangtang@gmail.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 This patch added a new member named start_seq to the msk to keep track of the beginning of the last fully-acked data segment. This would be updated in __mptcp_clean_una. Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 3 +++ net/mptcp/protocol.h | 1 + 2 files changed, 4 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 71a5427609a9..e804ca0ac9e1 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1071,6 +1071,7 @@ static void __mptcp_clean_una(struct sock *sk) WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); } + msk->start_seq = dfrag->data_seq; dfrag_clear(sk, dfrag); cleaned = true; } @@ -2891,6 +2892,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk, msk->wnd_end = msk->snd_nxt + req->rsk_rcv_wnd; msk->setsockopt_seq = mptcp_sk(sk)->setsockopt_seq; msk->last_retrans_seq = subflow_req->idsn - 1; + msk->start_seq = 0; if (mp_opt->suboptions & OPTIONS_MPTCP_MPC) { msk->can_ack = true; @@ -3148,6 +3150,7 @@ void mptcp_finish_connect(struct sock *ssk) WRITE_ONCE(msk->can_ack, 1); WRITE_ONCE(msk->snd_una, msk->write_seq); WRITE_ONCE(msk->last_retrans_seq, subflow->idsn - 1); + WRITE_ONCE(msk->start_seq, 0); mptcp_pm_new_connection(msk, ssk, 0); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index eb3473d128d4..5e07264ba62b 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -224,6 +224,7 @@ struct mptcp_sock { u64 remote_key; u64 write_seq; u64 snd_nxt; + u64 start_seq; u64 ack_seq; u64 rcv_wnd_sent; u64 rcv_data_fin_seq; From patchwork Tue Sep 14 09:19: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: 12492587 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 01C9E3FC5 for ; Tue, 14 Sep 2021 09:19:20 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id lb1-20020a17090b4a4100b001993f863df2so2237010pjb.5 for ; Tue, 14 Sep 2021 02:19:20 -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=TgyOHpmTRrA/igPOpJsKgQpFqmbGpqzqPLSg8lcVocc=; b=jT0CjQXTft1GO+MhvFM/QCYPEZtbHHR5YQr6CPsHVNuj6OxeQACAT1vQI2HKJTlIWT zopexvyXTB55+Y1fy7CXa68wvq8ReV7Lgm6+YFvBuqW+7MlJeyPY/1xIMdswZmF/Kvhz c9YOSuhfKgvCto0dTjwC5DTlI8nd7lrNiNvLqPx3jKvrZxE+7yUyVwy7UvbeHqkCWwHh rsmEJHjyEIn2CX7a2nNpVNX+io9z9H6mnGaDy+yVxYBSWvdyBXV+A5tTnhhsROCd51dZ pBNY72AsIzxaysjPkh4UOmQIk7IhE8duFpwS/oiklMITzoGjz3yFoLEHNE1pDw8ajU7m HLww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TgyOHpmTRrA/igPOpJsKgQpFqmbGpqzqPLSg8lcVocc=; b=y3oFJO3qeXoYOLXR14UUPramJjb8V01L7HIcJ8sY1wd28aG6ZMdcXJtRxxbjofGLa3 NlPtKo+d6choIw24K0j0xEw/tCDwK9M6ayrDSjdDWLT2a++lnC5WR690zu35U29c9T0T G38hPqI/RH45uO5Ckz4WtixF0k4ICnrztNjc4LQywS19P1qUiIwEokQSneGcvSFmkpIp ooVevIFfH5/PR7ilJogR9t81czZgJ35ZYqoSgvKlMK3Sx4uozUsX4k2gFMVZLVSf/cfl M8KFHH2M1Kaoe5ytfwXO9wEnA3M/Cvo/hUNyAeAY+Uke1zYzUZVEb74PAZKvt7MMR06+ MYZA== X-Gm-Message-State: AOAM531HjfpqrGnpGl2zwV8xNVEFFYj653eOPKx0hd6xN4WR7IODDlgw lVHmX8V92BByRnU/1lxypyqV++Eq9nY= X-Google-Smtp-Source: ABdhPJxRPO0kMbToKYdjArq4ET6cnGkZqmQ+IYrHg48WfS4pHMFDR865OyHvySN8aVWZr9Nkdfo/ZQ== X-Received: by 2002:a17:90a:4501:: with SMTP id u1mr985035pjg.176.1631611160441; Tue, 14 Sep 2021 02:19:20 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id i21sm10851317pgn.93.2021.09.14.02.19.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 02:19:20 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 3/8] mptcp: infinite mapping sending Date: Tue, 14 Sep 2021 17:19:02 +0800 Message-Id: <27b8dba6a8057eda732ec4e304087c34f777c7df.1631610729.git.geliangtang@gmail.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 This patch added the infinite mapping sending logic. Added a new flag send_infinite_map in struct mptcp_subflow_context. 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_map to set the infinite mapping. Signed-off-by: Geliang Tang --- include/net/mptcp.h | 3 ++- net/mptcp/options.c | 6 ++++-- net/mptcp/pm.c | 6 ++++++ net/mptcp/protocol.c | 19 +++++++++++++++++++ net/mptcp/protocol.h | 12 ++++++++++++ 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index f83fa48408b3..29e930540ea2 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -35,7 +35,8 @@ struct mptcp_ext { frozen:1, reset_transient:1; u8 reset_reason:4, - csum_reqd:1; + csum_reqd:1, + infinite_map:1; }; #define MPTCP_RM_IDS_MAX 8 diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 422f4acfb3e6..9c175c298ff6 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -816,8 +816,10 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, opts->suboptions = 0; - if (unlikely(__mptcp_check_fallback(msk))) - return false; + if (unlikely(__mptcp_check_fallback(msk))) { + if (!mptcp_check_infinite_map(skb)) + return false; + } if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { if (mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 6ab386ff3294..4fad1fe8ba10 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) && mptcp_is_data_contiguous(msk)) + subflow->send_infinite_map = 1; } /* path manager helpers */ diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index e804ca0ac9e1..77183e247e4d 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1274,6 +1274,23 @@ 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_map(struct mptcp_sock *msk, struct sock *ssk, + struct mptcp_ext *mpext) +{ + if (!mpext) + return; + + mpext->infinite_map = 1; + mpext->data_seq = READ_ONCE(msk->start_seq); + mpext->subflow_seq = 0; + mpext->data_len = 0; + mpext->csum = 0; + + mptcp_subflow_ctx(ssk)->send_infinite_map = 0; + pr_fallback(msk); + __mptcp_do_fallback(msk); +} + static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, struct mptcp_data_frag *dfrag, struct mptcp_sendmsg_info *info) @@ -1406,6 +1423,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 (mptcp_subflow_ctx(ssk)->send_infinite_map) + mptcp_update_infinite_map(msk, ssk, mpext); mptcp_subflow_ctx(ssk)->rel_write_seq += copy; return copy; } diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 5e07264ba62b..b923fdfbb396 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -433,6 +433,7 @@ struct mptcp_subflow_context { backup : 1, send_mp_prio : 1, send_mp_fail : 1, + send_infinite_map : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */ @@ -874,6 +875,17 @@ static inline void mptcp_do_fallback(struct sock *sk) #define pr_fallback(a) pr_debug("%s:fallback to TCP (msk=%p)", __func__, a) +static inline bool mptcp_check_infinite_map(struct sk_buff *skb) +{ + struct mptcp_ext *mpext; + + mpext = skb ? mptcp_get_ext(skb) : NULL; + if (mpext && mpext->infinite_map) + return true; + + return false; +} + static inline bool subflow_simultaneous_connect(struct sock *sk) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); From patchwork Tue Sep 14 09:19: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: 12492589 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 D906E3FC5 for ; Tue, 14 Sep 2021 09:19:22 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id t20so8397407pju.5 for ; Tue, 14 Sep 2021 02:19: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=csQN/vjCVRsKVc7NZ9pw0ilc3TBSbnXc0pjZ0lHK+Uw=; b=GrfZEN+/VCFk3YHatEAGbXhqtEK9PAxLRT6N+Qz+BMd0gA1QTPB9p1MW2T8w/y/BVj VgZFTrPtt+JI8PF+SV3EAf3fK+231Qw6QZlxOe3pX3ZDcBloJxGnv+O0sksnze+7FRlZ 5pKLWg4N5KBZD7A/gwnbejnQYWQnna6BuF9aV6molwuSINjn79Glli6+cS9E8/lsJypH aNfE7AjGue/x7VXLWobQHIt42hqz1rAkp1mv+Wc5nTpjnUqPPoulpVF97vUI+XdajAQG WXLlIsiGFx0abWqeKWfIXh2kpEvTmjSx/ECuG3E2mxnKNGZgFBr8y+/n+pLz9LNvjZlA Y4aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=csQN/vjCVRsKVc7NZ9pw0ilc3TBSbnXc0pjZ0lHK+Uw=; b=JD3xdp2tuNl9nT9xhsWWOUgdKg93b2K5Pqt8ZhExDJCa3448OHP9svGIAl10uonI1a viiBCTAmkjNJtHjd9hZWoRx2eYP5HCj/ZPrPDWmfaMrVAxXDxRGPIb8+zNIglq92APrx 1tDP142KY6Wud13OtsZsZTLYxQvAXmg7GfvhjuE/41ih27Iun7m56rof5qWCbEA7fplZ jO+f80KQDcbXd1tTT3TqpNF17C4F2X07zmX+CeVFuYPaQp5T+StoRI4vUsA+bjRiOv4x QpI5FM6e9pCW7wM8LugauUSZAC+fRhuxVZvUYzjkdMWTim6qKJJ0NfWyQCN+PmG23pF2 FITA== X-Gm-Message-State: AOAM533Ubznx32LfSe6dMI2J9C4KUaOrcZN04xgxZBJt0ZzMvzj4ZyFz UhlPSVUH92OgNNGEt+3zC+HduGqSfzw= X-Google-Smtp-Source: ABdhPJwFgbLw/vkBKFHHJCdTH6nmo6FybdFCO6k91+28grrFMS35hDH7DL/73inDhRL+aMje9kdqHg== X-Received: by 2002:a17:90a:190:: with SMTP id 16mr948185pjc.31.1631611162103; Tue, 14 Sep 2021 02:19:22 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id i21sm10851317pgn.93.2021.09.14.02.19.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 02:19:21 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 4/8] mptcp: add the fallback check Date: Tue, 14 Sep 2021 17:19:03 +0800 Message-Id: <06cf0c8e53f29afacdb690945873f3e721d04a0d.1631610729.git.geliangtang@gmail.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 This patch added the fallback check in subflow_check_data_avail. Only do the fallback when the msk isn't fallen back yet. Signed-off-by: Geliang Tang --- net/mptcp/subflow.c | 46 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index b07803ed3053..89173f70707e 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1164,35 +1164,37 @@ static bool subflow_check_data_avail(struct sock *ssk) return false; fallback: - /* RFC 8684 section 3.7. */ - if (subflow->send_mp_fail) { - if (mptcp_has_another_subflow(ssk) || !mptcp_is_data_contiguous(msk)) { + if (!__mptcp_check_fallback(msk)) { + /* RFC 8684 section 3.7. */ + if (subflow->send_mp_fail) { + if (mptcp_has_another_subflow(ssk) || !mptcp_is_data_contiguous(msk)) { + 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); + } + WRITE_ONCE(subflow->data_avail, 0); + return true; + } + + if (subflow->mp_join || subflow->fully_established) { + /* fatal protocol error, close the socket. + * subflow_error_report() will introduce the appropriate barriers + */ ssk->sk_err = EBADMSG; tcp_set_state(ssk, TCP_CLOSE); subflow->reset_transient = 0; - subflow->reset_reason = MPTCP_RST_EMIDDLEBOX; + subflow->reset_reason = MPTCP_RST_EMPTCP; tcp_send_active_reset(ssk, GFP_ATOMIC); - while ((skb = skb_peek(&ssk->sk_receive_queue))) - sk_eat_skb(ssk, skb); + WRITE_ONCE(subflow->data_avail, 0); + return false; } - WRITE_ONCE(subflow->data_avail, 0); - return true; - } - if (subflow->mp_join || subflow->fully_established) { - /* fatal protocol error, close the socket. - * subflow_error_report() will introduce the appropriate barriers - */ - ssk->sk_err = EBADMSG; - tcp_set_state(ssk, TCP_CLOSE); - subflow->reset_transient = 0; - subflow->reset_reason = MPTCP_RST_EMPTCP; - tcp_send_active_reset(ssk, GFP_ATOMIC); - WRITE_ONCE(subflow->data_avail, 0); - return false; + __mptcp_do_fallback(msk); } - - __mptcp_do_fallback(msk); skb = skb_peek(&ssk->sk_receive_queue); subflow->map_valid = 1; subflow->map_seq = READ_ONCE(msk->ack_seq); From patchwork Tue Sep 14 09:19: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: 12492591 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 3CF583FC5 for ; Tue, 14 Sep 2021 09:19:24 +0000 (UTC) Received: by mail-pl1-f177.google.com with SMTP id w6so7752968pll.3 for ; Tue, 14 Sep 2021 02:19:24 -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=YIUuvixQDyQPRkmzFLt6CKToocq/GjmTzgW70ffvtjw=; b=lnTQkbKl7qK8W91+07UlQxzoancyrYfEENKE2FoncjejLZVB/ojIw2zZX+S0MwJNOC Ylp0Tc4ft3k+XvxTzILh+Dyck6HM3YKAa335rOqvB1ZKNdfIZE+7cSweMh6uZtRmf2C5 iqn4pJVZBzvrKZY9X/mKGYrU2x4rPIOspbpIevh/2U2/YPG1+EmyCIlkTETrpnVNbMPt XARCDRJXTQBtEVRzYIXuJjSCXTo7KIyWi175o2JvTq/3tQEhN2xkRELOSEDffgkwdwOq 9wjbT0glWtLrvp2G3aPdiPaotfDfc7/VBLdsr3BfEx2xuoxZM6SMNcWZUHf8o2csWJkr v1TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YIUuvixQDyQPRkmzFLt6CKToocq/GjmTzgW70ffvtjw=; b=HtApsElK7NeVVWwXfDnLZW0Pp2U6f6v6b1vjuaqMsixXfuulpnROmTmYziHD/FM/Pa lwagbKNz9Y5SgoyRh/s8X1ZesqH6YgC+zOWVKVz6crSFxOARqR+iQ4Y9vJqPf8jdJw+/ csjkjCaR/lDxDHu4QcUIq6u10Rq2rS/c+qxa/6PC+fc2B5JrPTaVvZho8Dshc4v06ab1 Hvhbnhy0TG2EJrdoQtgCBprfR+6b/Rw4XmuoBWevrUyjF02psKSu0tNQM/biQWfrUGAr LQpnxiPKoYZC7Xg9lqpKDtPFgbGAsk2tVM4ABGp3gzNriV3/WqeAnDDptTcCCPUEOb3w ZqZg== X-Gm-Message-State: AOAM531Wlsv+o+VTygnWFTs5C7QNzYpbSENxQwEpZpXp3szHQipKKanv B3IGK3136yG0FjLpd3ogjPKR3kBnmiI= X-Google-Smtp-Source: ABdhPJyV3WAlI/jYxXd4XNxjNicK0x0CjYcajz3irr1z42cSohBQvWW6EZI0oie6WQwHi1rSGpnApw== X-Received: by 2002:a17:90a:8009:: with SMTP id b9mr955974pjn.15.1631611163699; Tue, 14 Sep 2021 02:19:23 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id i21sm10851317pgn.93.2021.09.14.02.19.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 02:19:23 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 5/8] mptcp: infinite mapping receiving Date: Tue, 14 Sep 2021 17:19:04 +0800 Message-Id: <27849702bc924bbab7ca914387e18b6dadfe5622.1631610729.git.geliangtang@gmail.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 This patch added the infinite mapping receiving logic. When the infinite mapping is received, set the map_data_len of the subflow to 0. In subflow_check_data_avail, only reset the subflow when the map_data_len of the subflow is non-zero. Signed-off-by: Geliang Tang --- net/mptcp/subflow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 89173f70707e..fd44996a7b9a 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->map_data_len = 0; return MAPPING_INVALID; } @@ -1180,7 +1181,7 @@ 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->map_data_len) { /* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */ From patchwork Tue Sep 14 09:19: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: 12492593 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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 DE3013FC5 for ; Tue, 14 Sep 2021 09:19:25 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id w19-20020a17090aaf9300b00191e6d10a19so2252643pjq.1 for ; Tue, 14 Sep 2021 02:19:25 -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=OUUtlABPXZdGRuVvCgwvqOYGpRbdqlH2zuHRQxptxdw=; b=Any82s0JpAprQOKy4Nx8uuDdlbHG/+vfkL3xP0Z3K66P9TJj0M1wB5pCuStn+W2mnb vnOw1IDGEs5MG4buufkCWMx5MCRirqVylFJsar6OOC3p2bkfYjXrhdUeCutSHDZ8MRxm EqwcB+q+oWww8oALJb2w9N0sPsClSyyOf2PjNceHoZmo2VHxRn+uNZjOekvqShGHviIg aj1wA1JII6w6gohznMJtXItgz4xItwKqLBJ5E2UrLUDG7tpywSdRrUdYV2u/NmiuCm/H RcXVt93SkFirQ0qlE/3k+nuwFeZbMxzTqvC/As9LZr9R13fU88u+Y7kujLDRsIeD+tqe T/LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OUUtlABPXZdGRuVvCgwvqOYGpRbdqlH2zuHRQxptxdw=; b=BXEqgdg0IY/r5BzgcIH3c9kmJLFfMlVsy7jboF8E8cmfiYLJ+FzeQaAj6NtnyT7jGg V97SYGBmFfxGSUeHOC1x5fTKZINY9VrsF1bqFTecWbQQRr8S1iG/0M1+QKmUDcgu0bBr rd+sHZ/azVDZCT107QKYgJvwwYONCn1Mvc3UJ6Eq7egjkg8KqX4uajDrVgF+mKeD7G3m xNNFI3i/N7rTzRGzA6xGlKVwScvgIR4lXvQMiKq0tg5m7b380I54vwEjYtaUZ7Jrp1X0 BTuhvqiZzpCfBgHbqEx+sCCGpUT0OAQijt754wS77GaZCh7a1txESZ/hxAgqISt/Et1d PTSA== X-Gm-Message-State: AOAM530N+Y9zgeUd/bq7W95+/+DAns+xUzW7B/G4GbuIPHzH7i5p0Rg0 yezKVhPGx6So3FIXaBj5RtN85mpRq70= X-Google-Smtp-Source: ABdhPJx5xc6lZLaKl/jT8wWY8rl314m7ltDnAUwyDmRks4BcP9CrDUq1Hi3xTY3VIbJeiUO5rFA3nA== X-Received: by 2002:a17:90b:4a06:: with SMTP id kk6mr1007414pjb.72.1631611165269; Tue, 14 Sep 2021 02:19:25 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id i21sm10851317pgn.93.2021.09.14.02.19.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 02:19:24 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 6/8] mptcp: add mib for infinite map sending Date: Tue, 14 Sep 2021 17:19:05 +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 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 | 1 + 3 files changed, 3 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 77183e247e4d..48e0f55c9e45 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1286,6 +1286,7 @@ static void mptcp_update_infinite_map(struct mptcp_sock *msk, struct sock *ssk, mpext->data_len = 0; mpext->csum = 0; + MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPTX); mptcp_subflow_ctx(ssk)->send_infinite_map = 0; pr_fallback(msk); __mptcp_do_fallback(msk); From patchwork Tue Sep 14 09:19: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: 12492595 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 A2D3B3FC5 for ; Tue, 14 Sep 2021 09:19:27 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id t4so2158740plo.0 for ; Tue, 14 Sep 2021 02:19:27 -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=VkKzUiWsVaredgIGXg1iu5+B3Z7qsRltK25YrnE3fbY=; b=Ntqn1Tj3AJUOb8v3twk9wf7xd59UYUpxl4hgRuKpsk2E0gAqg5MxTiIbli3Kjxvv7d 85dPsN0G44hJ9OOvByX+ZL17iQWfqxydRkW8Y38mQ2y5LRegPmwPUA6J14Vab25VLAhn /bRBZyRxCsK3JXdtIC0tbM7qkfUgilZoI4JUK8OH1hIrj2rvnVkM+gu48MC2Xi0UH0oA 881UZP3w+hM5rsURI8Yucyth1Qbrehq0LclvU5hxh4QYZSkgsnoGa+X7DBpQm0Bs9o2T wPAQ/x4YMJ9vgWj4L/bYrexCOZ6andzdYDDcFKgFIFx9PZGndCGz+4sKx3t1BCUKWbe+ TqtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VkKzUiWsVaredgIGXg1iu5+B3Z7qsRltK25YrnE3fbY=; b=j7bmDAyKsus5Sx/gXKTddXEPxoHNREO+si8jIOkUL3S+wC88ZPxTR3+Ebennj3gIQf bH7JblPAQ6UZ2Xp+pl4donYiTMC/7pTBiPbfrPhq6xay1HscBOK22klbZd7EvNt/DEx3 8qjAELUoU12bdzA6wy1Wl8AYV/ObIQSQ1RX5Ua2owdIqhXHB7bBfpSI7Bf5NAeb9aR6E hN3HNSBvlvRItGJIN812jtF9cQFopI0HyTk4nw71g67qHpkksnRawhHrKespgWJjL3UO aYrCPESoE4ofqgV29AsFqSilb9uCCbPPHoQu7PAAtINw7Vue2DYSGdOuZE6t9JpilNeA yE5A== X-Gm-Message-State: AOAM531tfS/1ENQfh0mzursPWmqYVZe5OIGAbD46jIk/KcXHkVa8F2Rw 9CiWgmtB7oGKPFXXN6UXZdXijZkuPZU= X-Google-Smtp-Source: ABdhPJwF+aYO1mTMDudSif6O8Yq6sDeaLSBxuiYjR9wUyncX20sg1Nzvo99je2Qfq6PXGt/cceAXMQ== X-Received: by 2002:a17:90a:7c42:: with SMTP id e2mr981176pjl.132.1631611167081; Tue, 14 Sep 2021 02:19:27 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id i21sm10851317pgn.93.2021.09.14.02.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 02:19:26 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 7/8] selftests: mptcp: add infinite map mibs check Date: Tue, 14 Sep 2021 17:19: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 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 Tue Sep 14 09:19: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: 12492597 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 EAB523FC5 for ; Tue, 14 Sep 2021 09:19:31 +0000 (UTC) Received: by mail-pf1-f175.google.com with SMTP id f65so11572046pfb.10 for ; Tue, 14 Sep 2021 02:19:31 -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=x/61neoQuJvUboPoxEMvmqYnrY3sD4YlQp7a9H/I488=; b=BndIU4gc+CixysnBvEv6aW0ZCWwjDFFO/i5TLk8I0n/qcyLw6n2AvIgNGxn5T2KYFw BMwz2RK6h9YEGBbA4pmLIBog9964+g1nCEufTK20/4NLLyNyvdedbpF/GS5vwXqrJYzC mJlrw8hidjHorxxFZCYhhws3yLH10/oBuSK7A5/lt7vTPCJ57PdtqZmkc1xir+pbME83 RQnvI4HIDbOagdJyFsvYoyHlysK4WzToOOxhpZE756CA4lRJQ7qiW5+1ujrB5+PH8jcB 8+qBJiudOd2kPmLtgNNlnazp5lTtEitXtfPj7oR0k7gbD9sILcXHCr2erYNeqpPgLJy5 sBkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x/61neoQuJvUboPoxEMvmqYnrY3sD4YlQp7a9H/I488=; b=qaeT8WpR5Q6wfYnlumazirhpvRMjoA52AwEKDAjMyrkGvVC0BgdUmYpIkiue0RPl79 TRzmBNk4aL6L5GSksQliskNh9yVKSpuEpkYZe/TT3Wu9zDJGjEOQ2bxw4P0J37QTJR9a K6heMU/thUJn4D6AxFYwrG8mDCZDMyumKB3h6MIf6U2e9sKPWZtYJmkn4JGAhi0Ulgmz BYBAHPJx28q3zjxMaDsbGuOFi9vznq3lD4pWTG0/++2Vi1TryQYscWzV7p2h3UVSR4Ed A19yU0+TiRoXz6+/DBl7AvfINgXe+KhVn8GY07gbUw25KEI2EyUsW3gYObYz7G7ZgbZn 9EEQ== X-Gm-Message-State: AOAM532MTd5OpylEwxFo7plOymuXVelfPnCTknVRHCAZAxs1m7qZg2xK f6IAGwhGUDZ7Gg2B2tIFEQ2RN+IUsA8= X-Google-Smtp-Source: ABdhPJyTz31QHAxoxHro2/eRVw/D+gMXZ2jiJnbQWNdyDIbILuFadYPjk3hJbi6yz67ha8828zKg+g== X-Received: by 2002:a65:648b:: with SMTP id e11mr14544760pgv.138.1631611171270; Tue, 14 Sep 2021 02:19:31 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id i21sm10851317pgn.93.2021.09.14.02.19.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 02:19:31 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 8/8] DO-NOT-MERGE: mptcp: mp_fail test Date: Tue, 14 Sep 2021 17:19:07 +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 ./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 48e0f55c9e45..0e4c2b7ab264 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1292,6 +1292,8 @@ static void mptcp_update_infinite_map(struct mptcp_sock *msk, struct sock *ssk, __mptcp_do_fallback(msk); } +static int j; + static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, struct mptcp_data_frag *dfrag, struct mptcp_sendmsg_info *info) @@ -1426,6 +1428,13 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, mptcp_update_data_checksum(skb, copy); if (mptcp_subflow_ctx(ssk)->send_infinite_map) mptcp_update_infinite_map(msk, ssk, 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"