All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] mptcp: Updates for net-next
@ 2022-05-14  0:21 Mat Martineau
  2022-05-14  0:21 ` [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning Mat Martineau
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Mat Martineau @ 2022-05-14  0:21 UTC (permalink / raw)
  To: netdev
  Cc: Mat Martineau, davem, kuba, pabeni, edumazet, matthieu.baerts, mptcp

Three independent fixes/features from the MPTCP tree:

Patch 1 is a selftest workaround for older iproute2 packages.

Patch 2 removes superfluous locks that were added with recent MP_FAIL
patches.

Patch 3 adds support for the TCP_DEFER_ACCEPT sockopt.


Florian Westphal (1):
  mptcp: sockopt: add TCP_DEFER_ACCEPT support

Geliang Tang (1):
  selftests: mptcp: fix a mp_fail test warning

Paolo Abeni (1):
  Revert "mptcp: add data lock for sk timers"

 net/mptcp/protocol.c                            | 12 ------------
 net/mptcp/sockopt.c                             | 15 +++++++++++++++
 tools/testing/selftests/net/mptcp/mptcp_join.sh |  1 +
 3 files changed, 16 insertions(+), 12 deletions(-)


base-commit: 2c5f1536473b7530adefd09a25cf3fef2cfe01f2
-- 
2.36.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning
  2022-05-14  0:21 [PATCH net-next 0/3] mptcp: Updates for net-next Mat Martineau
@ 2022-05-14  0:21 ` Mat Martineau
  2022-05-16 20:13   ` Jakub Kicinski
  2022-05-14  0:21 ` [PATCH net-next 2/3] Revert "mptcp: add data lock for sk timers" Mat Martineau
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Mat Martineau @ 2022-05-14  0:21 UTC (permalink / raw)
  To: netdev
  Cc: Geliang Tang, davem, kuba, pabeni, edumazet, matthieu.baerts,
	mptcp, Mat Martineau

From: Geliang Tang <geliang.tang@suse.com>

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 <matthieu.baerts@tessares.net>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
 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/'
 }
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 2/3] Revert "mptcp: add data lock for sk timers"
  2022-05-14  0:21 [PATCH net-next 0/3] mptcp: Updates for net-next Mat Martineau
  2022-05-14  0:21 ` [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning Mat Martineau
@ 2022-05-14  0:21 ` Mat Martineau
  2022-05-14  0:21 ` [PATCH net-next 3/3] mptcp: sockopt: add TCP_DEFER_ACCEPT support Mat Martineau
  2022-05-16 20:20 ` [PATCH net-next 0/3] mptcp: Updates for net-next patchwork-bot+netdevbpf
  3 siblings, 0 replies; 7+ messages in thread
From: Mat Martineau @ 2022-05-14  0:21 UTC (permalink / raw)
  To: netdev
  Cc: Paolo Abeni, davem, kuba, edumazet, matthieu.baerts, mptcp,
	Mat Martineau

From: Paolo Abeni <pabeni@redhat.com>

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 <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
 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);
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 3/3] mptcp: sockopt: add TCP_DEFER_ACCEPT support
  2022-05-14  0:21 [PATCH net-next 0/3] mptcp: Updates for net-next Mat Martineau
  2022-05-14  0:21 ` [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning Mat Martineau
  2022-05-14  0:21 ` [PATCH net-next 2/3] Revert "mptcp: add data lock for sk timers" Mat Martineau
@ 2022-05-14  0:21 ` Mat Martineau
  2022-05-16 20:20 ` [PATCH net-next 0/3] mptcp: Updates for net-next patchwork-bot+netdevbpf
  3 siblings, 0 replies; 7+ messages in thread
From: Mat Martineau @ 2022-05-14  0:21 UTC (permalink / raw)
  To: netdev
  Cc: Florian Westphal, davem, kuba, pabeni, edumazet, matthieu.baerts,
	mptcp, Mat Martineau

