Skip to contentSkip to conversation

mptcp: Updates for net-next

PATCH Applied Mat Martineau 4 participants 7 messages May 14, 2022 – May 17, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover mptcp: Updates for net-next

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

Signature · 1 line
2.36.1
#1 lore raw

PATCH 1/3 selftests: mptcp: fix a mp_fail test warning

From: Geliang Tang <[email protected]>

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")
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
index d1de1e7702fb..7381d1f85209 100755
@@ -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/'
 }
 
Signature · 1 line
2.36.1
maintainer
#2 lore raw

Re: [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning

tools/testing/selftests/net/mptcp/mptcp_join.sh fastclose_tests() · line 2697

Quoted 3 lines · On Fri, 13 May 2022 17:21:13 -0700 Mat Martineau wrote:
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
 	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?

#3 lore raw

Re: [PATCH net-next 1/3] selftests: mptcp: fix a mp_fail test warning

Hi Jakub,

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

Quoted 8 lines · Jakub Kicinski

tools/testing/selftests/net/mptcp/mptcp_join.sh fastclose_tests() · line 2697

Quoted 3 lines · On Fri, 13 May 2022 17:21:13 -0700 Mat Martineau wrote:
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
 	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!

Quoted 1 line

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

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#4 lore raw

PATCH 2/3 Revert "mptcp: add data lock for sk timers"

In reply to Mat Martineau

From: Paolo Abeni <[email protected]>

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")
---
 net/mptcp/protocol.c | 12 ------------
 1 file changed, 12 deletions(-)
net/mptcp/protocol.c +0 -12
index 9e46cc89a8f7..921d67174e49 100644
@@ -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);
Signature · 1 line
2.36.1
#5 lore raw

PATCH 3/3 mptcp: sockopt: add TCP_DEFER_ACCEPT support

In reply to Mat Martineau

From: Florian Westphal <[email protected]>

Support this via passthrough to the underlying tcp listener socket.

---
 net/mptcp/sockopt.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
net/mptcp/sockopt.c +15 -0
index 826b0c1dae98..423d3826ca1e 100644
@@ -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:
Signature · 1 line
2.36.1
#6 lore raw
In reply to Mat Martineau
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html