All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [PATCH mptcp-next 1/2] mptcp: place is_mptcp checks under ifdef guards
@ 2019-04-11 11:43 Florian Westphal
  0 siblings, 0 replies; only message in thread
From: Florian Westphal @ 2019-04-11 11:43 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 3650 bytes --]

After this patch, a CONFIG_MPTCP=n build is the same as a build with all
mptcp patches reverted.
I moved the struct members around a bit so they cover holes in the
original structs.

Signed-off-by: Florian Westphal <fw(a)strlen.de>
---
 include/linux/tcp.h   | 7 +++++--
 include/net/mptcp.h   | 8 ++++++++
 net/ipv4/tcp_input.c  | 6 ++++--
 net/ipv4/tcp_output.c | 2 +-
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 71522b08ad5e..2f4178f3d127 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -155,7 +155,9 @@ struct tcp_request_sock {
 	const struct tcp_request_sock_ops *af_specific;
 	u64				snt_synack; /* first SYNACK sent time */
 	bool				tfo_listener;
+#if IS_ENABLED(CONFIG_MPTCP)
 	bool				is_mptcp;
+#endif
 	u32				txhash;
 	u32				rcv_isn;
 	u32				snt_isn;
@@ -413,6 +415,9 @@ struct tcp_sock {
 	u32	mtu_info; /* We received an ICMP_FRAG_NEEDED / ICMPV6_PKT_TOOBIG
 			   * while socket was owned by user.
 			   */
+#if IS_ENABLED(CONFIG_MPTCP)
+	bool	is_mptcp;
+#endif
 
 #ifdef CONFIG_TCP_MD5SIG
 /* TCP AF-Specific parts; only used by MD5 Signature support so far */
@@ -429,8 +434,6 @@ struct tcp_sock {
 	 */
 	struct request_sock *fastopen_rsk;
 	u32	*saved_syn;
-
-	bool	is_mptcp;
 };
 
 enum tsq_enum {
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index 0c0839d9ab38..1050bfa71f61 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -208,6 +208,10 @@ void mptcp_write_option_header(__be32 *ptr, struct sk_buff *skb,
 			       struct tcp_sock *tp,
 			       struct mptcp_out_options *opts);
 
+static inline bool sk_is_mptcp(const struct sock *sk)
+{
+	return tcp_sk(sk)->is_mptcp;
+}
 #else
 
 static inline void mptcp_parse_option(const unsigned char *ptr, int opsize,
@@ -248,5 +252,9 @@ static inline bool mptcp_skb_ext_exist(const struct sk_buff *skb)
 	return false;
 }
 
+static inline bool sk_is_mptcp(const struct sock *sk)
+{
+	return false;
+}
 #endif /* CONFIG_MPTCP */
 #endif /* __NET_MPTCP_H */
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a3a77b6e50ae..99b5427cadbe 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5643,7 +5643,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
 	tcp_urg(sk, skb, th);
 
 	/* Prepare MPTCP sequence data */
-	if (tcp_sk(sk)->is_mptcp)
+	if (sk_is_mptcp(sk))
 		mptcp_attach_dss(sk, skb, &tp->rx_opt);
 
 	/* step 7: process the segment text */
@@ -5861,7 +5861,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
 		tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
 		tcp_initialize_rcv_mss(sk);
 
-		if (tp->is_mptcp)
+		if (sk_is_mptcp(sk))
 			mptcp_rcv_synsent(sk);
 
 		/* Remember, tcp_poll() does not lock socket!
@@ -6442,7 +6442,9 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
 
 	tcp_rsk(req)->af_specific = af_ops;
 	tcp_rsk(req)->ts_off = 0;
+#if IS_ENABLED(CONFIG_MPTCP)
 	tcp_rsk(req)->is_mptcp = 0;
+#endif
 
 	tcp_clear_options(&tmp_opt);
 	tmp_opt.mss_clamp = af_ops->mss_clamp;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 6d846c785e0b..0d8f2b7e481d 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -3769,7 +3769,7 @@ void __tcp_send_ack(struct sock *sk, u32 rcv_nxt)
 	skb_set_tcp_pure_ack(buff);
 
 	/* Send it off, this clears delayed acks for us. */
-	if (tcp_sk(sk)->is_mptcp)
+	if (sk_is_mptcp(sk))
 		pr_debug("mptcp sk=%p", sk);
 
 	__tcp_transmit_skb(sk, buff, 0, (__force gfp_t)0, rcv_nxt);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-11 11:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 11:43 [MPTCP] [PATCH mptcp-next 1/2] mptcp: place is_mptcp checks under ifdef guards Florian Westphal

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.