From patchwork Thu Feb 3 01:03:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12733692 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 653AEC433F5 for ; Thu, 3 Feb 2022 01:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348719AbiBCBDu (ORCPT ); Wed, 2 Feb 2022 20:03:50 -0500 Received: from mga17.intel.com ([192.55.52.151]:7851 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235856AbiBCBDt (ORCPT ); Wed, 2 Feb 2022 20:03:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643850229; x=1675386229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/9eQohXqMEYwESVU7hdbMNneG33BX8HfDAWFeLSdjic=; b=d21ompxF2k3uHADIBFvdwsEeqbdMJHmjU8peHEcwjIf6v+566OzXpAjf O48uagB4HsQWnZb10eqMNJ0yLFqq/ZslnfQsMbPLj/+rinfn7CSLT+rcX H0DShnIx7HHq3Lz5nbVVBtcywyu2ew5E6AOyLjdBvF9+DL/baowlBRI84 HqPlF9uWm91fSSatvFhynDF6KP/7+gtuXH68SW0wSAXR8Stk6ClbEKEfV Xi3puuMNvG01gJBTcGtuV3zdAjFIuo2zQ8BZvdr50l/GhP6zDIfYVyawR lXDtk5vMyrrboOmBGktoQwwhDfkVnTzT0PSr8R4hqe+G+IKf4d7bvjrMZ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10246"; a="228708714" X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="228708714" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="483070828" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.251.1.6]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:48 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Geliang Tang , davem@davemloft.net, kuba@kernel.org, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 1/7] mptcp: move the declarations of ssk and subflow Date: Wed, 2 Feb 2022 17:03:37 -0800 Message-Id: <20220203010343.113421-2-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> References: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang Move the declarations of ssk and subflow in MP_FAIL and MP_PRIO to the beginning of the function mptcp_write_options(). Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau --- net/mptcp/options.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 645dd984fef0..5d0b3c3e4655 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1264,10 +1264,10 @@ static u16 mptcp_make_csum(const struct mptcp_ext *mpext) void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, struct mptcp_out_options *opts) { - if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { - const struct sock *ssk = (const struct sock *)tp; - struct mptcp_subflow_context *subflow; + const struct sock *ssk = (const struct sock *)tp; + struct mptcp_subflow_context *subflow; + if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { subflow = mptcp_subflow_ctx(ssk); subflow->send_mp_fail = 0; @@ -1489,9 +1489,6 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, } if (OPTION_MPTCP_PRIO & opts->suboptions) { - const struct sock *ssk = (const struct sock *)tp; - struct mptcp_subflow_context *subflow; - subflow = mptcp_subflow_ctx(ssk); subflow->send_mp_prio = 0; From patchwork Thu Feb 3 01:03:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12733694 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FAA8C433F5 for ; Thu, 3 Feb 2022 01:03:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348723AbiBCBDx (ORCPT ); Wed, 2 Feb 2022 20:03:53 -0500 Received: from mga17.intel.com ([192.55.52.151]:7851 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239692AbiBCBDt (ORCPT ); Wed, 2 Feb 2022 20:03:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643850229; x=1675386229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z9FXdFRTATWnPkR8TDxvMrnTWTylwxTAHt4sB0od7FY=; b=RViILbysVxqTvz4bL7hcjMuAiznCdDssOi91JovFjCsjM39n9OO38c2w qlkmWuJ/VLZG/cg3HdA/M4OjCi4Smp49Wtc/7JKnhCproflUKLJFX1yek kjrsludDMW6/J/Tz0eZFh8D3dQZ/BLQf4BQQJ5bZFdlh4sOiAaRn1cA5U EQMWNqRECUc/xb2u9EyZzY1Y9vTq1lTGzAQjs+ThPgaep63Ga33zwGVJD GIWXCPfB5CSMuj0lIln/zztHEwkQEOak3eOy+0KDdBD3/jLwyOq/a9NhH glDRgFOrdomv7sRp+kZDCeOcRJEny6chQGmOv/SoxDZk2G2nxCNFTQSA7 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10246"; a="228708715" X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="228708715" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="483070829" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.251.1.6]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:48 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Matthieu Baerts , davem@davemloft.net, kuba@kernel.org, mptcp@lists.linux.dev, Geliang Tang , Mat Martineau Subject: [PATCH net-next 2/7] mptcp: reduce branching when writing MP_FAIL option Date: Wed, 2 Feb 2022 17:03:38 -0800 Message-Id: <20220203010343.113421-3-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> References: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Matthieu Baerts MP_FAIL should be use in very rare cases, either when the TCP RST flag is set -- with or without an MP_RST -- or with a DSS, see mptcp_established_options(). Here, we do the same in mptcp_write_options(). Co-developed-by: Geliang Tang Signed-off-by: Geliang Tang Signed-off-by: Matthieu Baerts Signed-off-by: Mat Martineau --- net/mptcp/options.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 5d0b3c3e4655..ab054c389a5f 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1267,17 +1267,6 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, const struct sock *ssk = (const struct sock *)tp; struct mptcp_subflow_context *subflow; - if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { - subflow = mptcp_subflow_ctx(ssk); - subflow->send_mp_fail = 0; - - *ptr++ = mptcp_option(MPTCPOPT_MP_FAIL, - TCPOLEN_MPTCP_FAIL, - 0, 0); - put_unaligned_be64(opts->fail_seq, ptr); - ptr += 2; - } - /* DSS, MPC, MPJ, ADD_ADDR, FASTCLOSE and RST are mutually exclusive, * see mptcp_established_options*() */ @@ -1336,6 +1325,10 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, } ptr += 1; } + + /* We might need to add MP_FAIL options in rare cases */ + if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) + goto mp_fail; } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { u8 len, flag = MPTCP_CAP_HMAC_SHA256; @@ -1476,6 +1469,21 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, put_unaligned_be64(opts->rcvr_key, ptr); ptr += 2; + if (OPTION_MPTCP_RST & opts->suboptions) + goto mp_rst; + return; + } else if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { +mp_fail: + /* MP_FAIL is mutually exclusive with others except RST */ + subflow = mptcp_subflow_ctx(ssk); + subflow->send_mp_fail = 0; + + *ptr++ = mptcp_option(MPTCPOPT_MP_FAIL, + TCPOLEN_MPTCP_FAIL, + 0, 0); + put_unaligned_be64(opts->fail_seq, ptr); + ptr += 2; + if (OPTION_MPTCP_RST & opts->suboptions) goto mp_rst; return; From patchwork Thu Feb 3 01:03:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12733695 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A86EC433FE for ; Thu, 3 Feb 2022 01:03:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348724AbiBCBDz (ORCPT ); Wed, 2 Feb 2022 20:03:55 -0500 Received: from mga17.intel.com ([192.55.52.151]:7851 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346026AbiBCBDu (ORCPT ); Wed, 2 Feb 2022 20:03:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643850230; x=1675386230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Lx38d9fhYiCL1gyKi+5TqLDwjarXqB2FJolRnno2uwY=; b=TlkD2zpgtchD5CfgsR1TZ/f189OAnzvzkDE5HhR095TDXXuExHuabUw8 tS3iwgw15Zh8mE/lyVx+vDMvgdfAmG/+g70wIDUR1w3ZhmGdQZutAQ+iC ibaN3PEnSbU3satdaBbaUDLplAUAS4GNB3Z+f4mxGZmPmVbeNIJd9zYEM YRI7vnPlkMWJ+r0U24Nf13P8UEBEKanzyKNVXBU3NyuXBOJyTsgx5/3KE 8dRC/6i0kX5XHtmtWa1u5MU/SLOU8d+XD21DC9poMNpJ0SJjkkisoXpVr KVQy001fBsV3u/UXMUOkr/VM/kQH0cueAUgDTiaMlNGaTnp7Q5J7nW765 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10246"; a="228708716" X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="228708716" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="483070830" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.251.1.6]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:48 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Matthieu Baerts , davem@davemloft.net, kuba@kernel.org, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 3/7] mptcp: clarify when options can be used Date: Wed, 2 Feb 2022 17:03:39 -0800 Message-Id: <20220203010343.113421-4-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> References: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Matthieu Baerts RFC8684 doesn't seem to clearly specify which MPTCP options can be used together. Some options are mutually exclusive -- e.g. MP_CAPABLE and MP_JOIN --, some can be used together -- e.g. DSS + MP_PRIO --, some can but we prefer not to -- e.g. DSS + ADD_ADDR -- and some have to be used together at some points -- e.g. MP_FAIL and DSS. We need to clarify this as a base before allowing other modifications. For example, does it make sense to send a RM_ADDR with an MPC or MPJ? This remains open for possible future discussions. Signed-off-by: Matthieu Baerts Signed-off-by: Mat Martineau --- net/mptcp/options.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index ab054c389a5f..7345f28f3de1 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1267,8 +1267,27 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, const struct sock *ssk = (const struct sock *)tp; struct mptcp_subflow_context *subflow; - /* DSS, MPC, MPJ, ADD_ADDR, FASTCLOSE and RST are mutually exclusive, - * see mptcp_established_options*() + /* Which options can be used together? + * + * X: mutually exclusive + * O: often used together + * C: can be used together in some cases + * P: could be used together but we prefer not to (optimisations) + * + * Opt: | MPC | MPJ | DSS | ADD | RM | PRIO | FAIL | FC | + * ------|------|------|------|------|------|------|------|------| + * MPC |------|------|------|------|------|------|------|------| + * MPJ | X |------|------|------|------|------|------|------| + * DSS | X | X |------|------|------|------|------|------| + * ADD | X | X | P |------|------|------|------|------| + * RM | C | C | C | P |------|------|------|------| + * PRIO | X | C | C | C | C |------|------|------| + * FAIL | X | X | C | X | X | X |------|------| + * FC | X | X | X | X | X | X | X |------| + * RST | X | X | X | X | X | X | O | O | + * ------|------|------|------|------|------|------|------|------| + * + * The same applies in mptcp_established_options() function. */ if (likely(OPTION_MPTCP_DSS & opts->suboptions)) { struct mptcp_ext *mpext = &opts->ext_copy; From patchwork Thu Feb 3 01:03:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12733693 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDE8AC433EF for ; Thu, 3 Feb 2022 01:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348722AbiBCBDw (ORCPT ); Wed, 2 Feb 2022 20:03:52 -0500 Received: from mga06.intel.com ([134.134.136.31]:6288 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237577AbiBCBDt (ORCPT ); Wed, 2 Feb 2022 20:03:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643850229; x=1675386229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7X+m5cdLWaZh4tYFJBJ/dkJI7qFZSYhYD4KmzoHQe1g=; b=oKqFtF5VJ5jKsMYdc4DSg9vm72hwPrjRXLP/2vMVIWd4Ia0h35AcwTEV vKpCd4lDW/LB00cMFCtV7jdO082esN7UmUqXjyOnbxicZr1BMrk2aHGkT HrmVoMQsnNE4P3mz1rLpCF+W3Yc2n45WEYpNklHgjs18/IhQwM0dLdZww aCWOuHaM03jkLr8/bvqeOYUjU55IK1tuMv+5gQyqn+MreBfsDHU9pv70g SW8+31DzP8ZoIWkoIuNLAhoPIkX1nOQkz85Kbub0F6vlGKE8TbAjorqR6 kUXWTNaD8oJulPptL8Cf9vwNHKMh5wPM6psXVS1WoyT/73sBiqKuw//ju g==; X-IronPort-AV: E=McAfee;i="6200,9189,10246"; a="308782832" X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="308782832" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="483070831" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.251.1.6]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:48 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Geliang Tang , davem@davemloft.net, kuba@kernel.org, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 4/7] mptcp: print out reset infos of MP_RST Date: Wed, 2 Feb 2022 17:03:40 -0800 Message-Id: <20220203010343.113421-5-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> References: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch printed out the reset infos, reset_transient and reset_reason, of MP_RST in mptcp_parse_option() to show that MP_RST is received. Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau --- net/mptcp/options.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 7345f28f3de1..3e82ac24d548 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -336,6 +336,8 @@ static void mptcp_parse_option(const struct sk_buff *skb, flags = *ptr++; mp_opt->reset_transient = flags & MPTCP_RST_TRANSIENT; mp_opt->reset_reason = *ptr; + pr_debug("MP_RST: transient=%u reason=%u", + mp_opt->reset_transient, mp_opt->reset_reason); break; case MPTCPOPT_MP_FAIL: From patchwork Thu Feb 3 01:03:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12733696 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36DE1C433EF for ; Thu, 3 Feb 2022 01:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348734AbiBCBD4 (ORCPT ); Wed, 2 Feb 2022 20:03:56 -0500 Received: from mga06.intel.com ([134.134.136.31]:6288 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348704AbiBCBDu (ORCPT ); Wed, 2 Feb 2022 20:03:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643850230; x=1675386230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FC2LolPe1mWrv7RSaMwzaULMsfbrfUJRBuphqssZXwY=; b=K/z0lM44rWT8roh/DlMiVmD0Hrd96lyyFMVqx9z7qBmjAfH6h/aYAq5Y uz7FAEjRWztL3Tt29QXF2W5skg+1H++dCvRAb5Xq3srKE2qGkwlLy02OJ YoGPk+CmKmOtGk7eiwfkO2gu19VYGpnakfRy9v1n121y4sPLVADYETsgT o72A3K9AtR3/HeH4ES+AF4ni9HepKT8+4VzcOw21P7KFJzXJXR3XkvCsj OCd8N7ojDlvpJ5KfXhnid7S18jrTXVAEDfjggXwRxPoK+EhW2VzTAWXm8 wKHazTZW0Jc4kQst+NQy9BhRwfOAz3dlQS7j+N2OVp5HSY/G7Vv0uBnw1 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10246"; a="308782833" X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="308782833" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="483070832" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.251.1.6]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Geliang Tang , davem@davemloft.net, kuba@kernel.org, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Paolo Abeni , Mat Martineau Subject: [PATCH net-next 5/7] mptcp: set fullmesh flag in pm_netlink Date: Wed, 2 Feb 2022 17:03:41 -0800 Message-Id: <20220203010343.113421-6-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> References: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch added the fullmesh flag setting support in pm_netlink. If the fullmesh flag of the address is changed, remove all the related subflows, update the fullmesh flag and create subflows again. Acked-by: Paolo Abeni Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau --- net/mptcp/pm_netlink.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 782b1d452269..d47795748ad7 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1728,9 +1728,20 @@ mptcp_nl_cmd_get_limits(struct sk_buff *skb, struct genl_info *info) return -EMSGSIZE; } -static int mptcp_nl_addr_backup(struct net *net, - struct mptcp_addr_info *addr, - u8 bkup) +static void mptcp_pm_nl_fullmesh(struct mptcp_sock *msk, + struct mptcp_addr_info *addr) +{ + struct mptcp_rm_list list = { .nr = 0 }; + + list.ids[list.nr++] = addr->id; + + mptcp_pm_nl_rm_subflow_received(msk, &list); + mptcp_pm_create_subflow_or_signal_addr(msk); +} + +static int mptcp_nl_set_flags(struct net *net, + struct mptcp_addr_info *addr, + u8 bkup, u8 changed) { long s_slot = 0, s_num = 0; struct mptcp_sock *msk; @@ -1744,7 +1755,10 @@ static int mptcp_nl_addr_backup(struct net *net, lock_sock(sk); spin_lock_bh(&msk->pm.lock); - ret = mptcp_pm_nl_mp_prio_send_ack(msk, addr, bkup); + if (changed & MPTCP_PM_ADDR_FLAG_BACKUP) + ret = mptcp_pm_nl_mp_prio_send_ack(msk, addr, bkup); + if (changed & MPTCP_PM_ADDR_FLAG_FULLMESH) + mptcp_pm_nl_fullmesh(msk, addr); spin_unlock_bh(&msk->pm.lock); release_sock(sk); @@ -1761,6 +1775,8 @@ static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info) struct mptcp_pm_addr_entry addr = { .addr = { .family = AF_UNSPEC }, }, *entry; struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR]; struct pm_nl_pernet *pernet = genl_info_pm_nl(info); + u8 changed, mask = MPTCP_PM_ADDR_FLAG_BACKUP | + MPTCP_PM_ADDR_FLAG_FULLMESH; struct net *net = sock_net(skb->sk); u8 bkup = 0, lookup_by_id = 0; int ret; @@ -1783,15 +1799,18 @@ static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info) spin_unlock_bh(&pernet->lock); return -EINVAL; } + if ((addr.flags & MPTCP_PM_ADDR_FLAG_FULLMESH) && + (entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) { + spin_unlock_bh(&pernet->lock); + return -EINVAL; + } - if (bkup) - entry->flags |= MPTCP_PM_ADDR_FLAG_BACKUP; - else - entry->flags &= ~MPTCP_PM_ADDR_FLAG_BACKUP; + changed = (addr.flags ^ entry->flags) & mask; + entry->flags = (entry->flags & ~mask) | (addr.flags & mask); addr = *entry; spin_unlock_bh(&pernet->lock); - mptcp_nl_addr_backup(net, &addr.addr, bkup); + mptcp_nl_set_flags(net, &addr.addr, bkup, changed); return 0; } From patchwork Thu Feb 3 01:03:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12733697 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5F20C4332F for ; Thu, 3 Feb 2022 01:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348735AbiBCBD4 (ORCPT ); Wed, 2 Feb 2022 20:03:56 -0500 Received: from mga06.intel.com ([134.134.136.31]:6288 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235383AbiBCBDu (ORCPT ); Wed, 2 Feb 2022 20:03:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643850230; x=1675386230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fiZ8lVR6tJKIp1bjE+ooOoXrIV+2sSrB3mNK93hMjhE=; b=LFLD6w2sDxeiiGJW21q96Q+TxJbdoKRuD259D1/TwWyl+PUVc40KBr3w 0era9KSYk7UI50zlFKCWWtc6Rh80N/rNndB1DoZj5/zvME3nyHy90/GCV L7FoK/Uc4umwMTMaSmiSBQRReVakrWUEfCNG4vWtnZwcPthqiaJjdzlwu v8LXHkhKLXTAwDPPWeiQqAWyh4l/XL0But0nBWv03Yzjd0xvzcjKdAD/X WLUtvHa6QUC1xaW22BJ0KUYNhdL+jW9zHSf/pBiZMjk5QlgI/lB/4s7e8 D8I/0iWmFsZQxkGkJPihG+ZvxpI9ISXIaxsScNdtPK2OaOZRl2NgimKTB g==; X-IronPort-AV: E=McAfee;i="6200,9189,10246"; a="308782834" X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="308782834" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="483070834" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.251.1.6]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Geliang Tang , davem@davemloft.net, kuba@kernel.org, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Paolo Abeni , Mat Martineau Subject: [PATCH net-next 6/7] selftests: mptcp: set fullmesh flag in pm_nl_ctl Date: Wed, 2 Feb 2022 17:03:42 -0800 Message-Id: <20220203010343.113421-7-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> References: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch added the fullmesh flag setting and clearing support in pm_nl_ctl: # pm_nl_ctl set ip flags fullmesh # pm_nl_ctl set ip flags nofullmesh Acked-by: Paolo Abeni Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau --- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c index 354784512748..152b84e44d69 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -28,7 +28,7 @@ static void syntax(char *argv[]) fprintf(stderr, "\tadd [flags signal|subflow|backup|fullmesh] [id ] [dev ] \n"); fprintf(stderr, "\tdel []\n"); fprintf(stderr, "\tget \n"); - fprintf(stderr, "\tset [flags backup|nobackup]\n"); + fprintf(stderr, "\tset [flags backup|nobackup|fullmesh|nofullmesh]\n"); fprintf(stderr, "\tflush\n"); fprintf(stderr, "\tdump\n"); fprintf(stderr, "\tlimits [ ]\n"); @@ -704,12 +704,14 @@ int set_flags(int fd, int pm_family, int argc, char *argv[]) if (++arg >= argc) error(1, 0, " missing flags value"); - /* do not support flag list yet */ for (str = argv[arg]; (tok = strtok(str, ",")); str = NULL) { if (!strcmp(tok, "backup")) flags |= MPTCP_PM_ADDR_FLAG_BACKUP; - else if (strcmp(tok, "nobackup")) + else if (!strcmp(tok, "fullmesh")) + flags |= MPTCP_PM_ADDR_FLAG_FULLMESH; + else if (strcmp(tok, "nobackup") && + strcmp(tok, "nofullmesh")) error(1, errno, "unknown flag %s", argv[arg]); } From patchwork Thu Feb 3 01:03:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12733698 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81E73C433F5 for ; Thu, 3 Feb 2022 01:03:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237577AbiBCBD5 (ORCPT ); Wed, 2 Feb 2022 20:03:57 -0500 Received: from mga06.intel.com ([134.134.136.31]:6290 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233773AbiBCBDu (ORCPT ); Wed, 2 Feb 2022 20:03:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643850230; x=1675386230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dTssO73r57l66jd0hPRkCO1bthWlqOWmAdYmrq+iykY=; b=ZEOSA6LuJIHeLPHbAz4onSybvt4CAEn/cK84xLnwM+oo5xDBjtVP8wjW dNIkbyGjq1Rbm9G4StOWQMgn+jKvS8nbhSGNJD91wDBIuh3w9tv6vnJ5+ +p4/JGu3BTyQ2jDRriVHkaAnR4nfcAW58swTKKs653tgfyGQ6M3x4ni0Y XPEeu9RNGGud5wC2qnAM8/F4oACaoroUMCIBI8sUMxyvlCNFncpE6629r OrQACaGtgwfsuO1xNp6xczxRLYYqAt+6jXdHKvju7cl9JfohEMuZWYFnr o0ypygmanfdip3Vw4tSIL5jXC2srRart3nJrliYDwsR7lEXM6HBFP5QWU A==; X-IronPort-AV: E=McAfee;i="6200,9189,10246"; a="308782835" X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="308782835" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,338,1635231600"; d="scan'208";a="483070835" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.251.1.6]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 17:03:49 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Geliang Tang , davem@davemloft.net, kuba@kernel.org, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Paolo Abeni , Mat Martineau Subject: [PATCH net-next 7/7] selftests: mptcp: add fullmesh setting tests Date: Wed, 2 Feb 2022 17:03:43 -0800 Message-Id: <20220203010343.113421-8-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> References: <20220203010343.113421-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch added the fullmesh setting and clearing selftests in mptcp_join.sh. Now we can set both backup and fullmesh flags, so avoid using the words 'backup' and 'bkup'. Acked-by: Paolo Abeni Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau --- .../testing/selftests/net/mptcp/mptcp_join.sh | 49 ++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index b8bdbec0cf69..bd106c7ec232 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -289,7 +289,7 @@ do_transfer() addr_nr_ns1="$7" addr_nr_ns2="$8" speed="$9" - bkup="${10}" + sflags="${10}" port=$((10000+$TEST_COUNT)) TEST_COUNT=$((TEST_COUNT+1)) @@ -461,14 +461,13 @@ do_transfer() fi fi - if [ ! -z $bkup ]; then + if [ ! -z $sflags ]; then sleep 1 for netns in "$ns1" "$ns2"; do dump=(`ip netns exec $netns ./pm_nl_ctl dump`) if [ ${#dump[@]} -gt 0 ]; then addr=${dump[${#dump[@]} - 1]} - backup="ip netns exec $netns ./pm_nl_ctl set $addr flags $bkup" - $backup + ip netns exec $netns ./pm_nl_ctl set $addr flags $sflags fi done fi @@ -545,7 +544,7 @@ run_tests() addr_nr_ns1="${5:-0}" addr_nr_ns2="${6:-0}" speed="${7:-fast}" - bkup="${8:-""}" + sflags="${8:-""}" lret=0 oldin="" @@ -574,7 +573,7 @@ run_tests() fi do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \ - ${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${bkup} + ${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${sflags} lret=$? } @@ -1888,6 +1887,44 @@ fullmesh_tests() run_tests $ns1 $ns2 10.0.1.1 0 0 fullmesh_2 slow chk_join_nr "fullmesh test 1x2, limited" 4 4 4 chk_add_nr 1 1 + + # set fullmesh flag + reset + ip netns exec $ns1 ./pm_nl_ctl limits 4 4 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags subflow + ip netns exec $ns2 ./pm_nl_ctl limits 4 4 + run_tests $ns1 $ns2 10.0.1.1 0 0 1 slow fullmesh + chk_join_nr "set fullmesh flag test" 2 2 2 + chk_rm_nr 0 1 + + # set nofullmesh flag + reset + ip netns exec $ns1 ./pm_nl_ctl limits 4 4 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags subflow,fullmesh + ip netns exec $ns2 ./pm_nl_ctl limits 4 4 + run_tests $ns1 $ns2 10.0.1.1 0 0 fullmesh_1 slow nofullmesh + chk_join_nr "set nofullmesh flag test" 2 2 2 + chk_rm_nr 0 1 + + # set backup,fullmesh flags + reset + ip netns exec $ns1 ./pm_nl_ctl limits 4 4 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags subflow + ip netns exec $ns2 ./pm_nl_ctl limits 4 4 + run_tests $ns1 $ns2 10.0.1.1 0 0 1 slow backup,fullmesh + chk_join_nr "set backup,fullmesh flags test" 2 2 2 + chk_prio_nr 0 1 + chk_rm_nr 0 1 + + # set nobackup,nofullmesh flags + reset + ip netns exec $ns1 ./pm_nl_ctl limits 4 4 + ip netns exec $ns2 ./pm_nl_ctl limits 4 4 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow,backup,fullmesh + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow nobackup,nofullmesh + chk_join_nr "set nobackup,nofullmesh flags test" 2 2 2 + chk_prio_nr 0 1 + chk_rm_nr 0 1 } all_tests()