From patchwork Wed Sep 29 07:34:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12524801 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 635A82FB6 for ; Wed, 29 Sep 2021 07:35:14 +0000 (UTC) Received: by mail-pf1-f180.google.com with SMTP id 145so1190828pfz.11 for ; Wed, 29 Sep 2021 00:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4aN8OfYnqeEF8iGzX/EasTFdzOLaFQ2QrlS8HF72xT8=; b=m1EiTqBiaZQ9k/pGJ52R7ariuPic1R1Vun2EK+5iqGclKeJzBULgnraAJnMIKmHHuv hl6zxBGaxc6ThSJxPSRQAzMzPyfWtfmi9obYb1AVxUe+Dni8xCICbmTXHQFTRhTE5nBV zGRdaP/cDK0uPf2S7cNrmtlTNZ1fFr0ZFpW4UKsUBlA1NloKop/rT336bTpaHROFVaTC pS/bAbAAJNaKO9BSin0JglpNvxOPrljSxatE1KqjP0i7xuCnN1YVPW5YrJkS/2VeID+r 6eNJs64Smr+84ZOruK91lz5s5Otw7BEFKSTslsOcgLd3mc/py/f1Ek1HdWI1LpZZoGAQ Ba8w== 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=4aN8OfYnqeEF8iGzX/EasTFdzOLaFQ2QrlS8HF72xT8=; b=gNVe5tvypNHX+O1zZPpcysV5iA2u1SDWZZ9gJnF6wKOMdpTEBp60tH/ezqNTil0BkD vG7uBkZAa3EW7dSPFnzIPVKurBAJjGf2a8wYl6SKo5ht1uylrSUXYbl/2i9GhL4fZ/sh zPFgpUPePDxix5cPEm+G+ZnVcOMLzbecFFje+AYaYykrvf7Th03+Ea29HqqSP/45/xFQ wVsL453odb1wtOAfdS6ft/6VpQ1C/cTu+oayaYyObGGmsnRR622cVXbHVjVNqd7swRg6 R7jut2qCjmKdzcUYfaAMXoxL/PQebBHaVKmZNYk9Dt4xjj3d8y6G2LsAbfcEg+Kd5r8j M3gA== X-Gm-Message-State: AOAM530CuQxrHkU7cgWQB3PGOUjL+u2k1A7p6xChrLXGHcLQFg2CfyP+ bYbnWjf88q433dEWUV3pZE/VdNLnl8nG+g== X-Google-Smtp-Source: ABdhPJylj9/yEb+zeUE9wgf5llrL8XAqWjP/zkNgN0xCtPDhCSQlL5DsVNJ0236FynBdMO1oLvZxuQ== X-Received: by 2002:a62:2f81:0:b0:44b:b390:956b with SMTP id v123-20020a622f81000000b0044bb390956bmr6071043pfv.30.1632900913859; Wed, 29 Sep 2021 00:35:13 -0700 (PDT) Received: from MiBook.mioffice.cn ([209.9.72.212]) by smtp.gmail.com with ESMTPSA id gn11sm937853pjb.36.2021.09.29.00.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 00:35:13 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 1/9] mptcp: don't send RST for single subflow Date: Wed, 29 Sep 2021 15:34:59 +0800 Message-Id: <92a6c95367cac890556d2483ea61d7ef62dceafa.1632900306.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 When a bad checksum is detected and a single subflow is in use, don't send RST + MP_FAIL, send data_ack + MP_FAIL instead. Signed-off-by: Geliang Tang --- net/mptcp/subflow.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 6172f380dfb7..92b45a7c997e 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1167,14 +1167,14 @@ static bool subflow_check_data_avail(struct sock *ssk) /* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { if (mptcp_has_another_subflow(ssk)) { + 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 Wed Sep 29 07:35: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: 12524803 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 F17213FD3 for ; Wed, 29 Sep 2021 07:35:15 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id g13-20020a17090a3c8d00b00196286963b9so3577974pjc.3 for ; Wed, 29 Sep 2021 00:35:15 -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=ec4XA5uZtuPVlcV402fMuaBeA5erYPIiD1DUsMvpDog=; b=BZgYNnlM9+1cj+PUb07BCBvYAXM37VyzUBAs03+fybAauwv57aYDRi1RoSfvIeFG1C lvqGG2gwIzkaYpUlu6V/fqJVl7o6pySWRvfpv2G914ON2eA1MPeB276jqjK0QlbOOyTz btfIPBUee5XZmeB0ZirRi4biSSEEHGs4fRP8ZUwiSsAC7TbOrQCTPrQeynmbPCAOzPlQ zIYi+YnZx3VFKZ4V/2kjC3rawlV1UinxtsHVbjj9T+6lqJGll+Kzkd84Kolp3tw4v6Mz 0fXgYhg7u3gtj+4LFU3HUTxPKsyhKBLGTg8n6xshwmpOim405AYZc3DBGNM4RHvNksXT LDQQ== 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=ec4XA5uZtuPVlcV402fMuaBeA5erYPIiD1DUsMvpDog=; b=aq67RWySBF/zAVmVG80npx7tRfxIk5t8eso57aSQP7FDO9Ikg4hW0ajicoxaxx5n0a oERYPTLxwICh6y2RZtRVz/dZiCetZzw5JQ4HVvmfwsBoNCeswGl4FzZzsA+JjZeS8Tvd dsbf7v+VCQgltdIJJW9L3emH1dbmJ62GwWP7Hed1xnMxnLmLvqVmhzb7riB68oN9+EyP NRRndwcMII2GZ3y+UZNI5oO8UyeW/6Mq+dPF1PqUWD8B+nI7m4AsoEF//ZKIXpFWooZr HJMqHD8d2SJYs5ZIbfE489UkLbLag69JLoxc/y36R4Y6XOIvmS++Qu789GIwHl7qiSHR gwIQ== X-Gm-Message-State: AOAM530li5cVOI8/PhHan7N9lsN2+hKvg673sKNli/mMxGtzMtl3r1Ff zJgeaUEbWFADoQd5IsK3wI8Enlhp3prpyQ== X-Google-Smtp-Source: ABdhPJyfhyBRXpg0GHzgAFRLc1vrqYrxDheS1/trj5w2P9W+F6hlUAw+zaYTRj++QUlw0H4bAOBtBA== X-Received: by 2002:a17:90a:2944:: with SMTP id x4mr4944365pjf.131.1632900915466; Wed, 29 Sep 2021 00:35:15 -0700 (PDT) Received: from MiBook.mioffice.cn ([209.9.72.212]) by smtp.gmail.com with ESMTPSA id gn11sm937853pjb.36.2021.09.29.00.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 00:35:15 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Paolo Abeni Subject: [PATCH mptcp-next v6 2/9] mptcp: add the fallback check Date: Wed, 29 Sep 2021 15:35:00 +0800 Message-Id: <795e3d996791cfb7a45f7d2dc2b4935f1d2b40c2.1632900306.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. Suggested-by: Paolo Abeni Signed-off-by: Geliang Tang --- net/mptcp/subflow.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 92b45a7c997e..87a9ffebcc42 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1164,35 +1164,38 @@ 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)) { + if (!__mptcp_check_fallback(msk)) { + /* RFC 8684 section 3.7. */ + if (subflow->send_mp_fail) { + if (mptcp_has_another_subflow(ssk)) { + 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 Wed Sep 29 07:35: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: 12524805 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 C33273FCB for ; Wed, 29 Sep 2021 07:35:17 +0000 (UTC) Received: by mail-pf1-f180.google.com with SMTP id 145so1190948pfz.11 for ; Wed, 29 Sep 2021 00:35: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=FppAX8eJVMLGTaoQvmG4lm2DAOe5YwddAwcA0vAT0p4=; b=qVmRaOlhls52Gd52XtFm2+pyPgAkWTewY6ytufacweHl15hySVRGe7Kau5axN20j8G HtJQu2WAeY18jHqu+akxgVMNi3CelN48AREL1aC82H287Nv6MFqbx5lOVG0S1lE0Ip32 nD7ftllG5YuTSjQOp0u/bZqKiGUc+bMouLa6ZRgav7oHhIEekVTWiTVg1BwXUcCwjlyv SEVDyiEcW4aZrBAbId6l1x+TqZPvW/HOJqYJ8IBhax1YVNJAiYLlyHls7NuHOSAZ8KSL XwHZdKW3sezqiSEFp97Gms4hdrbugowcjpgHtnf1/Jj3GuF07B2R+lv+eAeQAfFTP0Qo DKcQ== 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=FppAX8eJVMLGTaoQvmG4lm2DAOe5YwddAwcA0vAT0p4=; b=pkooS2lOKSWh8ul8zObpT5Iv/ZVBZUom3fd5pMlDrOgWON9pwdca6gu45MgRUkRXdn pX8v31u42G2Ag83lWkd+ZLBThoeqduexKpo29zwX3386gSgtX5nLC0yhUFUAowI/AMp0 qLQl5S06TdHB9W+AG7YPO3afDB/ivPbPpBe+aJf3N3ps4hIblP/D4vxvN/hAS3uRHx7f oB0bvi5de6q/p0JKD4XyPspQSMMSvuLNCCsl7AeYmbt60rqJbwHuQSf+HqrDE4GoA1P6 dDNoJcuKThr37osHbmWimR9ztPjPxkZQaCBol4oVIajfCdy1EOOpciC6TUZm2r48o2pV CzkA== X-Gm-Message-State: AOAM531716FHQLDpBgHUB1BohtoZsxpT7pXgYgRq47O/PGuh/kqU2Mr3 GZU7cQk8Kc6gr/2f3oPksmvdz+KeBLjSeA== X-Google-Smtp-Source: ABdhPJxGy5d1f2sOd/5CoHmxVhQ/DbSqy66RnXcq0a2ez4P7IeGfsti14lu1YvMHXtTiPtnCeflcGw== X-Received: by 2002:a62:1683:0:b0:3f3:814f:4367 with SMTP id 125-20020a621683000000b003f3814f4367mr9715382pfw.68.1632900917255; Wed, 29 Sep 2021 00:35:17 -0700 (PDT) Received: from MiBook.mioffice.cn ([209.9.72.212]) by smtp.gmail.com with ESMTPSA id gn11sm937853pjb.36.2021.09.29.00.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 00:35:16 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Paolo Abeni Subject: [PATCH mptcp-next v6 3/9] mptcp: track and update contiguous data status Date: Wed, 29 Sep 2021 15:35:01 +0800 Message-Id: <9bed3d49d6b462cebc714587fc48d14402269349.1632900306.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 allow_infinite_fallback in mptcp_sock, which gets initialized to 'true' when the connection begins and is set to 'false' on any retransmit or successful MP_JOIN. Rename the helper function mptcp_is_data_contiguous() to mptcp_allow_infinite_fallback(). In it, only do infinite mapping fallback if there is a single subflow AND there have been no retransmissions AND there have never been any MP_JOINs. Suggested-by: Paolo Abeni Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 2 ++ net/mptcp/protocol.h | 10 +++++++--- net/mptcp/subflow.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index f8ad049d6941..48979cb82126 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); + WRITE_ONCE(msk->allow_infinite_fallback, false); } release_sock(ssk); @@ -2542,6 +2543,7 @@ static int __mptcp_init_sock(struct sock *sk) msk->first = NULL; inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss; WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk))); + WRITE_ONCE(msk->allow_infinite_fallback, true); msk->recovery = false; mptcp_pm_data_init(msk); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 7379ab580a7e..4807e486e762 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -249,6 +249,7 @@ struct mptcp_sock { bool rcv_fastclose; bool use_64bit_ack; /* Set when we received a 64-bit DSN */ bool csum_enabled; + bool allow_infinite_fallback; spinlock_t join_list_lock; struct work_struct work; struct sk_buff *ooo_last_skb; @@ -612,17 +613,20 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk, inet_csk(sk)->icsk_af_ops = ctx->icsk_af_ops; } -static inline bool mptcp_has_another_subflow(struct sock *ssk) +static inline bool mptcp_allow_infinite_fallback(struct sock *ssk) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk), *tmp; struct mptcp_sock *msk = mptcp_sk(subflow->conn); mptcp_for_each_subflow(msk, tmp) { + if (tmp->mp_join) + return false; + if (tmp != subflow) - return true; + return false; } - return false; + return READ_ONCE(msk->allow_infinite_fallback); } void __init mptcp_proto_init(void); diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 87a9ffebcc42..28ed7dc6e170 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1167,7 +1167,7 @@ static bool subflow_check_data_avail(struct sock *ssk) if (!__mptcp_check_fallback(msk)) { /* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { - if (mptcp_has_another_subflow(ssk)) { + if (!mptcp_allow_infinite_fallback(ssk)) { ssk->sk_err = EBADMSG; tcp_set_state(ssk, TCP_CLOSE); subflow->reset_transient = 0; From patchwork Wed Sep 29 07:35: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: 12524807 X-Patchwork-Delegate: mat@martineau.name 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 7E51C3FCB for ; Wed, 29 Sep 2021 07:35:19 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id q23so1200803pfs.9 for ; Wed, 29 Sep 2021 00:35: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=Pom/ZtrOD2M6Ftiy6IIch1Dq64jBCSnUsl5wPAb9gGM=; b=X3Ie37FNvLirRx0wfRRJag/jiO9CTWR9zMjLxriZqsfm9b4OTKfW4PNdpL9jASXgTJ jITE2Bmn7zONkQQe6oF1KqMqxcOJ8pELT1HgyPj3sdhoX773kzzZps1pPxX+2+/a7hvP rSXhMCRDr5tOZS3hbFRSQFGibIsBS3Fp+s1ceIhDsF4mg5EiBOELg43SK20vCtbgC7sf gcWTDqFZ/V9CJpidL+iE6jdQ2UBwtZlIPdKLVqSXfQ6+1w1m8Blo/8zbswY08PjcF5I/ 17fuMs7PvPTVn5xiDKjsFivdOG0HYwwJgurm1nYsSXsvm9IToE9wVxefl2uXjqiPVzbE 2hGA== 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=Pom/ZtrOD2M6Ftiy6IIch1Dq64jBCSnUsl5wPAb9gGM=; b=4scRIVKqw18fqyx0aSHMoemq3AytyFnB+9NDg6VEw3TYpV69nc2vm363DdnozdRGql 38ppgjSKN9PJwgnb8IQvmdQi5WOTXxnslxQbhxFmWsxL9lyilNvzBttzNopBYa4bvLRB G8FRESHZpEIhCDkplUekN7y+8HaSmpmJHSDxrdKz3PB7AlRUKlUg+ZtIDtng8ViAThXk QRuaVgb/Aar53Fhye3LpyX/bu176V5UDNrVj1kDZOfiHUoAKE+MVJ0WtBDvfnPq+ZBXg /KKcOA/ExQSok/zhdfXXMKV2TQpY5+sqPMk5hQBJGOMVzNy1AyghMsMqCmdKT+5Xqmbu LR3w== X-Gm-Message-State: AOAM533YSxhpu+dgaj1GLTaggETeVd9kjBpm8g1Bz5z8sf4Exa53iCru riz5yYApF9169GYdj9L4yyZALxtCz1butA== X-Google-Smtp-Source: ABdhPJyQUviFS1S26ww8/HRLFJl4OKRIhZfaaNi0liFisnlIg5EIBaslZQ3FblFq6DYsg92sMOhlOA== X-Received: by 2002:a63:7447:: with SMTP id e7mr8469274pgn.46.1632900918958; Wed, 29 Sep 2021 00:35:18 -0700 (PDT) Received: from MiBook.mioffice.cn ([209.9.72.212]) by smtp.gmail.com with ESMTPSA id gn11sm937853pjb.36.2021.09.29.00.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 00:35:18 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Paolo Abeni Subject: [PATCH mptcp-next v6 4/9] mptcp: add last_ack_dss_start in the msk Date: Wed, 29 Sep 2021 15:35:02 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch added a new member named last_ack_dss_start to the msk to keep track of the beginning of the last fully-acked data segment. This would be updated in __mptcp_clean_una. Suggested-by: Paolo Abeni 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 48979cb82126..334bbce69fcb 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_ack_dss_start = dfrag->data_seq; dfrag_clear(sk, dfrag); cleaned = true; } @@ -2891,6 +2892,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_ack_dss_start = subflow_req->idsn - 1; if (mp_opt->suboptions & OPTIONS_MPTCP_MPC) { msk->can_ack = true; @@ -3147,6 +3149,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_ack_dss_start, subflow->idsn - 1); mptcp_pm_new_connection(msk, ssk, 0); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 4807e486e762..7927acf53f06 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_ack_dss_start; u64 ack_seq; u64 rcv_wnd_sent; u64 rcv_data_fin_seq; From patchwork Wed Sep 29 07:35: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: 12524809 X-Patchwork-Delegate: mat@martineau.name 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 F0CD03FCB for ; Wed, 29 Sep 2021 07:35:20 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id k23so1019189pji.0 for ; Wed, 29 Sep 2021 00:35: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=sTKax05uNK5ByDTvZtVlCp5fJJbqmfIsYov3HOE/pIo=; b=Yy6mF8tnlTTVgIk34mdeSjlJKhbuJxXjpI2v7Np+hAhTBmbaYVxzzziKhWdEAr/RVJ 6TW3JW58N/rlrRSBS4tLjRKwPTluPLfdZvKxekHAyigqjR9ptEi60bfJPg+dkkpvjJBI 74OP3bxF9Ay0r8mdQI+xQa9I+RoyMnGOOB+OHSCFjOzEwlARbvrpxNxSHqzsaj5BqfUf OFSD+KxHB2euP74cw6GbaWHfvNmSQ972XyuouybQdg0cKVlRN3chN3G0HIFe6TVFXq/J k8Aku44eFXrOwdzeeiPLkBNJv330EGIDhPk8+czdS/Ud/8ILdfvPWld5mt19dTDgpM9b SrGw== 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=sTKax05uNK5ByDTvZtVlCp5fJJbqmfIsYov3HOE/pIo=; b=loYA5fU6jmHCCUedL84uYPADY1I6rk7GC6fmd3xsv3xhhZLcGLiKzlmUUHJc1PZJ4M JXOhZdGtDaGkqWXZSxcIQd1K1dhwHbSXy7SZnnLuabL0Ji9/8GfHGgRwyKPdWUYpDtyT 5Sh9u2TChijC1RdmcTZKtQ9r1caz2WzzhXYHOvTEcjbsSIL3HqWLWHusaw/KjoBGVSy0 p2jZjGhx4ceVf8HRftfyKhqBhLva6onCrQ3wxSSDPK/ZSpKK7emDgxeDIcKkaIT96TvE QSRiQypj3sKCRIX1yQ+kQqq405p/PeeAMUPk+QBih83KrUwguAnh7tapINDZ3Bmk0nMj usTg== X-Gm-Message-State: AOAM5334DwvY55h31JuUh3jQsMsunmXDyP/YgzkrlNxERrRD5AQeG7na YI416Lrbj2tVGFy5GbsWtUSzenGDd9L5Zw== X-Google-Smtp-Source: ABdhPJw4AWxZKKRhZ3jQa9+VifEnO4poVITyVraLBPKnalXSS6NFT0ux62dFn8nbOj9ef2HfOal32g== X-Received: by 2002:a17:90a:ae18:: with SMTP id t24mr4775746pjq.92.1632900920442; Wed, 29 Sep 2021 00:35:20 -0700 (PDT) Received: from MiBook.mioffice.cn ([209.9.72.212]) by smtp.gmail.com with ESMTPSA id gn11sm937853pjb.36.2021.09.29.00.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 00:35:20 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Paolo Abeni Subject: [PATCH mptcp-next v6 5/9] mptcp: infinite mapping sending Date: Wed, 29 Sep 2021 15:35:03 +0800 Message-Id: <2128ccf27ebb66936b4a908dd5704dd7d7c72807.1632900306.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. Suggested-by: Paolo Abeni Signed-off-by: Geliang Tang --- include/net/mptcp.h | 3 ++- net/mptcp/options.c | 2 +- net/mptcp/pm.c | 5 +++++ net/mptcp/protocol.c | 19 +++++++++++++++++++ net/mptcp/protocol.h | 12 ++++++++++++ 5 files changed, 39 insertions(+), 2 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..f4591421ed22 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -816,7 +816,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, opts->suboptions = 0; - if (unlikely(__mptcp_check_fallback(msk))) + if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb))) return false; if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 6ab386ff3294..5b99c0c9c17e 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -251,7 +251,12 @@ 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); + pr_debug("fail_seq=%llu", fail_seq); + + if (mptcp_allow_infinite_fallback(sk)) + subflow->send_infinite_map = 1; } /* path manager helpers */ diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 334bbce69fcb..5b73493c75c5 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->last_ack_dss_start); + 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 7927acf53f06..9da4dd3b2e2d 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 */ @@ -872,6 +873,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 Wed Sep 29 07:35: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: 12524811 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.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 71DD93FCB for ; Wed, 29 Sep 2021 07:35:22 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id y8so1203538pfa.7 for ; Wed, 29 Sep 2021 00:35: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=tAskNLE7Qo/f0tL7J7L9HMpHqNwlTRqMapHbxJbOPDA=; b=QQgJNh57RTDL7Cv1o5cgRyQGCQAPhdMC82+n5HQNBPVtDu9cMa3pyFgpErOh/Gf8A3 cC6bPSRmCL7DeIoI6baRpHByDmJezAkcGh2vQ+UIrtH4ldxJviRjOZdsvGfsluLrTUUf 4PlKXyniqEb3zrVFMl3qC8dRGW6xfQbi52olOS+clcLSPyOSIEWItSlzklW2R4d77WNN Z1gpOGYXUP7l2hoCdsoX6r11Pq9rElOLItQEGB5oLL6C7J6ruy6CUAID9wki63sndrz4 b8X45l6b2eMZbpBiGZvQVIRLrHtESGLz6fvifabDZk0xoaeERMEhKxNo5s0HmZifho5o gCDw== 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=tAskNLE7Qo/f0tL7J7L9HMpHqNwlTRqMapHbxJbOPDA=; b=VcxsPBz1mjvlM7YTHMYUTan+wFlmyEzqbPiRAha3aqsqoiiV6cpYORIuDDlFFxwdJT COZp+M62uXvaQZuJ0Nqzs3pcK4YX1g7Q5NsjV+e+zs3+f+mwODYrnZB5XHnxFjtIhS2o zvXnT1tmdlrzcmsyVhFndVawHRfjKxWWMpkcznPvgNeOzhLRfk7Bi8cFVOMPnC5K380y VdFiPjpDx+mRCU2R+LMeW49+Iu8r6IjABhb/VbTmR/CnjHvg44mtiHvjM1fJTC48BPHG hgvpeQioz4MbePC9RM4MkcWS+OP33/VmgNJgMvte+I9HL3kBqb70eCESw48jgJmDdVxf IBBA== X-Gm-Message-State: AOAM533zrIsikG9XB2wGBBCIYDaZFN54niLRQGUQ6Zj7cmqx1DdjjT8D 4lzRPPcI83IcDhc20bAFlbNETRtAMxyk/A== X-Google-Smtp-Source: ABdhPJwpvIUkugC8PPnbUc2lizhsgU2aKmiCHVvFZeEM0toU/RXDETMIuq0F5chhFFCtGPTiYnSzCg== X-Received: by 2002:aa7:93c9:0:b0:43c:f4f5:aac2 with SMTP id y9-20020aa793c9000000b0043cf4f5aac2mr9519013pff.11.1632900921916; Wed, 29 Sep 2021 00:35:21 -0700 (PDT) Received: from MiBook.mioffice.cn ([209.9.72.212]) by smtp.gmail.com with ESMTPSA id gn11sm937853pjb.36.2021.09.29.00.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 00:35:21 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Paolo Abeni Subject: [PATCH mptcp-next v6 6/9] mptcp: infinite mapping receiving Date: Wed, 29 Sep 2021 15:35:04 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. Suggested-by: Paolo Abeni 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 28ed7dc6e170..101bfa277a1c 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 Wed Sep 29 07:35: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: 12524813 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 DF69F3FCB for ; Wed, 29 Sep 2021 07:35:23 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id u1-20020a17090ae00100b0019ec31d3ba2so3583754pjy.1 for ; Wed, 29 Sep 2021 00:35:23 -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=tuwqbiF6/k1+Q/wz49ROuB/yxwKpmTAnGTACC3OY5y8=; b=GLdcZmQGcmOf6OuP0GUlg4XQ4dGtxLmVsejTD6rL7OwimFTr0ls8k08rV11ShBnmJA 8fkQKS5cEHGliTJ+HbQHMZcXFZhcAFdcgTWvuC+n23pOtnTHTPS+7M1kOtpg1tj0xhC+ tZvc+w29oiMWOE8s/beYFtBQ6kM2ppGO6V6a5y+pu63q3L5AbuXdjZBxMXqcYXM6vKBq /Bh02viu9xZ9Akjcf41yRCSaCdbEmHL9nmUaAXqGkuJ4Vhi1ph1f/jwKRj/Iwj/7O0WG JtHsi+ukIadHeCf+hHbypnXBoxYeHy+2gUi/77MgyK6teUqutO9fFrVy2//FEtVW/1e1 KnAg== 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=tuwqbiF6/k1+Q/wz49ROuB/yxwKpmTAnGTACC3OY5y8=; b=6mZi07tALDVkm3mX3HMNkJKZU2irZTCgkEW9hv5QxFpzPrNwz9rkj0me9osvZ15UhP bL6H9BmUguIA1q3nR3gd1GgLp77gCbYMnuZKxpIIc++VZbKCSLyXxTn7bzz+7U9jMTfX m0lf1JLivKugVE4pEQQFXAA/iQhgK8qWO+VZyvOcktuq7D0qP6zMdX54QHEOFawQbjNk xm01lWjHNYAdLMmnqKiIygZdQ3XjW3JCr6aAkiibZ6S5PoQrSlUTWkWbESI/1LwTrHoM G3AtzDfxPtp8sjtINiehqowUdEpUQXgM0jdYtCvJ+1zeKCZM94InDHCDKUJO1NZwXcn+ 50+w== X-Gm-Message-State: AOAM5330pPuHwho4OnjPpL1RgTMSHVP15/OdBeDi1TH0kVacegaYeKm5 PoymEZ0oQGrdQses2igpz7NSK9xABB21Iw== X-Google-Smtp-Source: ABdhPJxRkpCzjwD+O5LY6U/nukuxEn81U2cNcQnR5ex+pi6CC1DKGl6d8BK49/78v2PjSLUc2WQakw== X-Received: by 2002:a17:90a:d701:: with SMTP id y1mr4772434pju.213.1632900923369; Wed, 29 Sep 2021 00:35:23 -0700 (PDT) Received: from MiBook.mioffice.cn ([209.9.72.212]) by smtp.gmail.com with ESMTPSA id gn11sm937853pjb.36.2021.09.29.00.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 00:35:23 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 7/9] mptcp: add mib for infinite map sending Date: Wed, 29 Sep 2021 15:35:05 +0800 Message-Id: <1092ae72c80b5607995dc42b564c72270841ede9.1632900306.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 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 5b73493c75c5..5122c4ea4350 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 Wed Sep 29 07:35: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: 12524815 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.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 252DF3FCB for ; Wed, 29 Sep 2021 07:35:25 +0000 (UTC) Received: by mail-pf1-f177.google.com with SMTP id k17so1204624pff.8 for ; Wed, 29 Sep 2021 00:35: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=VkKzUiWsVaredgIGXg1iu5+B3Z7qsRltK25YrnE3fbY=; b=ekgarpMy0poW6zpROjSVieyMNTCfAsHscfi3cNY9wIswAhFCqq5XjJpvSxjRnPgZps J0Uzvv+vng1YW09/VoqjTkJSx4NhJTnUn4ykcmK44nzoeYAH0hKOITB3I6ATodKR9i4z WIfMaE0wW+wXfnKJAc1ZNhaa5E2X+RPRgLEJXW6ejwHLvTfl7xOkWMD/iMUYXguDTfIl wfU6PO2zQcHscc0IC2YDWPk740Gvm/jXFD1nVqIORcV9jWBg2zOBOW5T0UESadSVDPO/ avMhdwZst7H/Y5DvYAaf1VOp0ZHPijqu2YKUD/GFlLZrgj/9ejoiLkzBzmguJ+fwCeuH 5sVQ== 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=aRE+gXRZ2gUMAsH/bYZk8If0EalNvRa6zJncgzxxENtOgC/BEvWBanWME7/yIkRAWA wtJBvGzSnaIvhwQoBXEFTmqMdp8SLNouW87T0RDrK8FeBLC8HVlZHGKWciFdkH3NswXs ZRCmcVGOlZUYNPzVIjjDqjiuEqAhxxO+XeoixujHzorKITyznYnk0y3MddN8rc83wa7a tWF0I+iAPGuzjcnuAdzkO9nzIzzuKd5DO4LreW2ZDfNvFwYYxrOHSTFUwYRrHRiAI7Rn 6XKYG83AfjhTodPfKL7qOQ/Cv3wFUggvj5wcuAIFpk8IVtwb6v6N3BbLhDg5nhvijhX9 VIyA== X-Gm-Message-State: AOAM531ijiuUqqVHzi9nV4RzQuQBbQQuoKZJGbXOzl0ZMlaojOU4PMNd 48HxHxG2U8YKfvWPLnLhv0uS82GzbjJyVw== X-Google-Smtp-Source: ABdhPJxqhYZmqrDwZG41HN7w3i0WfIEziaDpUxeh+ubBTe7FNaKLI9tjLL/wKHmSlQPqSkgs1TR7yg== X-Received: by 2002:a62:641:0:b0:44b:74bb:294c with SMTP id 62-20020a620641000000b0044b74bb294cmr9627587pfg.12.1632900924646; Wed, 29 Sep 2021 00:35:24 -0700 (PDT) Received: from MiBook.mioffice.cn ([209.9.72.212]) by smtp.gmail.com with ESMTPSA id gn11sm937853pjb.36.2021.09.29.00.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 00:35:24 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 8/9] selftests: mptcp: add infinite map mibs check Date: Wed, 29 Sep 2021 15:35:06 +0800 Message-Id: <0631510c298457e2436d854762a0004e8fa92030.1632900306.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 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 Wed Sep 29 07:35: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: 12524817 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.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 746B93FCB for ; Wed, 29 Sep 2021 07:35:26 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id y1so896894plk.10 for ; Wed, 29 Sep 2021 00:35: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=D1czgHb4cqajH/gvizEF6+XERd/QJi5ZDToHi+OE9hM=; b=ZnDQTgs81IdWfWskA+NAcKbgVzYiRHa/wH1YlbtvkY1nSO0dwob2OxZrhvBT0agi8U BnZmkHF9EgiE4/IR2eCeQAS3eaZHT7IAnZZGudlEAaKYnTa0tq5jhS1JpEu98iSLFhh8 1IisqwsO16tKd8nQX88PCfOELzmDsZyqwcNMw0ZxiQcG1A+6fSl1NIW0mwGJvWYck9Dp vTycjVoYQtpbCT/sOOIU41YU9wducjt5fKTaG60Bc6NsNbVrmnww7t8+eDADxod3PTad EAvOl2ADbkhdjYiYNPeYbP/hDVyv44TqqfkLXdNUz2C64BGS8TNw4S2QNQiOUIN8gnsq jUOA== 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=D1czgHb4cqajH/gvizEF6+XERd/QJi5ZDToHi+OE9hM=; b=Ilia9pLSxag22gxc+wJsFvGBOKhOGUy9cvkYXfBxoKV4Tj6yMKCt+wHLiNnlk00/gR IdZ9FPtr7n1nA8ldcu5KYZ6hkBwzu897VC4lkVxYbmb0LFN6hdZw9kZP07fWsKN7cVQe H3LEYJl4d9Kpq9CW5EEeK5R0eWosIjJFpUydo1h+5ynXvHr04LVu2MpOuoKf63hG8vLK fZhUEl/v5PVamKLZjxya623JS6aIFxhr/m2f6k6c3B/y10tbYjJPXSCvr+xG46SuiNwY Ql7jlm/wWjv4gmnk5S7970OWgs+5TWQhyrdrfHyAgU/K0mlGlumwkBr57IRrgHYmWsAm 4SHw== X-Gm-Message-State: AOAM532LZCEbxHNOZP+Y/kKG+AtlwYLkabhUbhM3vYn6aCumwGQKeSlX 0ZW90CzlJ0R7zA+uOHbTJ5FUFwTQzaIH3A== X-Google-Smtp-Source: ABdhPJy5qLO4nUIdv7Ifk8SQLT+Sxxoz63rSB1/E1IVz7tLCOd6pM7TwJBrMLFaFbWzIUSbIG+EwOg== X-Received: by 2002:a17:902:8488:b029:129:97e8:16e7 with SMTP id c8-20020a1709028488b029012997e816e7mr8876300plo.39.1632900925942; Wed, 29 Sep 2021 00:35:25 -0700 (PDT) Received: from MiBook.mioffice.cn ([209.9.72.212]) by smtp.gmail.com with ESMTPSA id gn11sm937853pjb.36.2021.09.29.00.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 00:35:25 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 9/9] DO-NOT-MERGE: mptcp: mp_fail test Date: Wed, 29 Sep 2021 15:35:07 +0800 Message-Id: <7c583cc5d31ad60063ea3a6b81e8cd60248c5dbd.1632900306.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 5122c4ea4350..d3b9f6894eb1 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"