From patchwork Sat May 14 00:21:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12849673 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 695B6C433F5 for ; Sat, 14 May 2022 03:00:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231807AbiENDAe (ORCPT ); Fri, 13 May 2022 23:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231784AbiENC7k (ORCPT ); Fri, 13 May 2022 22:59:40 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B22636AE35 for ; Fri, 13 May 2022 18:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652491731; x=1684027731; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1zXQQLIalYYZ2M8+aZMUpfjKxvlmKG2qfFu5cLhcq1M=; b=irkYNjNeRD+aAphzSfIkMYM39S5RtKP/TV+n/sILXjE8+hzgabEDAEcY eZCmpQYhFjj+YkydC3M1nm4Xfq2aOfL0EPZ7BCmJcTfl9I6tBWkf+Mloi SBI55S+UmtYPYmj0YOJKwT0+rgIt+cg1U9srnm0OA63XzVgZN7vWKZeQz zkHCa/VCbBzTQGnyNBJqIeCjOUIXDyPk6jihuf3ghght9aSCL67NtkTjT fxeQ8nNfZsQJcjiXrajr1fvSGDAMEMIoUWiER9XvuSKfpnnOYwxZpkUMt yFnYOPE8OtZFStYIOEYlBw76Jn+L5ZDVu+0cY4acZ78CqU6+QEeJ1oy6a A==; X-IronPort-AV: E=McAfee;i="6400,9594,10346"; a="257994308" X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="257994308" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 17:21:21 -0700 X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="625102784" Received: from clakshma-mobl1.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.212.160.121]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 17:21:20 -0700 From: Mat Martineau To: netdev@vger.kernel.org Cc: Geliang Tang , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning Date: Fri, 13 May 2022 17:21:13 -0700 Message-Id: <20220514002115.725976-2-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220514002115.725976-1-mathew.j.martineau@linux.intel.com> References: <20220514002115.725976-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 Old tc versions (iproute2 5.3) show actions in multiple lines, not a single line. Then the following unexpected MP_FAIL selftest output occurs: file received by server has inverted byte at 169 ./mptcp_join.sh: line 1277: [: [{"total acts":1},{"actions":[{"order":0 pedit ,"control_action":{"type":"pipe"}keys 1 index 1 ref 1 bind 1,"installed":0,"last_used":0 key #0 at 148: val ff000000 mask ffffffff 5: integer expression expected 001 Infinite map syn[ ok ] - synack[ ok ] - ack[ ok ] sum[ ok ] - csum [ ok ] ftx[ ok ] - failrx[ ok ] rtx[ ok ] - rstrx [ ok ] itx[ ok ] - infirx[ ok ] ftx[ ok ] - failrx[ ok ] invert This patch adds a 'grep' before 'sed' to fix this. Fixes: b6e074e171bc ("selftests: mptcp: add infinite map testcase") Reviewed-by: Matthieu Baerts Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index d1de1e7702fb..7381d1f85209 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -2693,6 +2693,7 @@ fastclose_tests() pedit_action_pkts() { tc -n $ns2 -j -s action show action pedit index 100 | \ + grep "packets" | \ sed 's/.*"packets":\([0-9]\+\),.*/\1/' } From patchwork Sat May 14 00:21:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12849671 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 A1F3BC433F5 for ; Sat, 14 May 2022 03:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230380AbiENDA2 (ORCPT ); Fri, 13 May 2022 23:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230457AbiENC7k (ORCPT ); Fri, 13 May 2022 22:59:40 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88DBC36AE36 for ; Fri, 13 May 2022 18:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652491731; x=1684027731; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uGgFF3Eow8jiNYdNies67VwJuxXcoh+pEdlSM7stZoQ=; b=gUlATMrRJU3MvaTB8twBZE18Q8YF8VkjQ8B10H7Onr3zPYRSt9/8a9Kt 8vaUa429AonpZobp44MWtMnjQfSNckS3Y8F2SoAp2BK1xiRbDdr7VHfSt Tz3GoMhs9xfShbUuOQhu4BeyRNCuXn0dF9+rOgLscxcbdL4AI6NDKeHkV tcaf7HfF0Lrpbo3VXHefI9SQrviCTDFdRcFA1CXpcnXq8MN6eaPi3EROo z+97iu+Ld6MWB+HVKJw03L+QoiV7mD9gibE58sWQi41WwFpQUichlDgW3 sflTlabZ6NwF9r0PgQQ7NkKYQnVtMFDVRGkq7fQdphwH0Hr5GgPAPwgE6 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10346"; a="257994310" X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="257994310" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 17:21:21 -0700 X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="625102786" Received: from clakshma-mobl1.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.212.160.121]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 17:21:20 -0700 From: Mat Martineau To: netdev@vger.kernel.org Cc: Paolo Abeni , davem@davemloft.net, kuba@kernel.org, edumazet@google.com, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 2/3] Revert "mptcp: add data lock for sk timers" Date: Fri, 13 May 2022 17:21:14 -0700 Message-Id: <20220514002115.725976-3-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220514002115.725976-1-mathew.j.martineau@linux.intel.com> References: <20220514002115.725976-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: Paolo Abeni This reverts commit 4293248c6704b854bf816aa1967e433402bee11c. Additional locks are not needed, all the touched sections are already under mptcp socket lock protection. Fixes: 4293248c6704 ("mptcp: add data lock for sk timers") Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau --- net/mptcp/protocol.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 9e46cc89a8f7..921d67174e49 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1613,10 +1613,8 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags) out: /* ensure the rtx timer is running */ - mptcp_data_lock(sk); if (!mptcp_timer_pending(sk)) mptcp_reset_timer(sk); - mptcp_data_unlock(sk); if (copied) __mptcp_check_send_data_fin(sk); } @@ -2529,10 +2527,8 @@ static void __mptcp_retrans(struct sock *sk) reset_timer: mptcp_check_and_set_pending(sk); - mptcp_data_lock(sk); if (!mptcp_timer_pending(sk)) mptcp_reset_timer(sk); - mptcp_data_unlock(sk); } static void mptcp_mp_fail_no_response(struct mptcp_sock *msk) @@ -2711,10 +2707,8 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) } else { pr_debug("Sending DATA_FIN on subflow %p", ssk); tcp_send_ack(ssk); - mptcp_data_lock(sk); if (!mptcp_timer_pending(sk)) mptcp_reset_timer(sk); - mptcp_data_unlock(sk); } break; } @@ -2815,10 +2809,8 @@ static void __mptcp_destroy_sock(struct sock *sk) /* join list will be eventually flushed (with rst) at sock lock release time*/ list_splice_init(&msk->conn_list, &conn_list); - mptcp_data_lock(sk); mptcp_stop_timer(sk); sk_stop_timer(sk, &sk->sk_timer); - mptcp_data_unlock(sk); msk->pm.status = 0; /* clears msk->subflow, allowing the following loop to close @@ -2880,9 +2872,7 @@ static void mptcp_close(struct sock *sk, long timeout) __mptcp_destroy_sock(sk); do_cancel_work = true; } else { - mptcp_data_lock(sk); sk_reset_timer(sk, &sk->sk_timer, jiffies + TCP_TIMEWAIT_LEN); - mptcp_data_unlock(sk); } release_sock(sk); if (do_cancel_work) @@ -2927,10 +2917,8 @@ static int mptcp_disconnect(struct sock *sk, int flags) __mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_FASTCLOSE); } - mptcp_data_lock(sk); mptcp_stop_timer(sk); sk_stop_timer(sk, &sk->sk_timer); - mptcp_data_unlock(sk); if (mptcp_sk(sk)->token) mptcp_event(MPTCP_EVENT_CLOSED, mptcp_sk(sk), NULL, GFP_KERNEL); From patchwork Sat May 14 00:21:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 12849672 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 4A1ECC433FE for ; Sat, 14 May 2022 03:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231395AbiENDAa (ORCPT ); Fri, 13 May 2022 23:00:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231629AbiENC7k (ORCPT ); Fri, 13 May 2022 22:59:40 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AEC756768 for ; Fri, 13 May 2022 18:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652491732; x=1684027732; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xTy6YizjRk/aiQtdxnOlDVnO3Ugko3s9yjx08r1djuo=; b=M269oUNtTdcU2USCoveTzhCuHEw9u42b7s2RBvxvfWfyeD+faNV+AQA2 ox2W18MCqYKTSWSsOhJ0zS7P42Fejp80bMjWBLmzDdovW53/6bGYYIoui pKrggYcbAjwJwJQTcVHo9dZiJtM9OWoH+FkplzXFltIt5Utojr+6ViVur 47gOxbdifjHH8yP8D6eBcqQMozcslXWVHFtaR9gBg+yE2kjQ0axnjy+fe NLbopaBPaNpUZ/cN3j9z/q+EJmHhJCz3G99lTMz5JzUhGSA+quVOrM/cQ IRhGCL+T0LN/rJoJFtm20MWn26gUVcf2DNWnhoLSquN7p/ZAA+b0hQ4fK w==; X-IronPort-AV: E=McAfee;i="6400,9594,10346"; a="257994316" X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="257994316" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 17:21:22 -0700 X-IronPort-AV: E=Sophos;i="5.91,223,1647327600"; d="scan'208";a="625102789" Received: from clakshma-mobl1.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.212.160.121]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 17:21:21 -0700 From: Mat Martineau To: netdev@vger.kernel.org Cc: Florian Westphal , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 3/3] mptcp: sockopt: add TCP_DEFER_ACCEPT support Date: Fri, 13 May 2022 17:21:15 -0700 Message-Id: <20220514002115.725976-4-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220514002115.725976-1-mathew.j.martineau@linux.intel.com> References: <20220514002115.725976-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: Florian Westphal Support this via passthrough to the underlying tcp listener socket. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/271 Signed-off-by: Florian Westphal Signed-off-by: Mat Martineau --- net/mptcp/sockopt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index 826b0c1dae98..423d3826ca1e 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -756,6 +756,18 @@ static int mptcp_setsockopt_v4(struct mptcp_sock *msk, int optname, return -EOPNOTSUPP; } +static int mptcp_setsockopt_sol_tcp_defer(struct mptcp_sock *msk, sockptr_t optval, + unsigned int optlen) +{ + struct socket *listener; + + listener = __mptcp_nmpc_socket(msk); + if (!listener) + return 0; /* TCP_DEFER_ACCEPT does not fail */ + + return tcp_setsockopt(listener->sk, SOL_TCP, TCP_DEFER_ACCEPT, optval, optlen); +} + static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname, sockptr_t optval, unsigned int optlen) { @@ -782,6 +794,8 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname, return mptcp_setsockopt_sol_tcp_cork(msk, optval, optlen); case TCP_NODELAY: return mptcp_setsockopt_sol_tcp_nodelay(msk, optval, optlen); + case TCP_DEFER_ACCEPT: + return mptcp_setsockopt_sol_tcp_defer(msk, optval, optlen); } return -EOPNOTSUPP; @@ -1142,6 +1156,7 @@ static int mptcp_getsockopt_sol_tcp(struct mptcp_sock *msk, int optname, case TCP_CONGESTION: case TCP_INFO: case TCP_CC_INFO: + case TCP_DEFER_ACCEPT: return mptcp_getsockopt_first_sf_only(msk, SOL_TCP, optname, optval, optlen); case TCP_INQ: