diff mbox series

[v2,mptcp-next] mptcp: don't save tcp data_ready and write space callbacks

Message ID 20220210144839.26742-1-fw@strlen.de (mailing list archive)
State Accepted, archived
Commit 6889b3fb640578efdc6afd22572ab5c4c605ec08
Delegated to: Matthieu Baerts
Headers show
Series [v2,mptcp-next] mptcp: don't save tcp data_ready and write space callbacks | expand

Checks

Context Check Description
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 43 lines checked
matttbe/build success Build and static analysis OK
matttbe/KVM_Validation__normal warning Unstable: 2 failed test(s): packetdrill_add_addr selftest_mptcp_join
matttbe/KVM_Validation__debug success Success! ✅

Commit Message

Florian Westphal Feb. 10, 2022, 2:48 p.m. UTC
Assign the helpers directly rather than save/restore in the context
structure.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/mptcp/protocol.h | 6 ++----
 net/mptcp/subflow.c  | 8 ++++----
 2 files changed, 6 insertions(+), 8 deletions(-)

Comments

Mat Martineau Feb. 10, 2022, 8:41 p.m. UTC | #1
On Thu, 10 Feb 2022, Florian Westphal wrote:

> Assign the helpers directly rather than save/restore in the context
> structure.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>

Thanks for the v2.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>


