All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Baerts <matthieu.baerts@tessares.net>
To: mptcp@lists.linux.dev
Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
Subject: [PATCH mptcp-next] Squash to "mptcp: add subflow_v(4,6)_send_synack()"
Date: Fri, 25 Nov 2022 22:20:28 +0100	[thread overview]
Message-ID: <20221125212028.702058-1-matthieu.baerts@tessares.net> (raw)

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


             reply	other threads:[~2022-11-25 21:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 21:20 Matthieu Baerts [this message]
2022-11-25 22:35 ` [PATCH mptcp-next] Squash to "mptcp: add subflow_v(4,6)_send_synack()" Matthieu Baerts
2022-11-25 23:01 ` Squash to "mptcp: add subflow_v(4,6)_send_synack()": Tests Results MPTCP CI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221125212028.702058-1-matthieu.baerts@tessares.net \
    --to=matthieu.baerts@tessares.net \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.