diff mbox series

[mptcp-next,v2,2/9] mptcp: add MPTCP_INFINITE_DONE flag

Message ID 436686041e03ec619d507cf4d517e9137f7bd27a.1631188109.git.geliangtang@xiaomi.com (mailing list archive)
State Superseded, archived
Headers show
Series The infinite mapping support | expand

Commit Message

Geliang Tang Sept. 9, 2021, 11:51 a.m. UTC
From: Geliang Tang <geliangtang@xiaomi.com>

This patch added a new flag named MPTCP_INFINITE_DONE. Define
mptcp_do_infinite and __mptcp_do_infinite to set this flag, and
mptcp_check_infinite and __mptcp_check_infinite to check this flag.

Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
---
 net/mptcp/protocol.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Paolo Abeni Sept. 9, 2021, 1:31 p.m. UTC | #1
On Thu, 2021-09-09 at 19:51 +0800, Geliang Tang wrote:
> From: Geliang Tang <geliangtang@xiaomi.com>
> 
> This patch added a new flag named MPTCP_INFINITE_DONE. Define
> mptcp_do_infinite and __mptcp_do_infinite to set this flag, and
> mptcp_check_infinite and __mptcp_check_infinite to check this flag.
> 
> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
> ---
>  net/mptcp/protocol.h | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 011f84ae1593..5644a361b9c7 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -123,6 +123,7 @@
>  #define MPTCP_RETRANSMIT	9
>  #define MPTCP_WORK_SYNC_SETSOCKOPT 10
>  #define MPTCP_CONNECTED		11
> +#define MPTCP_INFINITE_DONE	12

I'm likely the last person that should raise this kind of topics, but
IMHO this flag name is a bit unclear. What aboyt 'INFINITE_MAP_SET'?

/P
diff mbox series

Patch

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 011f84ae1593..5644a361b9c7 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -123,6 +123,7 @@ 
 #define MPTCP_RETRANSMIT	9
 #define MPTCP_WORK_SYNC_SETSOCKOPT 10
 #define MPTCP_CONNECTED		11
+#define MPTCP_INFINITE_DONE	12
 
 static inline bool before64(__u64 seq1, __u64 seq2)
 {
@@ -870,6 +871,38 @@  static inline void mptcp_do_fallback(struct sock *sk)
 
 #define pr_fallback(a) pr_debug("%s:fallback to TCP (msk=%p)", __func__, a)
 
+static inline bool __mptcp_check_infinite(const struct mptcp_sock *msk)
+{
+	return test_bit(MPTCP_INFINITE_DONE, &msk->flags);
+}
+
+static inline bool mptcp_check_infinite(const struct sock *sk)
+{
+	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
+	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
+
+	return __mptcp_check_infinite(msk);
+}
+
+static inline void __mptcp_do_infinite(struct mptcp_sock *msk)
+{
+	if (test_bit(MPTCP_INFINITE_DONE, &msk->flags)) {
+		pr_debug("Infinite mapping already done (msk=%p)", msk);
+		return;
+	}
+	set_bit(MPTCP_INFINITE_DONE, &msk->flags);
+}
+
+static inline void mptcp_do_infinite(struct sock *sk)
+{
+	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
+	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
+
+	__mptcp_do_infinite(msk);
+}
+
+#define pr_infinite(a) pr_debug("%s:infinite mapping (msk=%p)", __func__, a)
+
 static inline bool subflow_simultaneous_connect(struct sock *sk)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);