Skip to contentSkip to conversation

mptcp:diag: prefix exposed items

PATCH In review Matthieu Baerts 2 participants 3 messages Oct 5, 2019 – Oct 7, 2019

Subsystems (2)
lore
Share & tools
lore

Matthieu Baerts

author
#0 lore raw

PATCH v2 1/1 mptcp:diag: prefix exposed items

To conform with the rest.

And only exposed one init function for diag.c

Suggested-by Davide Caratti <dcaratti(a)redhat.com>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
To be squashed in "mptcp: allow dumping subflow context to userspace" v2:
- MPTCP_SUBFLOW_FLAGS_ -> MPTCP_SUBFLOW_FLAG_ (Davide)
- only exposed a new function: mptcp_diag_subflow_init (Davide, Paolo)

 include/uapi/linux/mptcp.h | 18 +++++++++---------
 net/mptcp/diag.c           | 28 +++++++++++++++++-----------
 net/mptcp/protocol.h       |  3 +--
 net/mptcp/subflow.c        |  4 ++--
 4 files changed, 29 insertions(+), 24 deletions(-)
include/uapi/linux/mptcp.h +9 -9
index 2856b89cc36e..3912a9808fa2 100644
@@ -4,15 +4,15 @@
 
 #include <linux/types.h>
 
-#define SUBFLOW_FLAGS_MCAP_REM		BIT(0)
-#define SUBFLOW_FLAGS_MCAP_LOC		BIT(1)
-#define SUBFLOW_FLAGS_JOIN_REM		BIT(2)
-#define SUBFLOW_FLAGS_JOIN_LOC		BIT(3)
-#define SUBFLOW_FLAGS_BKUP_REM		BIT(4)
-#define SUBFLOW_FLAGS_BKUP_LOC		BIT(5)
-#define SUBFLOW_FLAGS_4THACK		BIT(6)
-#define SUBFLOW_FLAGS_CONNECTED		BIT(7)
-#define SUBFLOW_FLAGS_MAPVALID		BIT(8)
+#define MPTCP_SUBFLOW_FLAG_MCAP_REM	BIT(0)
+#define MPTCP_SUBFLOW_FLAG_MCAP_LOC	BIT(1)
+#define MPTCP_SUBFLOW_FLAG_JOIN_REM	BIT(2)
+#define MPTCP_SUBFLOW_FLAG_JOIN_LOC	BIT(3)
+#define MPTCP_SUBFLOW_FLAG_BKUP_REM	BIT(4)
+#define MPTCP_SUBFLOW_FLAG_BKUP_LOC	BIT(5)
+#define MPTCP_SUBFLOW_FLAG_4THACK	BIT(6)
+#define MPTCP_SUBFLOW_FLAG_CONNECTED	BIT(7)
+#define MPTCP_SUBFLOW_FLAG_MAPVALID	BIT(8)
 
 enum {
 	MPTCP_SUBFLOW_UNSPEC,
net/mptcp/diag.c +17 -11
index 27acd1ad485c..830a2adfc0fa 100644
@@ -13,7 +13,7 @@
 #include <uapi/linux/mptcp.h>
 #include "protocol.h"
 
-int subflow_get_info(const struct sock *sk, struct sk_buff *skb)
+static int subflow_get_info(const struct sock *sk, struct sk_buff *skb)
 {
 	struct mptcp_subflow_context *sf;
 	struct nlattr *start;
@@ -32,23 +32,23 @@ int subflow_get_info(const struct sock *sk, struct sk_buff *skb)
 	}
 
 	if (sf->mp_capable)
-		flags |= SUBFLOW_FLAGS_MCAP_REM;
+		flags |= MPTCP_SUBFLOW_FLAG_MCAP_REM;
 	if (sf->request_mptcp)
-		flags |= SUBFLOW_FLAGS_MCAP_LOC;
+		flags |= MPTCP_SUBFLOW_FLAG_MCAP_LOC;
 	if (sf->mp_join)
-		flags |= SUBFLOW_FLAGS_JOIN_REM;
+		flags |= MPTCP_SUBFLOW_FLAG_JOIN_REM;
 	if (sf->request_join)
-		flags |= SUBFLOW_FLAGS_JOIN_LOC;
+		flags |= MPTCP_SUBFLOW_FLAG_JOIN_LOC;
 	if (sf->backup)
-		flags |= SUBFLOW_FLAGS_BKUP_REM;
+		flags |= MPTCP_SUBFLOW_FLAG_BKUP_REM;
 	if (sf->request_bkup)
-		flags |= SUBFLOW_FLAGS_BKUP_LOC;
+		flags |= MPTCP_SUBFLOW_FLAG_BKUP_LOC;
 	if (sf->fourth_ack)
-		flags |= SUBFLOW_FLAGS_4THACK;
+		flags |= MPTCP_SUBFLOW_FLAG_4THACK;
 	if (sf->conn_finished)
-		flags |= SUBFLOW_FLAGS_CONNECTED;
+		flags |= MPTCP_SUBFLOW_FLAG_CONNECTED;
 	if (sf->map_valid)
-		flags |= SUBFLOW_FLAGS_MAPVALID;
+		flags |= MPTCP_SUBFLOW_FLAG_MAPVALID;
 
 	if (nla_put_u32(skb, MPTCP_SUBFLOW_TOKEN_REM, sf->remote_token) ||
 	    nla_put_u32(skb, MPTCP_SUBFLOW_TOKEN_LOC, sf->token) ||
@@ -75,7 +75,7 @@ int subflow_get_info(const struct sock *sk, struct sk_buff *skb)
 	return err;
 }
 
-size_t subflow_get_info_size(const struct sock *sk)
+static size_t subflow_get_info_size(const struct sock *sk)
 {
 	size_t size = 0;
 
@@ -93,3 +93,9 @@ size_t subflow_get_info_size(const struct sock *sk)
 		0;
 	return size;
 }
+
+void mptcp_diag_subflow_init(struct tcp_ulp_ops *ops)
+{
+	ops->get_info = subflow_get_info;
+	ops->get_info_size = subflow_get_info_size;
+}
net/mptcp/protocol.h +1 -2
index ecbabf794fd3..3c66f69a734d 100644
@@ -315,7 +315,6 @@ static inline bool before64(__u64 seq1, __u64 seq2)
 
 #define after64(seq2, seq1)	before64(seq1, seq2)
 
-size_t subflow_get_info_size(const struct sock *sk);
-int subflow_get_info(const struct sock *sk, struct sk_buff *skb);
+void mptcp_diag_subflow_init(struct tcp_ulp_ops *ops);
 
 #endif /* __MPTCP_PROTOCOL_H */
net/mptcp/subflow.c +2 -2
index ab93dd86e33d..ebe93525b0aa 100644
@@ -505,8 +505,6 @@ static struct tcp_ulp_ops subflow_ulp_ops __read_mostly = {
 	.init		= subflow_ulp_init,
 	.release	= subflow_ulp_release,
 	.clone		= subflow_ulp_clone,
-	.get_info	= subflow_get_info,
-	.get_info_size	= subflow_get_info_size,
 };
 
 static int subflow_ops_init(struct request_sock_ops *subflow_ops)
@@ -542,6 +540,8 @@ void mptcp_subflow_init(void)
 	subflow_specific.sk_rx_dst_set = subflow_finish_connect;
 	subflow_specific.rebuild_header = subflow_rebuild_header;
 
+	mptcp_diag_subflow_init(&subflow_ulp_ops);
+
 	if (tcp_register_ulp(&subflow_ulp_ops) != 0)
 		panic("MPTCP: failed to register subflows to ULP\n");
 }