From: Florian Westphal <fw@strlen.de>

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 <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
 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:
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning
  2022-05-14  0:21 ` [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning Mat Martineau
@ 2022-05-16 20:13   ` Jakub Kicinski
  2022-05-17  7:01     ` Matthieu Baerts
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2022-05-16 20:13 UTC (permalink / raw)
  To: Mat Martineau
  Cc: netdev, Geliang Tang, davem, pabeni, edumazet, matthieu.baerts, mptcp

On Fri, 13 May 2022 17:21:13 -0700 Mat Martineau wrote:
>  	tc -n $ns2 -j -s action show action pedit index 100 | \
> +		grep "packets" | \
>  		sed 's/.*"packets":\([0-9]\+\),.*/\1/'

sed can do the grepping for you:

sed -n 's/.*"packets":\([0-9]\+\),.*/\1/p'

But really grepping JSON output seems weird. Why not use jq?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 0/3] mptcp: Updates for net-next
  2022-05-14  0:21 [PATCH net-next 0/3] mptcp: Updates for net-next Mat Martineau
                   ` (2 preceding siblings ...)
  2022-05-14  0:21 ` [PATCH net-next 3/3] mptcp: sockopt: add TCP_DEFER_ACCEPT support Mat Martineau
@ 2022-05-16 20:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-16 20:20 UTC (permalink / raw)
  To: Mat Martineau
  Cc: netdev, davem, kuba, pabeni, edumazet, matthieu.baerts, mptcp

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 13 May 2022 17:21:12 -0700 you wrote:
> Three independent fixes/features from the MPTCP tree:
> 
> Patch 1 is a selftest workaround for older iproute2 packages.
> 
> Patch 2 removes superfluous locks that were added with recent MP_FAIL
> patches.
> 
> [...]

Here is the summary with links:
  - [net-next,1/3] selftests: mptcp: fix a mp_fail test warning
    https://git.kernel.org/netdev/net-next/c/c43ce39870b3
  - [net-next,2/3] Revert "mptcp: add data lock for sk timers"
    https://git.kernel.org/netdev/net-next/c/0ea5374255a9
  - [net-next,3/3] mptcp: sockopt: add TCP_DEFER_ACCEPT support
    https://git.kernel.org/netdev/net-next/c/ea1e301d04b7

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning
  2022-05-16 20:13   ` Jakub Kicinski
@ 2022-05-17  7:01     ` Matthieu Baerts
  0 siblings, 0 replies; 7+ messages in thread
From: Matthieu Baerts @ 2022-05-17  7:01 UTC (permalink / raw)
  To: Jakub Kicinski, Mat Martineau
  Cc: netdev, Geliang Tang, davem, pabeni, edumazet, mptcp

Hi Jakub,

Thank you for the review and for having applied the patches!

On 16/05/2022 22:13, Jakub Kicinski wrote:
> On Fri, 13 May 2022 17:21:13 -0700 Mat Martineau wrote:
>>  	tc -n $ns2 -j -s action show action pedit index 100 | \
>> +		grep "packets" | \
>>  		sed 's/.*"packets":\([0-9]\+\),.*/\1/'
> 
> sed can do the grepping for you:
> 
> sed -n 's/.*"packets":\([0-9]\+\),.*/\1/p'

Yes, thank you, that would have been shorter!

> But really grepping JSON output seems weird. Why not use jq?

We started to use 'jq' because we originally had to extract a few values
from this command. At the end, we only needed to extract the number of
packets and we didn't want all MPTCP tests to depend on 'jq' just for that.

But because 'jq' is already needed for a few other selftests, next time
we need to parse a JSON, we should use 'jq'!

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-17  7:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-14  0:21 [PATCH net-next 0/3] mptcp: Updates for net-next Mat Martineau
2022-05-14  0:21 ` [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning Mat Martineau
2022-05-16 20:13   ` Jakub Kicinski
2022-05-17  7:01     ` Matthieu Baerts
2022-05-14  0:21 ` [PATCH net-next 2/3] Revert "mptcp: add data lock for sk timers" Mat Martineau
2022-05-14  0:21 ` [PATCH net-next 3/3] mptcp: sockopt: add TCP_DEFER_ACCEPT support Mat Martineau
2022-05-16 20:20 ` [PATCH net-next 0/3] mptcp: Updates for net-next patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.