> ---
> net/mptcp/protocol.h | 6 ++----
> net/mptcp/subflow.c  | 8 ++++----
> 2 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 0eebfc9f39bc..3937ea3f6759 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -479,9 +479,7 @@ struct mptcp_subflow_context {
> 	struct	sock *tcp_sock;	    /* tcp sk backpointer */
> 	struct	sock *conn;	    /* parent mptcp_sock */
> 	const	struct inet_connection_sock_af_ops *icsk_af_ops;
> -	void	(*tcp_data_ready)(struct sock *sk);
> 	void	(*tcp_state_change)(struct sock *sk);
> -	void	(*tcp_write_space)(struct sock *sk);
> 	void	(*tcp_error_report)(struct sock *sk);
>
> 	struct	rcu_head rcu;
> @@ -626,9 +624,9 @@ bool mptcp_subflow_active(struct mptcp_subflow_context *subflow);
> static inline void mptcp_subflow_tcp_fallback(struct sock *sk,
> 					      struct mptcp_subflow_context *ctx)
> {
> -	sk->sk_data_ready = ctx->tcp_data_ready;
> +	sk->sk_data_ready = sock_def_readable;
> 	sk->sk_state_change = ctx->tcp_state_change;
> -	sk->sk_write_space = ctx->tcp_write_space;
> +	sk->sk_write_space = sk_stream_write_space;
> 	sk->sk_error_report = ctx->tcp_error_report;
>
> 	inet_csk(sk)->icsk_af_ops = ctx->icsk_af_ops;
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index 485f00dcaf84..0e929aa71b18 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -1661,10 +1661,12 @@ static int subflow_ulp_init(struct sock *sk)
> 	tp->is_mptcp = 1;
> 	ctx->icsk_af_ops = icsk->icsk_af_ops;
> 	icsk->icsk_af_ops = subflow_default_af_ops(sk);
> -	ctx->tcp_data_ready = sk->sk_data_ready;
> 	ctx->tcp_state_change = sk->sk_state_change;
> -	ctx->tcp_write_space = sk->sk_write_space;
> 	ctx->tcp_error_report = sk->sk_error_report;
> +
> +	WARN_ON_ONCE(sk->sk_data_ready != sock_def_readable);
> +	WARN_ON_ONCE(sk->sk_write_space != sk_stream_write_space);
> +
> 	sk->sk_data_ready = subflow_data_ready;
> 	sk->sk_write_space = subflow_write_space;
> 	sk->sk_state_change = subflow_state_change;
> @@ -1719,9 +1721,7 @@ static void subflow_ulp_clone(const struct request_sock *req,
>
> 	new_ctx->conn_finished = 1;
> 	new_ctx->icsk_af_ops = old_ctx->icsk_af_ops;
> -	new_ctx->tcp_data_ready = old_ctx->tcp_data_ready;
> 	new_ctx->tcp_state_change = old_ctx->tcp_state_change;
> -	new_ctx->tcp_write_space = old_ctx->tcp_write_space;
> 	new_ctx->tcp_error_report = old_ctx->tcp_error_report;
> 	new_ctx->rel_write_seq = 1;
> 	new_ctx->tcp_sock = newsk;
> -- 
> 2.34.1
>
>
>

--
Mat Martineau
Intel
Matthieu Baerts Feb. 11, 2022, 10:46 a.m. UTC | #2
Hi Florian, Mat,

On 10/02/2022 15:48, Florian Westphal wrote:
> Assign the helpers directly rather than save/restore in the context
> structure.

Thank you for the patch and the review!

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

- 6889b3fb6405: mptcp: don't save tcp data_ready and write space callbacks
- Results: c999932bd32c..7f0a980be1a6

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220211T104450
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/protocol.h b/net/mptcp/protocol.h
index 0eebfc9f39bc..3937ea3f6759 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -479,9 +479,7 @@  struct mptcp_subflow_context {
 	struct	sock *tcp_sock;	    /* tcp sk backpointer */
 	struct	sock *conn;	    /* parent mptcp_sock */
 	const	struct inet_connection_sock_af_ops *icsk_af_ops;
-	void	(*tcp_data_ready)(struct sock *sk);
 	void	(*tcp_state_change)(struct sock *sk);
-	void	(*tcp_write_space)(struct sock *sk);
 	void	(*tcp_error_report)(struct sock *sk);
 
 	struct	rcu_head rcu;
@@ -626,9 +624,9 @@  bool mptcp_subflow_active(struct mptcp_subflow_context *subflow);
 static inline void mptcp_subflow_tcp_fallback(struct sock *sk,
 					      struct mptcp_subflow_context *ctx)
 {
-	sk->sk_data_ready = ctx->tcp_data_ready;
+	sk->sk_data_ready = sock_def_readable;
 	sk->sk_state_change = ctx->tcp_state_change;
-	sk->sk_write_space = ctx->tcp_write_space;
+	sk->sk_write_space = sk_stream_write_space;
 	sk->sk_error_report = ctx->tcp_error_report;
 
 	inet_csk(sk)->icsk_af_ops = ctx->icsk_af_ops;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 485f00dcaf84..0e929aa71b18 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -1661,10 +1661,12 @@  static int subflow_ulp_init(struct sock *sk)
 	tp->is_mptcp = 1;
 	ctx->icsk_af_ops = icsk->icsk_af_ops;
 	icsk->icsk_af_ops = subflow_default_af_ops(sk);
-	ctx->tcp_data_ready = sk->sk_data_ready;
 	ctx->tcp_state_change = sk->sk_state_change;
-	ctx->tcp_write_space = sk->sk_write_space;
 	ctx->tcp_error_report = sk->sk_error_report;
+
+	WARN_ON_ONCE(sk->sk_data_ready != sock_def_readable);
+	WARN_ON_ONCE(sk->sk_write_space != sk_stream_write_space);
+
 	sk->sk_data_ready = subflow_data_ready;
 	sk->sk_write_space = subflow_write_space;
 	sk->sk_state_change = subflow_state_change;
@@ -1719,9 +1721,7 @@  static void subflow_ulp_clone(const struct request_sock *req,
 
 	new_ctx->conn_finished = 1;
 	new_ctx->icsk_af_ops = old_ctx->icsk_af_ops;
-	new_ctx->tcp_data_ready = old_ctx->tcp_data_ready;
 	new_ctx->tcp_state_change = old_ctx->tcp_state_change;
-	new_ctx->tcp_write_space = old_ctx->tcp_write_space;
 	new_ctx->tcp_error_report = old_ctx->tcp_error_report;
 	new_ctx->rel_write_seq = 1;
 	new_ctx->tcp_sock = newsk;