Signature · 1 line
2.20.1
#1 lore raw
Quoted 15 lines · Matthieu Baerts

To conform with the rest.

And only exposed one init function for diag.c

Suggested-by Davide Caratti <dcaratti(a)redhat.com>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
To be squashed in "mptcp: allow dumping subflow context to userspace" v2:
- MPTCP_SUBFLOW_FLAGS_ -> MPTCP_SUBFLOW_FLAG_ (Davide)
- only exposed a new function: mptcp_diag_subflow_init (Davide, Paolo)

Quoted 6 lines
 include/uapi/linux/mptcp.h | 18 +++++++++---------
 net/mptcp/diag.c           | 28 +++++++++++++++++-----------
 net/mptcp/protocol.h       |  3 +--
 net/mptcp/subflow.c        |  4 ++--
 4 files changed, 29 insertions(+), 24 deletions(-)

hello Matthieu,

LGTM, thanks for following up!

Signature · 1 line
davide
author
#2 lore raw

Hi Davide,

Quoted 23 lines · Davide Caratti
Quoted 15 lines · Matthieu Baerts

To conform with the rest.

And only exposed one init function for diag.c

Suggested-by Davide Caratti <dcaratti(a)redhat.com>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
To be squashed in "mptcp: allow dumping subflow context to userspace" v2:
- MPTCP_SUBFLOW_FLAGS_ -> MPTCP_SUBFLOW_FLAG_ (Davide)
- only exposed a new function: mptcp_diag_subflow_init (Davide, Paolo)

Quoted 6 lines
 include/uapi/linux/mptcp.h | 18 +++++++++---------
 net/mptcp/diag.c           | 28 +++++++++++++++++-----------
 net/mptcp/protocol.h       |  3 +--
 net/mptcp/subflow.c        |  4 ++--
 4 files changed, 29 insertions(+), 24 deletions(-)
Quoted 3 lines

hello Matthieu,

LGTM, thanks for following up!

Thank you for the review!

- 70c59362830a: "squashed" in "mptcp: allow dumping subflow context to userspace"
- 378418230fca: "signed-off-by", I hope you don't mind
- 331023afb717..ed7ca199c905: result

Tests are still OK!

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium