From patchwork Thu Sep 9 11:51: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: 12482965 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.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 E3D173FE1 for ; Thu, 9 Sep 2021 11:51:20 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id f129so1531317pgc.1 for ; Thu, 09 Sep 2021 04:51: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=0IwQx+UGeHAuHdCt1Z8OYgPtaYSyiG9TEUMf//P9Z0A=; b=iBf9bvqkZU04lknYC0GDiQ5rslirbulZyy50UVh55aomVZGaVr3ZiERD2oiS94O8tt WTRICRmwHfRPz/wwI095CkdtsCHkwhri7xrKoQo3mRNyKoX/8PlYpM7HIBv+eHiHf8NE as02RGL85YHL258sWJqJg+G1IAau8KMW6Wgt535G0/twLS9qOj+sgY434SMG/CVYc6bM DKJGUuH7jTX5bXg2wsUFSSMnzbmAokMGNWPwt1tx6n3DiTLuJnHZdr16hBcwWdigCWh4 PetThZaCk9GcwaAzG/TM5tSchfnvYMaCx6Sgov5MBf5Eee6Qf/jd5h0XAPrNgSH+cHSV a8Ew== 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=0IwQx+UGeHAuHdCt1Z8OYgPtaYSyiG9TEUMf//P9Z0A=; b=GjN1JM/OgrcBzDApTPU0gcU2dXEz/23xb5cbm5YeZZCgzy4/8cSwv2mn2IyXl3++6c OMGMWF9K0yI9NgHNMdyKe80G1ga2HvATY+BUQFs2v/PA3h1Gp5PjpgXD1Cqt36HRN5qv vDZEz/FBiG0CCH4Rq1FzsUE8jW2gnt6HzVcOjQCHo6qcHh82GUS7phAYJvLAQ7AUumU/ FYeEv5121nv6r2VaWJvGTKivqg0Jq3JO2eB3NhCf9Pah5jNLf9u7TkCj3Ai9SW8A5Ues uMej2JfxQOiQAM+E+JJ6G3TkCc+tHmGLdtr75NCZlHR1PMKdSl1li2LIOwUIWVZZSZs3 0EcQ== X-Gm-Message-State: AOAM533KSPvesUhjoC+qCq8FXqSQRxmxgVSLZpVt7/gBfobtvHJaDZSb njkmQEptQyERdgBnRh8DNsliCDeJaTw= X-Google-Smtp-Source: ABdhPJxkhbOeLSWVMsYoR0h8ocmCSmds1eUmV6wp9VE6IHfNVqwKq/Fp1w1mL/MJ99t3ChDfRu1Ssg== X-Received: by 2002:a05:6a00:1255:b0:3f5:26ee:ca2c with SMTP id u21-20020a056a00125500b003f526eeca2cmr2806617pfi.62.1631188280336; Thu, 09 Sep 2021 04:51:20 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id n14sm2458225pjm.5.2021.09.09.04.51.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 04:51:20 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next v2 1/9] mptcp: add noncontiguous flag Date: Thu, 9 Sep 2021 19:51:03 +0800 Message-Id: <138e3913108d313b11a261e6c9e3db2cc788183f.1631188109.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 "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 | 7 +++++++ net/mptcp/protocol.h | 2 ++ 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 bb8a2a231479..81ea03b9fff6 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1095,6 +1095,9 @@ static void __mptcp_clean_una(struct sock *sk) dfrag_uncharge(sk, delta); cleaned = true; + + if (dfrag->resend_count == 0) + WRITE_ONCE(msk->noncontiguous, false); } /* all retransmitted data acked, recovery completed */ @@ -1171,6 +1174,7 @@ mptcp_carve_data_frag(const struct mptcp_sock *msk, struct page_frag *pfrag, dfrag->overhead = offset - orig_offset + sizeof(struct mptcp_data_frag); dfrag->offset = offset + sizeof(struct mptcp_data_frag); dfrag->already_sent = 0; + dfrag->resend_count = 0; dfrag->page = pfrag->page; return dfrag; @@ -2454,6 +2458,8 @@ 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); + dfrag->resend_count++; + WRITE_ONCE(msk->noncontiguous, true); } release_sock(ssk); @@ -2872,6 +2878,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; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index d3e6fd1615f1..011f84ae1593 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -213,6 +213,7 @@ struct mptcp_data_frag { u16 offset; u16 overhead; u16 already_sent; + u16 resend_count; struct page *page; }; @@ -249,6 +250,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 Thu Sep 9 11:51: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: 12482967 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.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 B175B3FE1 for ; Thu, 9 Sep 2021 11:51:22 +0000 (UTC) Received: by mail-pg1-f174.google.com with SMTP id s11so1505425pgr.11 for ; Thu, 09 Sep 2021 04:51: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=My8AdwXLxPTR7ooNlnm5cXkTz6oQnDg8G4GI2E33QC8=; b=UFrz+5zmKqZpsFTXuuCdmDDE1CS6+rwFkO0zKyEte3zw1Juf/lFqJoZgTWwzsjoG5G oRCUpmuuQ4D3RxALoIrEK/PlocRZnHpo9r58VMqwMP8f5g5qmP41r9dPzR2u2KgrvZhV WI+I8MMEmIvrE/uJhOFl4Mv/h2AGlXi9LAzMChb5SS2jwiXMcKLHqSr+O2AInoQh+J+/ F9H3COe+bOBNQ0Vm/31jmmPg6r9HgaCX9xHw49LcRVOUP2Nw/udSKPblsh28FJiLdxnB NfXSgwGRRm+lpEiLjCbXBVRjCkAtw6O4u8g4atJ8+HvCo4zRGoaE1otPk4katwg6ZJe/ jxbw== 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=My8AdwXLxPTR7ooNlnm5cXkTz6oQnDg8G4GI2E33QC8=; b=jOxNHfy4kETzNONiNRMD2Pobt/AaO8aqOPS6cTjJdtwYqp6HRyjvmyEkOuv3KbOuSy 9gLAO74lhuGKv8NpU2cv36ORvrC3zs8y2gP3GViZZLBiM4BmR7BXK42m5nvLIWzozOl+ gCN9+4kx+p2F1wPxuDE+ZOPoKC6TF8sAi7b1axjR7OKGUnnnCx4SkHDvRycH47cOBgW0 kTJhW8rqW6STdqoWPyzNXYdpnEirtGFeEuXwlKSK5mIuV0IDZWpHR7zz0aLhSngOorOG 24mdBedvss7kVWUAkrv634iM2XBrwCs0JtEl9TqkK4OfMhWoH+GeSr4+yxTaBnw6/uhz IqLA== X-Gm-Message-State: AOAM532fTM14uTS2NUIi3GMsMeGTvWHdmfFh8WvdhW8EdiI8AXmhr0z+ LU7J25YlfxX6kfjcDBSOkEDpm3NI+Ns= X-Google-Smtp-Source: ABdhPJzD35e9aK2epe27GFYfEBhTJttqlTTI/vXXXR7L4mcKnxS8TTg+jV8fqTG3IneL+BWRVmC0BQ== X-Received: by 2002:aa7:9693:0:b0:412:448c:89c6 with SMTP id f19-20020aa79693000000b00412448c89c6mr2796286pfk.82.1631188282002; Thu, 09 Sep 2021 04:51:22 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id n14sm2458225pjm.5.2021.09.09.04.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 04:51:21 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next v2 2/9] mptcp: add MPTCP_INFINITE_DONE flag Date: Thu, 9 Sep 2021 19:51:04 +0800 Message-Id: <436686041e03ec619d507cf4d517e9137f7bd27a.1631188109.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 flag named MPTCP_INFINITE_DONE. Define mptcp_do_infinite and __mptcp_do_infinite to set this flag, and mptcp_check_infinite and __mptcp_check_infinite to check this flag. Signed-off-by: Geliang Tang --- net/mptcp/protocol.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 011f84ae1593..5644a361b9c7 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -123,6 +123,7 @@ #define MPTCP_RETRANSMIT 9 #define MPTCP_WORK_SYNC_SETSOCKOPT 10 #define MPTCP_CONNECTED 11 +#define MPTCP_INFINITE_DONE 12 static inline bool before64(__u64 seq1, __u64 seq2) { @@ -870,6 +871,38 @@ 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(const struct mptcp_sock *msk) +{ + return test_bit(MPTCP_INFINITE_DONE, &msk->flags); +} + +static inline bool mptcp_check_infinite(const struct sock *sk) +{ + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + struct mptcp_sock *msk = mptcp_sk(subflow->conn); + + return __mptcp_check_infinite(msk); +} + +static inline void __mptcp_do_infinite(struct mptcp_sock *msk) +{ + if (test_bit(MPTCP_INFINITE_DONE, &msk->flags)) { + pr_debug("Infinite mapping already done (msk=%p)", msk); + return; + } + set_bit(MPTCP_INFINITE_DONE, &msk->flags); +} + +static inline void mptcp_do_infinite(struct sock *sk) +{ + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + struct mptcp_sock *msk = mptcp_sk(subflow->conn); + + __mptcp_do_infinite(msk); +} + +#define pr_infinite(a) pr_debug("%s:infinite mapping (msk=%p)", __func__, a) + static inline bool subflow_simultaneous_connect(struct sock *sk) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); From patchwork Thu Sep 9 11:51: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: 12482969 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.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 73AC93FE1 for ; Thu, 9 Sep 2021 11:51:24 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id n18so1494531pgm.12 for ; Thu, 09 Sep 2021 04:51: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=8rZofg3zZ4rObox/1x3Gt/v2FA9F+9fmvC9V3SByl5Y=; b=eJiA8yKgxrGsuLcilIotHEYPqixqwcFHP1n51ELa5Vy67Dlm2Oy3/OM4+pmjETs2Zh fyxvtlrrxZJtqL7hHKMjfaFahG1ed1vgrp0/4zs1cAoVXszyfEghW83z7iRr4Pvexbvv oZSf9gguNuB2BQrNmKuXOTogkOrcgdqKv7BXsS5iEJXgCNphjpa2s3hts0zJnGyrsLiI tEKYwTWJIHSX50tBBNtzRzFoOdw7tO27vKcYLKV3IAgVHFaBI+5nvHcTHjGrK3+YoJn7 6duNZt6E3oTyQgi2lP4aDyYco/1O1JwuXXI98WmudM0HYfZhMmfF1UQdATUUn/zNNQhW kosw== 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=8rZofg3zZ4rObox/1x3Gt/v2FA9F+9fmvC9V3SByl5Y=; b=uw3iInxZ3WjqKNvRHB+CcQ7Sfn0tpglVEgnGIS7HyttwIrv15Nc8JGX9hD/aXJ0oUT kKAi4ImmxVYBQvFhjOAz7BH9Ac9ggrCMuPTETqUFZYGH/GKOjMNx/Vto89WW0zpbTCaj aCKq6piL6vcqVJUTxDLwfxXe1qxMGRE/1pzfjQRVsZ9kquzJnj08ofXmtu1fGs3MthJ1 bnLES7k+A9osrP9NLToKvk+tpk54f/MxLvOdXnNyOikfM0/i5Pq0q3hKYLPVkjwVcOXQ tv7BGRxDpBLaT7MXaQqG7AwO1Pem7BX4oo7H8hMd2MZKTKG/tgpqd2FrZo4N/4p6eifa nZ4w== X-Gm-Message-State: AOAM530Asl3GEhvKmL87bJQNnQJgya3jkhtvBxyz5gUYnHtIC8cihFY8 ThCjlnvOwFz0Gk31SA5Dn+YzQJL/FwQ= X-Google-Smtp-Source: ABdhPJxWvx1dQeotfej9FEPlbmNDK0yVlk6ysp6suH8R5wH4RplMAMnbqbj4f6mmkMbqDolScwDEFw== X-Received: by 2002:a63:215c:: with SMTP id s28mr2313107pgm.99.1631188283951; Thu, 09 Sep 2021 04:51:23 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id n14sm2458225pjm.5.2021.09.09.04.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 04:51:23 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next v2 3/9] mptcp: add MAPPING_INFINITE mapping status Date: Thu, 9 Sep 2021 19:51:05 +0800 Message-Id: <592427b5a91d5e64e4b96c4c8b8d06264197f1c4.1631188109.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 mapping status named MAPPING_INFINITE. If the MPTCP_INFINITE_DONE flag is set in get_mapping_status, return this new status. And in subflow_check_data_avail, if this status is set, goto the 'infinite' lable to fallback. Signed-off-by: Geliang Tang --- net/mptcp/subflow.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 951aafb6021e..ad8efe56eab6 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -798,6 +798,7 @@ enum mapping_status { MAPPING_INVALID, MAPPING_EMPTY, MAPPING_DATA_FIN, + MAPPING_INFINITE, MAPPING_DUMMY }; @@ -938,6 +939,9 @@ static enum mapping_status get_mapping_status(struct sock *ssk, if (!skb) return MAPPING_EMPTY; + if (mptcp_check_infinite(ssk)) + return MAPPING_INFINITE; + if (mptcp_check_fallback(ssk)) return MAPPING_DUMMY; @@ -1121,6 +1125,9 @@ static bool subflow_check_data_avail(struct sock *ssk) status = get_mapping_status(ssk, msk); trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue)); + if (unlikely(status == MAPPING_INFINITE)) + goto infinite; + if (unlikely(status == MAPPING_INVALID)) goto fallback; @@ -1192,6 +1199,7 @@ static bool subflow_check_data_avail(struct sock *ssk) return false; } +infinite: __mptcp_do_fallback(msk); skb = skb_peek(&ssk->sk_receive_queue); subflow->map_valid = 1; From patchwork Thu Sep 9 11:51: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: 12482971 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (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 61D2F3FE1 for ; Thu, 9 Sep 2021 11:51:26 +0000 (UTC) Received: by mail-pj1-f54.google.com with SMTP id rj12-20020a17090b3e8c00b001991428ded8so981625pjb.1 for ; Thu, 09 Sep 2021 04:51:26 -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=Z+sfPRbbZpSczVpoVWH69WcPjTVaYriomUO/9jZBIOI=; b=qkpNjyFLKXzYav5fLP2rxjLRuRHL1BZ0V8R00j19Y4s+GW6+Wel/e5i/mlKxFYU+HH 3dsRIzRqIL6j4E1IwHvcf6FLU73L7ZCtutXAXR0or9vsXQS4nishpWESSOtyNmZiHZjt 6p2I0LtxOVlImmHCZpvy/l5KGeO+zLtpry6k1zNhg2YBmKUyyx7tAHjSquea8TPHZCDX dvZUAu0uTKObEOnUURzT25FzI0Md1+dkWpd6YA9jkjYkmS0sGMHpiZCgxnJM6ub+4M4S He29gVYtm244uY0LvhzslPyLHtn+RgUc9ciPZx09/5y8xPbqDzIR39qrhIwS1HggzrXm Pagg== 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=Z+sfPRbbZpSczVpoVWH69WcPjTVaYriomUO/9jZBIOI=; b=tB3Rq1+6H0o/BBUbBqPg/P/QU1TGMKXDFZdDOTmNvrhom0/wkd8849VXaitYTVzHHH xj12z2yHBxDesjjYTO8KSHK03D/VFnaUUYF3rIV93l9Kh3JWyALOrp05Ew/Kf/hWPkfO HMlQg/gGv9TJM52edzv1RE+WYLuHz58ABJKXCd7glhBqqT5AwqmJ32aaC1q3NOBzLJhy hTe/a263ZFh2y6ommnJfrqbMkx6u8uF1kuhuMVMoXVSQIlpuHcFLyq/0ZOp8RNU538fp 1n0tvLIXXjohYDeHagC6QsVzuK5q7iSBSeHaZfKGPC4uS6ebq4LMrbsfgc8QpyfomnSd 8zPA== X-Gm-Message-State: AOAM533AFKha0Ix1ysV5GoWSMw9h0uX2wKIAPOMRVfVTWHKU10PZRiaA IVMpGaAXMYogcfVgTcyjLrnFQHj3U5Y= X-Google-Smtp-Source: ABdhPJz4PZthoiQGuSBH+jxQeJa9fdiqTI6YKqEQuwweCd04kjDcaQ9rMoV5X1E9cUalhsq+GT5ePA== X-Received: by 2002:a17:90b:3e89:: with SMTP id rj9mr3193830pjb.138.1631188285871; Thu, 09 Sep 2021 04:51:25 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id n14sm2458225pjm.5.2021.09.09.04.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 04:51:25 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next v2 4/9] mptcp: add start_seq in the msk Date: Thu, 9 Sep 2021 19:51:06 +0800 Message-Id: <48b3740fe2e7339114c7aa8278e5615cdb6b997b.1631188109.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 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_move_skb and mptcp_pending_data_fin. Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 4 ++++ net/mptcp/protocol.h | 1 + 2 files changed, 5 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 81ea03b9fff6..c7ecd3e3b537 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -308,6 +308,7 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk, if (MPTCP_SKB_CB(skb)->map_seq == msk->ack_seq) { /* in sequence */ + WRITE_ONCE(msk->start_seq, msk->ack_seq); WRITE_ONCE(msk->ack_seq, msk->ack_seq + copy_len); tail = skb_peek_tail(&sk->sk_receive_queue); if (tail && mptcp_try_coalesce(sk, tail, skb)) @@ -523,6 +524,7 @@ static bool mptcp_check_data_fin(struct sock *sk) */ if (mptcp_pending_data_fin(sk, &rcv_data_fin_seq)) { + WRITE_ONCE(msk->start_seq, msk->ack_seq); WRITE_ONCE(msk->ack_seq, msk->ack_seq + 1); WRITE_ONCE(msk->rcv_data_fin, 0); @@ -2894,6 +2896,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk, WRITE_ONCE(msk->ack_seq, ack_seq); WRITE_ONCE(msk->rcv_wnd_sent, ack_seq); } + WRITE_ONCE(msk->start_seq, 0); #if !IS_ENABLED(CONFIG_KASAN) sock_reset_flag(nsk, SOCK_RCU_FREE); @@ -3141,6 +3144,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->start_seq, 0); mptcp_pm_new_connection(msk, ssk, 0); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 5644a361b9c7..77af55171ded 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -226,6 +226,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 Thu Sep 9 11:51: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: 12482973 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 753C83FE1 for ; Thu, 9 Sep 2021 11:51:28 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id c13-20020a17090a558d00b00198e6497a4fso1249617pji.4 for ; Thu, 09 Sep 2021 04:51:28 -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=GNbetCXTVkOPIwZs4Xp8418mnDKVPZ04yx3PxjkEX9E=; b=UmVG40MhavLkT3bfT56wl3id1EfSjPH4cyM28uih5fvbcjmHOBPlBXEyZNNMG8/MVE LTbPkMwGkEnhQ9NFF4nr78qF5IG/Evx2cRjGDJEXwXNurdHtAn2m6OUV4mkJhwiOJay0 5c9P67gZNePnmHvZAcuys5yO6NZz9ZtUYC3S6h1PNh1LG+yoKmcVWBg6dTDjOvedd0dk QPBpy+89qsWMyKnFj3499Zs9svDAgu6W29lryj7wkig/LJWMqiNh8l2O95AnWmWsv34f edZrcuGWObB2tIZVSB0jm0mvulKV7i+q22rbADF9TOfennptkTt3LLiVY69gnZFO/YAc 78FQ== 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=GNbetCXTVkOPIwZs4Xp8418mnDKVPZ04yx3PxjkEX9E=; b=Ulq3EQKpA5VuYWyXo1KjqpA/XhFuD94yUlKI6ePzTsysT4rX171Of3ZCgaR7M0zCgh rJkh9GMiIIXyzQSY5wYmJkwCwAgPOnheVoX9ZCKiwmErg7zbCCsVZMQ2kL384XQCf2ff YbxaTjX2zSI2IdjpkRSMhTCM2Bq4MShlZM0SSVqnbFPuCtNM04HyEg8MusRUfWN0P6Ab CbbXZWkeXynfA+JzruxYjYcEaTLW22kxeVQsUswEZWDAoACYrQmXgeDq3DXhsL2+71GJ Y94zxFDa6liUyMW28pP883z1sQbQWXnOp8W9kt/udjd9BJ0/uZLMa2Pqvz/mD1iqLauC pi6Q== X-Gm-Message-State: AOAM531yrke+cTR399fzvWciW/cJ0e8LRrBx0pf0hSD8ZfH3FO+FhDn/ U3w7v/f70Rr1KeRTrPAjaAQYCJZwst4= X-Google-Smtp-Source: ABdhPJxENS2qoydEnMo6i7HaS8k9HdgYqj2/9zJ8yxVQ0HfO0hh4S5ejYb7/XW7QVSPkV1W1mN9Q3w== X-Received: by 2002:a17:90b:1c07:: with SMTP id oc7mr3070189pjb.153.1631188287585; Thu, 09 Sep 2021 04:51:27 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id n14sm2458225pjm.5.2021.09.09.04.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 04:51:27 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next v2 5/9] mptcp: infinite mapping sending Date: Thu, 9 Sep 2021 19:51: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 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. Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 6 ++++++ net/mptcp/protocol.c | 18 ++++++++++++++++++ net/mptcp/protocol.h | 1 + 3 files changed, 25 insertions(+) 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 c7ecd3e3b537..4ebbbc6f1d01 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1278,6 +1278,21 @@ 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_seq = READ_ONCE(msk->start_seq); + mpext->subflow_seq = 0; + mpext->data_len = 0; + mpext->csum = 0; + + WRITE_ONCE(msk->snd_infinite_mapping_enable, false); + pr_infinite(msk); + __mptcp_do_infinite(msk); +} + static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, struct mptcp_data_frag *dfrag, struct mptcp_sendmsg_info *info) @@ -1410,6 +1425,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; } @@ -2881,6 +2898,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 77af55171ded..b4a7c54f0d78 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -253,6 +253,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; From patchwork Thu Sep 9 11:51:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12482975 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 2E07E3FE1 for ; Thu, 9 Sep 2021 11:51:30 +0000 (UTC) Received: by mail-pg1-f170.google.com with SMTP id r2so1499712pgl.10 for ; Thu, 09 Sep 2021 04:51:30 -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=usGLNHapEGqI0MbD8ehVTyV2St5+TU0bTMCbDp6z4R8=; b=iMTik4vzmXfXT9oPtBm74CHmN7O4ygrAC/jWQTf3uabWP/85KMyVrTVeuFJWvuwqi/ kffOYmSn92K8ajxCb3I22CJq/dxLttHxmDZFah6CZpNnzLe9YCKPf/yOhzbyUl+pKGti fHEZKxYaIXT5AJ6AAgmIR+j6CUsAdVf81lu8C/Uuvyjsd99NJOp01fi902c8MuUeW690 AgK4uuOSLV0fr51hgxtz5lzGMauvX+hbcX8TANMedgOH7aysqmSOdcLZpV6bJIYBck0o Z/3m/OPDHEWC+Q6ic9IORq2TEceVWZKnaMOAYKJMDpkPBcfZbY3rY3trJYP9wDm17yvg RMhw== 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=usGLNHapEGqI0MbD8ehVTyV2St5+TU0bTMCbDp6z4R8=; b=Z55REg2mI8wpr468Ch990MC34srjgM5SBQSk1eqLJY+gas4j4GoAXI8Fb4Z3aCk6Y5 Bree221597jgkoMC0aNoz4uUZ/nyeKyF3YE/txwMQ+UAWsqyMupVd41cittqkZHiCBT/ UsHlHm6gA6gvCIwyRbfM7Wd+uqsWYyLWCH2tElW1R8sCfZa2neuZUZTERN03nJGgRuIQ GtbU/ccb0KEYEhM64qda1Fe4F88O8X14PS9fMwWUpdWaxGCsj2jfRUoqc5HQ53/MSeST vEJSob5WRGT9+l/WvCvE0fmZrb4GnsZHh83bNn4g/pQgl3VO1Cp2RYi75a87zX0wHMIk UBZA== X-Gm-Message-State: AOAM530W5FYVO4zVlrjWp7kTOriRHkoCCk/7RkoSGpHj+nn2ow6wGbGW WlY/644BIrHzYUKt7JewP4kc5ods7OI= X-Google-Smtp-Source: ABdhPJwYjegcbMHiC3vn8Nhpg8fixtloRJH/GY5/WB5WakYsyFkz8pI5XKOnYUfvSdXhuYlOIxOhXw== X-Received: by 2002:a63:f62:: with SMTP id 34mr2270537pgp.159.1631188289649; Thu, 09 Sep 2021 04:51:29 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id n14sm2458225pjm.5.2021.09.09.04.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 04:51:29 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next v2 6/9] mptcp: infinite mapping receiving Date: Thu, 9 Sep 2021 19:51:08 +0800 Message-Id: <945fdaa82c817feb705da45d0b1597c7d8a5533b.1631188109.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 the infinite mapping receiving logic. When the infinite mapping is received. invoke __mptcp_do_infinite to set the MPTCP_INFINITE_DONE flag and return MAPPING_INFINITE. Signed-off-by: Geliang Tang --- net/mptcp/subflow.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index ad8efe56eab6..bf535cc46c5c 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -972,7 +972,9 @@ 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); - return MAPPING_INVALID; + pr_infinite(msk); + __mptcp_do_infinite(msk); + return MAPPING_INFINITE; } if (mpext->data_fin == 1) { From patchwork Thu Sep 9 11:51:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12482977 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.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 CB8383FE1 for ; Thu, 9 Sep 2021 11:51:32 +0000 (UTC) Received: by mail-pf1-f173.google.com with SMTP id m26so1551285pff.3 for ; Thu, 09 Sep 2021 04:51: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=km0MgSxm6Kn0tQW3gAMPUaS+5fn6Xw5BCs9fkD362dI=; b=MFk+Wty206EdkK7e3s6wN2L+4ACHiysGLSaGBGlykz53rAgMsLtzM7/r2YUdX9Ndvd ViOZkzxSGNanHk1BSKsI1uo++zeYs8E4howAVQ0Qaf0cgGho4+qMobk7E0GAsAPvRh91 +y/o/cSJVSTQmbmMBedCdZ0SUaNdLqXMThBQdq2CV+nkIBf8r/nntgmMlfXNzQby7zM0 Li1IU6Fps7l7cdFqAp3SvpVbdaqfm1XVR/1iAQEsSgSKYDITRCym9rZWO+e6dzozPMpj VVzFmsQyCAEzN+ngIZLcwEaNBH/ZPEPY3Oys2ERwjdy5ahz3lfWX9y43LWZOsQVUlVsd RtRw== 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=km0MgSxm6Kn0tQW3gAMPUaS+5fn6Xw5BCs9fkD362dI=; b=Z8p5sn2feLLri03dsqF438S7bKURwNu7MSfgwDhi4TUCtrOTepaNBPJtFBQYWZYhs7 gaGpcirO0iJ9J/x5wdEOByKPohbWWbbB5TweFpaMURVLHUVvdEqOi5qgdQj9VOa9Swg9 RfGouekZ/CIsu6GnnZWsmfKo/GcvLGat+oKpqX7xnu6ctwbB5kJ+GEFg/wfSXUiu9VGc ORwgk3lj9kDtRtfOYwxQ+jwdxJCMIlmf6fp2ijenq12B5KczWFjhOwtq2s5aMX9Wq+Ol 8Kef9RE4PV6jTAmRVOh4eWRtrhPbaszyWopB5eUaH8BUAUcZ1mO9N0aSCIDdFYn9DP46 iC1A== X-Gm-Message-State: AOAM532IqHNuwWd5BHaZYOMlUGNIJALvx6MhYPvwxuxq7BVV4+GS909T ePDgLmmbia6pM/y2Egx6WcXyFAmb9dI= X-Google-Smtp-Source: ABdhPJwmBeNInp5niZcl5ajw1IzR0VvnCKtsxxm9st4UF73Y2SeBZXGTNR7gjvNTFjDFibgAzaBNng== X-Received: by 2002:a63:d456:: with SMTP id i22mr2296905pgj.421.1631188292229; Thu, 09 Sep 2021 04:51:32 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id n14sm2458225pjm.5.2021.09.09.04.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 04:51:31 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next v2 7/9] mptcp: add a mib for the infinite mapping sending Date: Thu, 9 Sep 2021 19:51:09 +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 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 4ebbbc6f1d01..7036c78ccef2 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1280,6 +1280,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; @@ -1288,6 +1290,7 @@ static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_e mpext->data_len = 0; mpext->csum = 0; + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_INFINITEMAPTX); WRITE_ONCE(msk->snd_infinite_mapping_enable, false); pr_infinite(msk); __mptcp_do_infinite(msk); From patchwork Thu Sep 9 11:51:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12482979 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 BCAE93FE1 for ; Thu, 9 Sep 2021 11:51:34 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id m26so1551370pff.3 for ; Thu, 09 Sep 2021 04:51: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=KYx3YyFoHwDg4nx5uFvbO2npW+beq7yD9VEjzpnMdSw=; b=KWlDzq+hz104k+oXeOveEJnYzZxwmUA05C6m9Jn6+6DESdzkcWa+8ksFF4G8sm/AEn Tv7Ul3WKusyw+ZjTkGBnffkTq/ky/lXxfY2HmE4Ak0ZrWzjf7o3fgeAHMRPrAk3/6iAL mm+gQv/oQJORGPMe6J/LJRCtlEh9mZPfum00aB4Wj7smTC4hPUlNZ8E9mkYAHgVXaXQa FwefGSroqx/nrLDwEflJixi9BaL7Q6ziANz1/JB3dgkkn8uyJgQJFoQSqdrMxH8zhcob 8NrkHU4CSwn/YESinlDC58fY5WH13cgUBRWvyueyLaNNdmdXfJORMOVDCGvqWrXy4mVY rEKw== 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=KYx3YyFoHwDg4nx5uFvbO2npW+beq7yD9VEjzpnMdSw=; b=UqNI7/mCK3fXBmPVwAjbRTqOBD9xKVm8zUV+Gj/BmDDIbfd4tC8gy6RxzayDbLufuB opChXJhIvYLQ1YuDjOKP483HBa/P2TdLJTlWisOzFDXYXytWMMhFj0sOcGwOLcGmp8Hj lQEGYMB53qAbDBD4Agql8KMlZWF6TX3WvuyZTgMQ2QIdmHbM/S6A4wnLni4R38pYDYBo sfknw3vKwugdrzgcdy34WV0W4CG9agViMkgDc6JYF7/ctGqBZs+c28pbcau8iXgm5e2a ce0zln0OgLQcRrSWWUC/MPTqiVWnKAD50DdnIvvGuu6foMFGOIuHJR2W/GPorlcBOv+r eBdw== X-Gm-Message-State: AOAM5312wRpFlxxqr1mRPouRe5Z3DAKmBWpuBrovq1z4sBYL1k5LcZ9r qzeylNkh0arK+13/WHGweowNdAopylo= X-Google-Smtp-Source: ABdhPJzv/eFmcXbclo6ZOIDdYBMffzukdkN3LFAMFZuIvSw01uZ1ri22pU1j2R78BjKNfI70fob8FQ== X-Received: by 2002:a63:480b:: with SMTP id v11mr2276552pga.413.1631188294176; Thu, 09 Sep 2021 04:51:34 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id n14sm2458225pjm.5.2021.09.09.04.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 04:51:33 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next v2 8/9] selftests: mptcp: add infinite map mibs check Date: Thu, 9 Sep 2021 19:51:10 +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 Thu Sep 9 11:51:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12482981 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 B06C63FE1 for ; Thu, 9 Sep 2021 11:51:36 +0000 (UTC) Received: by mail-pf1-f179.google.com with SMTP id x7so1536288pfa.8 for ; Thu, 09 Sep 2021 04:51: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=ERXMsZt9dBtqPWxiTjR++W1FhzEsgxW0jKlViJJF44M=; b=e7e+WgOGLrgkLqh8lhmUHgmsJ6I/6yJDCuCjoXeP+BgNgI/9XWBFkHB4gUebpS5o1e gdqIVOMB9wiWL1kCfkcjh75spppGlROemBbmJNgGLCPazEAe8MOQFQ+KK+8n8JnTK0Uq l4gBtfvRJtYPcpUVVvdiunI0uhCC3a2nvHc2F/3YxWSXNHJhu7XU4H9lQtlWGcozwQ9+ GAcni9q1MCWtmGdmQOoO51wueXiTrdkMBIOpQ7jxdfePrA9iZbuus5xylSdXsnWtM7Oi wXCv8yBFjKfq/gZ+M4+u62rTgoCOKlZCToUFWIkEhJK6qJ/0BCXAitB74VUOsrxiU503 HCRQ== 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=ERXMsZt9dBtqPWxiTjR++W1FhzEsgxW0jKlViJJF44M=; b=QxDOLp+gJNLMwen7m0AbTdY7nMFfrzlaN1c8nqrtdwxXLksaFRb/uK7n/OS+VOGOve iiJTHXHYUlNJklGuHpWV9Zlmctva9MblxsI2uk2Kli914yaOulZnKMWj8j351OCHBdfB 1yk5QPToPEBZTm1a3KHp/0mniZQRI1IaShYRDX9SXXPSTVQvrYpkgGcFeIJuuZK4TtRo ONVBd8JP32l5pz31tqSojx7tGva2bbegE+F7fwhikzoGb9DRtyjwQlYCA5kaNqkkoQWI rsJK2sgzbhBzIPJGfVxQz/cJhxmhb9aq+f/78BU3SDjucnZB4G7zw0ApTjuyMwy6F6RY u/aw== X-Gm-Message-State: AOAM531lPNGw1n4v7FvAWpUY6R8XQmV/F4dNwowz/sqF/vMKWL5MjTzR rBQ/dGPemknosaDbEKCYJcmdsZRCRyo= X-Google-Smtp-Source: ABdhPJxQQSOY+Lub9+8glHP3+wokfs6/8vvCeO/5CJrEZMgIULiL1+GaSvOdFq8bfnON2wdfeMpojw== X-Received: by 2002:a63:204a:: with SMTP id r10mr2293069pgm.365.1631188295874; Thu, 09 Sep 2021 04:51:35 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id n14sm2458225pjm.5.2021.09.09.04.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 04:51:35 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH mptcp-next v2 9/9] DO-NOT-MERGE: mptcp: mp_fail test Date: Thu, 9 Sep 2021 19:51:11 +0800 Message-Id: <5afb788b507a63f31f390c512fb5eedb464dd01e.1631188109.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 7036c78ccef2..10d15e93d70b 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1296,6 +1296,8 @@ static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_e __mptcp_do_infinite(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) @@ -1430,6 +1432,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"