From patchwork Sat Sep 18 07:22:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12503619 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (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 EABE972 for ; Sat, 18 Sep 2021 07:22:32 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id r2so11888619pgl.10 for ; Sat, 18 Sep 2021 00:22:32 -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=036WBmo2fq/nu8NjUtwi6s/jaUAfswxnt0NAieyWV0k=; b=ozCbzENEWqeMIl4UY8+z6BoqzejeBqhCxzk83f7Rw5HsEQK/MnQ0hIhNIo+BSkGPrJ A1Pu0mt6cS4zy92a4BZIcE8HMZfjCZFxmzNdOYmedkXW+++9+nmXO3I+PcbAD5SFIqIp dzNNrmqGIe4P5zb5kBEAGCw8jDOxRClSwes43EVkemi3qpTa2XIHQMP7cVQpIKQOTjr0 BPJSGR2EtkWbFeyKObTOdVrzc1XT3H7P7wdjTrJcssRWRtiySNY0/gqFHpk85d9e8YX6 pl4XvSIr8GMMHbMuc9Rm/ogaAJ6NxnIzDsfNOJlK9167vvsa6yTicOT8UeLB/gcuDehV jxzQ== 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=036WBmo2fq/nu8NjUtwi6s/jaUAfswxnt0NAieyWV0k=; b=ej8f6AKRXN93SbyGt9O8R53CaXpyP+5GmfYBxqQz44hhmbuBr5YoJRTppbrwaBIfGB EzXDkfkLgMD84X+ZsdMLUQB1AU5bjiOB8HVFxdkaEuJM0p9nAb7O8WF3tib8EwHDZx3x pcg+J/11Cj3xHpXPeYEM76ZGScUZ4RBMMaQcDIOqtsHNCPf+yruHFW2phjqN9Gtz3Ek/ 2+uRJD7DecxQ5Sv5zpKAZVx5wwFJ6bYwaJ84YiBeB6UZeI6T8mMgVMUNA5l58bmf8v9y 2dNDTvR5eikIONJ9FmHxXlQz9AUscPjE8ssy6oLdFsBNfgsaMewv50w2Ppq3Lf64/EV0 1Udw== X-Gm-Message-State: AOAM5327oa1phGkQ4Rlcx8jRrjLneGUaRiZyilZFix+iXRe1VA62jV7F d39G1Fpj+e/UXV1sHIz7ba6Z9UBjLVQ= X-Google-Smtp-Source: ABdhPJxV1A/z0dZE0gcByo7ijHvZi1HVsYl9UeKrbCZP4JDkuniYBqeWxM7Ir6TP2o7Mu/Xb9y/cwA== X-Received: by 2002:aa7:83d8:0:b0:3ef:990f:5525 with SMTP id j24-20020aa783d8000000b003ef990f5525mr14785632pfn.29.1631949752316; Sat, 18 Sep 2021 00:22:32 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 77sm8040214pfu.219.2021.09.18.00.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 00:22:32 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 1/8] mptcp: track and update contiguous data status Date: Sat, 18 Sep 2021 15:22:16 +0800 Message-Id: <60448fc4985b38f168394a8029f74dcba7b81fb6.1631949480.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 | 15 +++++++++++++-- net/mptcp/protocol.h | 6 ++++++ net/mptcp/subflow.c | 12 ++++++------ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index ff574d62073f..b766b36e6c93 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1102,8 +1102,13 @@ static void __mptcp_clean_una(struct sock *sk) msk->recovery = false; out: - if (cleaned && tcp_under_memory_pressure(sk)) - __mptcp_mem_reclaim_partial(sk); + if (cleaned) { + if (mptcp_is_data_contiguous(msk)) + msk->last_retrans_seq = msk->snd_una - 1; + + if (tcp_under_memory_pressure(sk)) + __mptcp_mem_reclaim_partial(sk); + } if (snd_una == READ_ONCE(msk->snd_nxt) && snd_una == READ_ONCE(msk->write_seq)) { @@ -2419,6 +2424,7 @@ static void __mptcp_retrans(struct sock *sk) struct mptcp_data_frag *dfrag; size_t copied = 0; struct sock *ssk; + u64 retrans_seq; int ret; mptcp_clean_una_wakeup(sk); @@ -2464,6 +2470,9 @@ 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); + retrans_seq = dfrag->data_seq + info.sent; + if (after64(retrans_seq, msk->last_retrans_seq)) + msk->last_retrans_seq = retrans_seq; } release_sock(ssk); @@ -2889,6 +2898,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 +3155,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 Sat Sep 18 07:22:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12503621 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.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 5FBC472 for ; Sat, 18 Sep 2021 07:22:34 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id c1so8401710pfp.10 for ; Sat, 18 Sep 2021 00:22:34 -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=o9Ilu3DBTBvWXhhQsLyZtqcf8Ws6zDVpJIQ0MEyzYPQ=; b=kVsvZG9T0+KR05WnTxKPHYJV+8KinyHd6aAImcxLO15GzZYHYTxplixof0Z1QJIW3w 6Lgya1NsYcXs7cZ7I+YN/B0KYpsY5/brJQToqF9UjUpGp0Dq5f0Sj6p8m300uxfH+hP3 cek5hH+XTZPxurCdhukzo/xlofeXSrt+mm5Wt64nLvsSGwpnNlLz7L6WMBFaZzWKhWDy 1qV+17FrfuNOXPPR2W94Ays1uQV1optzadt7kmz1uN1x8uOgp6dEtkC9RRmHYytdwqRk 7BXQxNHjxlHDNHHkwQPsyQQzNjdZu1klO5mhXxC4SZkKGv9lMfqspoMJFBUwu26lQV71 7WlA== 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=o9Ilu3DBTBvWXhhQsLyZtqcf8Ws6zDVpJIQ0MEyzYPQ=; b=ZkR3kpoRYHtBJzGxuYGQ0PaynHrWWFUPpOyYg7tXk2yZ5nge+FhhOkrixvCBUMpsiY 67jd6n6ChvBag3oHekKfB9t0CIu2lfLJTBPHYePKmpZ35ccl7H1HL/PPhSTLSIa8s77D OVlWhtiTtYk3QiB7fEndYAE2v2KmzqIMuogkY/9GMRp8Ub3s1WO/t5iAnPWAK7OJz5xA d38VHsGc9HBUa+M4c70xtuIsJy+ywNnmueT7OZPUiWBXEbVgQN9ynnV8OEtKBAK4/fbi GdLNBxk20O/WWm0TYcb/HxobZMrLk7/gZyyvdNq3NRoftNYWbFsN5WotWrKbCOZ6upwV 543g== X-Gm-Message-State: AOAM533RKUYp5BXg0AXp1Y22+CNoD/dj+XKcS37b6ORbZV0tvzadkWnV N1nvn7Hf54he32DZxva30NLUaewj5OM= X-Google-Smtp-Source: ABdhPJwLf+SNQUEqqM4AvDKstTAaRW2fhL2+MvrQXg/mu6nkcNacrTj5ln7iNkedeawswUHgLZyyQQ== X-Received: by 2002:a63:4f03:: with SMTP id d3mr13619695pgb.217.1631949753896; Sat, 18 Sep 2021 00:22:33 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 77sm8040214pfu.219.2021.09.18.00.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 00:22:33 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 2/8] mptcp: add last_fully_acked_dss_start_seq in the msk Date: Sat, 18 Sep 2021 15:22:17 +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 member named last_fully_acked_dss_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 b766b36e6c93..b056672541df 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->last_fully_acked_dss_start_seq = dfrag->data_seq; dfrag_clear(sk, dfrag); cleaned = true; } @@ -2899,6 +2900,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->last_fully_acked_dss_start_seq = subflow_req->idsn - 1; if (mp_opt->suboptions & OPTIONS_MPTCP_MPC) { msk->can_ack = true; @@ -3156,6 +3158,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->last_fully_acked_dss_start_seq, subflow->idsn - 1); mptcp_pm_new_connection(msk, ssk, 0); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index eb3473d128d4..2f8a8589668c 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 last_fully_acked_dss_start_seq; u64 ack_seq; u64 rcv_wnd_sent; u64 rcv_data_fin_seq; From patchwork Sat Sep 18 07:22:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12503623 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 3821872 for ; Sat, 18 Sep 2021 07:22:36 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so11612167pjr.1 for ; Sat, 18 Sep 2021 00:22:36 -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=CQ7V+nHagV4ARUFxgBUHUq7xiW26Oe1iCKGV8p1+45Y=; b=aAGygvfgzCtLNpQ/UZra3mJCplqffVwK6cRaHlAhCypHVVhfRyg1BGMpCU6dIy3epg M0AUOhXeUh5Oc2NWCFx5jyEG0jPAL4s3GPukTS/rfAgH97p8fd2luhH8gF/m+dEwbE50 2l64EwKlrZIZQ2aT6fxtEGsDjOAG5yMXgZ/Z9hGWozVvtzBUq8lW/hoP0mb/Y/5yv/6Z rmSKuUDlwfYSoWY0PSCfFtNep9uEZ8QUqT4mV/+xxC9xHJlBFU/ZlW9rMsvmPjgF3R+s MX09soVUbJIHRkiFUrKtAc/DENApsXZ75l/Jlv4lj49CoVb5ebrRRfiF6WOpnfwaQdAH EKmg== 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=CQ7V+nHagV4ARUFxgBUHUq7xiW26Oe1iCKGV8p1+45Y=; b=by93FJVx+sK+qnQPj4AigTLEVClOmBDkIwXDzwsaZUeVjrNSKps1WxJbwNdsY3mI7N 3XcduJdXCRhp7mrINojZYfBNprEOTL2SEaBB0vhhEINMuNrnBWzyWAFK3/da99VyRlt2 6YJDMbu8XQXUfdluaUXyltaatVmxQ+1yzAUvBJtUP0WojVonRUR8qY5dGKwja36MvEuz hWdR+b5zirQB5iuH7oyrd4jqlpOLSLWRKDKf/4hRKR8M+71IC43F/SA81/2NVZxweHTi AeWS0mxvZAUO/v+/wlADjH3Y76Xhk22cKKj8QUC6uqaXoCBcJoIeIVMJByoQe6GgtDR7 1HRg== X-Gm-Message-State: AOAM53150A+93gO7gY3KAzaK7r8CdC4Mg6Ntth16OJxZsKXYVH+4BubP ysDgZ28lUc4E5iD+frXOMIP4TPCujfo= X-Google-Smtp-Source: ABdhPJyNYuFEABwiVnpKAtUZ2v25ANHz1f9FpCgZiW4HggTykSoQmxzf9Vx1GlAgh/DRfOi9V6oHoQ== X-Received: by 2002:a17:90a:6708:: with SMTP id n8mr19592281pjj.219.1631949755661; Sat, 18 Sep 2021 00:22:35 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 77sm8040214pfu.219.2021.09.18.00.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 00:22:35 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 3/8] mptcp: infinite mapping sending Date: Sat, 18 Sep 2021 15:22:18 +0800 Message-Id: <00acc9c10fe938ac26eaec0ed5454e32adf4aecd.1631949480.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 b056672541df..ffef7e1f061b 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1279,6 +1279,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->last_fully_acked_dss_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) @@ -1411,6 +1428,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 2f8a8589668c..cb26183aec9b 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 Sat Sep 18 07:22:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12503625 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.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 C6C7372 for ; Sat, 18 Sep 2021 07:22:37 +0000 (UTC) Received: by mail-pg1-f179.google.com with SMTP id t1so11924561pgv.3 for ; Sat, 18 Sep 2021 00:22:37 -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=SgZQxWh2/5fSpUTVKyZZ5rK+IMoTVJo9PLQ6dG3T1PKTfD24rwJ7z3cwA8dahbumaO z+dnLDX0IrERP+Zd0hRkWQ1zVR+cbn0ffIblur9hwci+4G7jWri1cW6Z9pi5Hl77vGnB sLf8Iv1YFw8kVSf82hlOHz5AWGlOq4SaV7WePIKkvoCoTvpzG00oZndWiwFMh3l08Y7w aU0JJm+QH/nHzF/UIlOGUrPVKECwVn98pGVRNkhO3TYRcb2ps/0G5HHwoblQR/jh6Yhr fc8LrIqbsdsbbOS2iz4PG1cQg4TTTIcZ4CtXF4dKerO+ix+1N/SOWXItfE00dEDz8TPz aNTg== 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=mnuTbD/XHoy1ZMw56//1DVjtYXbEnMrzEn6b65luZjK9adc2k9fKCq1aZvtOWbeY4H OZ5D+aa9jHL6IwoZ6GIwYZU7KMlzKRaq6uEDgBH9vXxi2fZXGzenNWs+GhfQO9XzRr4Y 2eE9tc89Pqs0QCF1udlPHpXFllWnFPP4HpW38cNA5r7j4zUZr7dz+cOhk9Hofnz/zaWR tp7hlA8KwNhMzWHc/z0NcvJlt21XEz8iQJdoZX+zDDFx75+IcCI/GVZdM3+WaI4jRojz sOwZBQJEyuXna8Zfb+gxhcU/+S9A9ZDRHp9sXLkPWvlsIF3WjMlHCaT+Y7dvbs6pgj0m KhbQ== X-Gm-Message-State: AOAM533dgQV8rkjoDT4QptuzLHpYHpy07o4JZ5UIHkiaInLz1BjEzeH4 d+3OYK5X+o8vgT3ig8nb4HA+vny4JIY= X-Google-Smtp-Source: ABdhPJzEDaW0o6sGzNUPzzF2n6bp5JzpXSjteV7ZNNA90OcfVPBDJ7HEw5+DgEWRsPngFTbEbjLqMA== X-Received: by 2002:a63:590e:: with SMTP id n14mr13460684pgb.434.1631949757316; Sat, 18 Sep 2021 00:22:37 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 77sm8040214pfu.219.2021.09.18.00.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 00:22:37 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 4/8] mptcp: add the fallback check Date: Sat, 18 Sep 2021 15:22:19 +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 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 Sat Sep 18 07:22:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12503627 X-Patchwork-Delegate: mat@martineau.name 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 5B5E872 for ; Sat, 18 Sep 2021 07:22:39 +0000 (UTC) Received: by mail-pf1-f175.google.com with SMTP id g14so11383991pfm.1 for ; Sat, 18 Sep 2021 00:22:39 -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=fPEuclTtUQUQVR5UfEWA/O4riyI3VJ/wi9eJZJeGOYcSqQcF8R7o+PA0kUsF1wUSlo ye5cz5ON8uKbxXxc8ojFMGTArbvLfYUUkkD7j3SLJUAtZ/wqGl8MoKneKpqdjfAlo61C 45QUb7Ly8uC4z8/UxBfzD2LB6trV8rm6ULhJJighyO2WxI0pDgc3ucaFOGLG84ZyfAII Ffq/GQj+Vdv6haoBFgVm/XBOYBD+9fSZe7cxW7AnpIQmydBWGhw7UVjfveiGxYVz+WL0 cncXIgXYNf6gnEm36fX6Z99Lh5jxa7mpXE+M1WeFYk27nnKgixsQlNWznQ/T2lErsXaC K5Cw== 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=wnAVxBjzFzep0n0c/kbEkocSPEvHhs5YBXVIbhFDDX/edDFQldavl8sqZ8u5r51xb2 1qx2lRrROVfNWV33J5DoNl4rRc1bnTD8yBLdh1t9ytGgTIwToCkgT3SU7Y1hGlqEhbuy KPtBkh2nqRpswV6PSmvP5RNlOCGwnSUMOoSYd7qnc31pDb5SnhGC2Zk1IX8orQ+LpWWr JLkPI5MuUZq94Wx06FijxHyaWhHvPeZe2V/UIqvxUDE+R2xTxNXZFN3gU///m2c1DbJ7 iy+2z8A1IrlUVrcAvAZsM0PAY7//YOjGjFk4blpmXmf7/T5gG9Hi34KiXDnaPwLPx2Lp pXiw== X-Gm-Message-State: AOAM530kNwRdx/d4wQe2qa7W0ttmgXxTtj2jXwdiWIBI+V4njn+IC2ZS i3DvwLX6Ft724ieYCCRD/uGnuJoyIFM= X-Google-Smtp-Source: ABdhPJzTayxKMS172sArniUxa0d2JG6Uk8uU+u5E3g5Q+dhPHKsboCHtHuon3oQ9IQ/MFxPQXIibpQ== X-Received: by 2002:a63:5d5f:: with SMTP id o31mr13561519pgm.56.1631949758837; Sat, 18 Sep 2021 00:22:38 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 77sm8040214pfu.219.2021.09.18.00.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 00:22:38 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 5/8] mptcp: infinite mapping receiving Date: Sat, 18 Sep 2021 15:22:20 +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 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 Sat Sep 18 07:22:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12503629 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 15F1272 for ; Sat, 18 Sep 2021 07:22:41 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id 5so7673424plo.5 for ; Sat, 18 Sep 2021 00:22:41 -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=5+qxyKPW8ZC4W3uJszHT4yzV3jvmjQG08/9CQjKZ5/w=; b=XuAGYAIwgIV9Xx1CwuhfMvU7iK2aw0tE748E8XO4syuxcZeaRJxju+pS9kgcG+4nmF hZHTHiH8KY0wsyp836gTcyjRShl9tR93ZkCWV5CweoDp7A4bWm8v2/OMYKnATlB6In0g ONEAJqjkFZFA3TiXBilmcTI6Kxjd7qR5UKjajHIgMomYYam/nMKC468Gk+I/z8I7KrcQ irYIT7sA4zK7C2gEUu0Iv6NKZinI/sbjpzvxVj1Iobb7lkYfgRYxCqtbGRoGqSrZvCUr TDs4L+1exx6NEupU2d+bCZyfWxGk/fLENpyYPGKXzuhlzb8HEodKsT5PosuBUXwzIeHw AUWw== 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=5+qxyKPW8ZC4W3uJszHT4yzV3jvmjQG08/9CQjKZ5/w=; b=fru3AzdkGs31q2g7szcRCbEwvYGd9Tl4pU0puOqbEv8+Tv7ePs8fgdfFu2H83gqr1M E4GaiP1OAM17dwMqvqMJ6qSN23bZ9JMcomALb5ollvsTUJU71iDkkikiuTHOfVlrLlyK CbpQE7rN72qXRPY+bT15GBrKXvzYERLMIWqKcmgyAH0bwyNL/N/769rI1mCw3+6Zc4Rb y/JEp2bYcVCfIBFQ6EGZZHF3H0ZBUO7h1NIDEhuNxI5fWwjUrK1PkMr4vNU/fnPElpQk USYdODUzgCaLbLlBfOJr2RXKzIpnhWVXmsdDDfUOX+QMxsaMBiS8myD4IsuaElm/7NH6 wCcw== X-Gm-Message-State: AOAM531fNhQD0+WDb4vEA0GBDN0E6bnwerhBDS5TQhA3gxQACJKX1yDv 9lTRmIf4LUCHNppkWlLFb7elUGR+7ZY= X-Google-Smtp-Source: ABdhPJyOtvxLzJCpICQaKr1sfqxuDbUEWO4ss9XwsMBgeZoAG9lUsgqZa7wIG38GXkJjqIQYV7LeKw== X-Received: by 2002:a17:90a:5511:: with SMTP id b17mr16938354pji.222.1631949760541; Sat, 18 Sep 2021 00:22:40 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 77sm8040214pfu.219.2021.09.18.00.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 00:22:40 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 6/8] mptcp: add mib for infinite map sending Date: Sat, 18 Sep 2021 15:22:21 +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 ffef7e1f061b..d035119b41cb 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1291,6 +1291,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 Sat Sep 18 07:22:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12503631 X-Patchwork-Delegate: mat@martineau.name 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 777A172 for ; Sat, 18 Sep 2021 07:22:42 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id n18so7673257plp.7 for ; Sat, 18 Sep 2021 00:22:42 -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=TvVdE6/XeNVnMidSpHybUuwkULfeQYWD2uqPuAbi6zmlq+BUdutlWBKbrT6KtbzNdi TGpuqOwhq2XspacSj7k0dQ257un+2ayBtSmoh1LO+/6f9pSjiGqUQRqrwY6OAK5htq06 e02IIO5wbR0fGf3M6ApNxXoAC6+WBh994jvl8L+kiikB7q10PLezz5mZP8UUVqLI09bY KRbRgAkVnohMCKyfRnc4wq792KRuHb4+Vbv9s0ScRtC/LJ5ZCmG/IUIL0kpIyP48p/5A uSkWX7wgUn8IZABaHn78qgZncApdvbnnQMvUZlNu+Iy02pLFZG/GDCcBir2tNIwYZ0AK Fo1A== 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=RorhnfYfrFib7dzszqoTyNaH8NqR5qJ84tUVNHXZWOSnjUQo5LlCSLxpEiCEXTMxTv IAkjh2OV59/XfrtcpP0nEMwU3dkmmApXkEQpB3RxGogW5/lhIpyK2tfzNxOv20J8D6wE TXf9D5Pd+rWHgXg+WeuhQk3zG6DbOwXqmktTfKqGdFfkeoPOgiQbNUQ48TpNbjSMypF9 TtuofIODPHPFDhJLizLsUtc4LiUXiTim/BEkqoYdBGAU8IyvrQmNHic7bOgpEaQBrIs3 3ZvdC0e1O+I46ARPN0Vc26QFWvPh5uxPa1JW0vAYS05odWl9AWc26Un4gIx7BO62OW/n yRog== X-Gm-Message-State: AOAM533Qi0MH4Q4jBsUChbkERx6CY1mRC6103TvZBMPRGyuwuqmxvToL bfrpFGuQPeGXe6jOsOorFezj6P2GrGk= X-Google-Smtp-Source: ABdhPJyb0D3PUIIJ0shmwuYrmlpjp6FyeT5W59YzI5bwzOYIbnF+xCQKqZjIW3oxYAFZibp+vLY89g== X-Received: by 2002:a17:90a:53:: with SMTP id 19mr25163298pjb.159.1631949762044; Sat, 18 Sep 2021 00:22:42 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 77sm8040214pfu.219.2021.09.18.00.22.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 00:22:41 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 7/8] selftests: mptcp: add infinite map mibs check Date: Sat, 18 Sep 2021 15:22:22 +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 Sat Sep 18 07:22:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12503633 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (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 A566972 for ; Sat, 18 Sep 2021 07:22:47 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id f129so11922246pgc.1 for ; Sat, 18 Sep 2021 00:22:47 -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=I2ZLfYN3oNiOEaWlZbpsbKLfQ6k89+mYkXtjSrzW7Zk=; b=LZBORIYqF1xzkcHzjBKmgokjqoTcEDUesabdcRfc/uQz/E1cQcUHPqj63lKC5a4mMh Y4WmktgMd/pIPsMnMTWyxSJrapV2QdYz0+kw3868RFyC5ioIkBHCqQXEe9DTZ7Lg5QKg sLsUg/C7Pp3+JGqrj5KlrjSNLxLCBR/SeETKuYn7p11GpFFFm2Yx1uTwVUYe9geO9QRr RoGZgK6UB9iKqL/4oUCofObhSW11Ajnk8mkPMBpUz5FLw5fqU77NHjVYeJ1CPl6O0I0l 4ROMGmkeXLdKL6ko5mZJhwGAwIKGxB2ouqDVlVM2uRGIGC8q8CHiDyUjF2Exk19aXfN5 HThQ== 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=I2ZLfYN3oNiOEaWlZbpsbKLfQ6k89+mYkXtjSrzW7Zk=; b=xCftNq1Mxg4ELEqmZOxpMzabWZk0UTZNQhA2COcxNV7pd+WNnmwi7fyFnCaS6x94EA xl9ckpmGIorVKIau6I9uO56Iw9WEqC4wFISiH6sT9lgVvMbrV4bSwDviajWd4wZS4geQ Y1ZLO02ciDWw+kPXGzYicXMliu4HWlEQoAZcta1xS7Zt6iceRhqOAVqpvFIlVMhv0lIM RJDDRk+V68mJHoTHI0YtzwEUmiEmkGmXZaGfrHfaX2EwewsdmDrBU/EzL0hTP/y71wBP B+1/uOEacgLfoSSp8fg5AyJ9Hs6KNXfUfmuVPrWnN9Dxhn4zHOzlEt1bUVJHfAxC01IY jn+w== X-Gm-Message-State: AOAM5335dG3X8DSFwH4jv2FvpPiYlQneVvFVLrjJf+B5GaDyCJzNWHj5 h7phjVMIWQDoBocgqphhDOYsLYgBcmw= X-Google-Smtp-Source: ABdhPJzPAquE0sP63Hn3NIRYSEG8si3IPwF4polXAZrnJiYel5Iw+5jamRAdsG3XXniUAWu3yWu0ng== X-Received: by 2002:a63:1262:: with SMTP id 34mr13456392pgs.356.1631949767136; Sat, 18 Sep 2021 00:22:47 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 77sm8040214pfu.219.2021.09.18.00.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 00:22:46 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 8/8] DO-NOT-MERGE: mptcp: mp_fail test Date: Sat, 18 Sep 2021 15:22:23 +0800 Message-Id: <54f45be86bfb22cbe8b1af851054c28eed9461cf.1631949480.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 ./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 d035119b41cb..5be8023f27ca 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1297,6 +1297,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) @@ -1431,6 +1433,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"