All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next] Squash to "mptcp: add subflow_v(4,6)_send_synack()"
@ 2022-11-25 21:20 Matthieu Baerts
  2022-11-25 22:35 ` Matthieu Baerts
  2022-11-25 23:01 ` Squash to "mptcp: add subflow_v(4,6)_send_synack()": Tests Results MPTCP CI
  0 siblings, 2 replies; 3+ messages in thread
From: Matthieu Baerts @ 2022-11-25 21:20 UTC (permalink / raw)
  To: mptcp; +Cc: Matthieu Baerts

This is a small cleanup, just to avoid duplicating the whole function
for v4 and v6 while the only difference between the two is one call to a
different send_synack() function.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 net/mptcp/subflow.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 05099b3760b5..2ff3840fc058 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -307,12 +307,9 @@ static struct dst_entry *subflow_v4_route_req(const struct sock *sk,
 	return NULL;
 }
 
-static int subflow_v4_send_synack(const struct sock *sk, struct dst_entry *dst,
-				  struct flowi *fl,
-				  struct request_sock *req,
-				  struct tcp_fastopen_cookie *foc,
-				  enum tcp_synack_type synack_type,
-				  struct sk_buff *syn_skb)
+static void subflow_send_synack(const struct sock *sk, struct request_sock *req,
+				struct tcp_fastopen_cookie *foc,
+				enum tcp_synack_type synack_type)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
 	struct inet_request_sock *ireq = inet_rsk(req);
@@ -323,8 +320,19 @@ static int subflow_v4_send_synack(const struct sock *sk, struct dst_entry *dst,
 
 	if (synack_type == TCP_SYNACK_FASTOPEN)
 		mptcp_fastopen_subflow_synack_set_params(subflow, req);
+}
+
+static int subflow_v4_send_synack(const struct sock *sk, struct dst_entry *dst,
+				  struct flowi *fl,
+				  struct request_sock *req,
+				  struct tcp_fastopen_cookie *foc,
+				  enum tcp_synack_type synack_type,
+				  struct sk_buff *syn_skb)
+{
+	subflow_send_synack(sk, req, foc, synack_type);
 
-	return tcp_request_sock_ipv4_ops.send_synack(sk, dst, fl, req, foc, synack_type, syn_skb);
+	return tcp_request_sock_ipv4_ops.send_synack(sk, dst, fl, req, foc,
+						     synack_type, syn_skb);
 }
 
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
@@ -335,17 +343,10 @@ static int subflow_v6_send_synack(const struct sock *sk, struct dst_entry *dst,
 				  enum tcp_synack_type synack_type,
 				  struct sk_buff *syn_skb)
 {
-	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
-	struct inet_request_sock *ireq = inet_rsk(req);
-
-	/* clear tstamp_ok, as needed depending on cookie */
-	if (foc && foc->len > -1)
-		ireq->tstamp_ok = 0;
-
-	if (synack_type == TCP_SYNACK_FASTOPEN)
-		mptcp_fastopen_subflow_synack_set_params(subflow, req);
+	subflow_send_synack(sk, req, foc, synack_type);
 
-	return tcp_request_sock_ipv6_ops.send_synack(sk, dst, fl, req, foc, synack_type, syn_skb);
+	return tcp_request_sock_ipv6_ops.send_synack(sk, dst, fl, req, foc,
+						     synack_type, syn_skb);
 }
 
 static struct dst_entry *subflow_v6_route_req(const struct sock *sk,

base-commit: 5d9ac522aceb69b5b524d330b6ecdbaff61decdc
-- 
2.37.2


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

end of thread, other threads:[~2022-11-25 23:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 21:20 [PATCH mptcp-next] Squash to "mptcp: add subflow_v(4,6)_send_synack()" Matthieu Baerts
2022-11-25 22:35 ` Matthieu Baerts
2022-11-25 23:01 ` Squash to "mptcp: add subflow_v(4,6)_send_synack()": Tests Results MPTCP CI

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.