diff mbox series

[mptcp-next] mptcp: sockopt: add TCP_DEFER_ACCEPT support

Message ID 20220502163624.6110-1-fw@strlen.de (mailing list archive)
State Accepted, archived
Commit 3476c1a3846cdf22e801ef756bd078ab7a901f2d
Delegated to: Matthieu Baerts
Headers show
Series [mptcp-next] mptcp: sockopt: add TCP_DEFER_ACCEPT support | expand

Checks

Context Check Description
matttbe/build success Build and static analysis OK
matttbe/checkpatch warning total: 0 errors, 1 warnings, 0 checks, 33 lines checked
matttbe/KVM_Validation__normal warning Unstable: 1 failed test(s): selftest_simult_flows
matttbe/KVM_Validation__debug warning Unstable: 3 failed test(s): selftest_diag selftest_mptcp_join selftest_simult_flows - Critical: 1 Call Trace(s) ❌

Commit Message

Florian Westphal May 2, 2022, 4:36 p.m. UTC
Support this via passthrough to the underlaying tcp listener socket.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/271
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/mptcp/sockopt.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

MPTCP CI May 2, 2022, 7:19 p.m. UTC | #1
Hi Florian,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal:
  - Unstable: 1 failed test(s): selftest_simult_flows 
Mat Martineau May 5, 2022, 12:05 a.m. UTC | #2
On Mon, 2 May 2022, Florian Westphal wrote:

> Support this via passthrough to the underlaying tcp listener socket.
>
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/271
> Signed-off-by: Florian Westphal <fw@strlen.de>

Looks good to me:

Reviewed-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.35.1
>
>
>

--
Mat Martineau
Intel
Matthieu Baerts May 6, 2022, 7:18 p.m. UTC | #3
Hi Florian, Mat,

On 02/05/2022 18:36, Florian Westphal wrote:
> Support this via passthrough to the underlaying tcp listener socket.

Thank you for the patch and the review!

Now in our tree (feat. for net-next) with Mat's RvB tag.

New patches for t/upstream:
- 3476c1a3846c: mptcp: sockopt: add TCP_DEFER_ACCEPT support
- Results: 22856348dac5..9a52d7243fda (export)

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220506T191513
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export

Cheers,
Matt
diff mbox series

Patch

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: