Skip to contentSkip to conversation

mptcp: misc stuff

PATCH In review Paolo Abeni 3 participants 6 messages Feb 22, 2021 – Feb 23, 2021

Subsystems (2)
lore
Share & tools
lore

Paolo Abeni

author
#0 lore raw

cover mptcp: misc stuff

A bunch of patches I kept sitting in my local three for a while The first 2 add a few more MIBs counters, for client and error detection's sake.
The last one cleans-up a bit msk->first usage.

Paolo Abeni (3):
mptcp: add mib for token creation fallback
mptcp: add active MPC mibs
mptcp: remove unneeded check on first subflow

 net/mptcp/mib.c      | 3 +++
 net/mptcp/mib.h      | 3 +++
 net/mptcp/options.c  | 2 +-
 net/mptcp/protocol.c | 8 ++++++--
 net/mptcp/subflow.c  | 4 ++++
 5 files changed, 17 insertions(+), 3 deletions(-)
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH 1/3 mptcp: add mib for token creation fallback

If the MPTCP protocol is unable to create a new token, the socket fallback to plain TCP, let's keep track of such events via a specific MIB.

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>
---
 net/mptcp/mib.c      | 1 +
 net/mptcp/mib.h      | 1 +
 net/mptcp/protocol.c | 4 +++-
 net/mptcp/subflow.c  | 3 +++
 4 files changed, 8 insertions(+), 1 deletion(-)
net/mptcp/mib.c +1 -0
index 3780c29c321d1..b0429aca4f76c 100644
@@ -13,6 +13,7 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("MPCapableACKRX", MPTCP_MIB_MPCAPABLEPASSIVEACK),
 	SNMP_MIB_ITEM("MPCapableFallbackACK", MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK),
 	SNMP_MIB_ITEM("MPCapableFallbackSYNACK", MPTCP_MIB_MPCAPABLEACTIVEFALLBACK),
+	SNMP_MIB_ITEM("MPFallbackTokenInit", MPTCP_MIB_TOKENFALLBACKINIT),
 	SNMP_MIB_ITEM("MPTCPRetrans", MPTCP_MIB_RETRANSSEGS),
 	SNMP_MIB_ITEM("MPJoinNoTokenFound", MPTCP_MIB_JOINNOTOKEN),
 	SNMP_MIB_ITEM("MPJoinSynRx", MPTCP_MIB_JOINSYNRX),
net/mptcp/mib.h +1 -0
index 72afbc135f8e7..50e1668c9a01c 100644
@@ -6,6 +6,7 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_MPCAPABLEPASSIVEACK,	/* Received third ACK with MP_CAPABLE */
 	MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK,/* Server-side fallback during 3-way handshake */
 	MPTCP_MIB_MPCAPABLEACTIVEFALLBACK, /* Client-side fallback during 3-way handshake */
+	MPTCP_MIB_TOKENFALLBACKINIT,	/* Could not init/allocate token */
 	MPTCP_MIB_RETRANSSEGS,		/* Segments retransmitted at the MPTCP-level */
 	MPTCP_MIB_JOINNOTOKEN,		/* Received MP_JOIN but the token was not found */
 	MPTCP_MIB_JOINSYNRX,		/* Received a SYN + MP_JOIN */
net/mptcp/protocol.c +3 -1
index cc0145fac1e90..920f577daecd6 100644
@@ -3218,8 +3218,10 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
 	if (rcu_access_pointer(tcp_sk(ssock->sk)->md5sig_info))
 		mptcp_subflow_early_fallback(msk, subflow);
 #endif
-	if (subflow->request_mptcp && mptcp_token_new_connect(ssock->sk))
+	if (subflow->request_mptcp && mptcp_token_new_connect(ssock->sk)) {
+		MPTCP_INC_STATS(sock_net(ssock->sk), MPTCP_MIB_TOKENFALLBACKINIT);
 		mptcp_subflow_early_fallback(msk, subflow);
+	}
 
 do_connect:
 	err = ssock->ops->connect(ssock, uaddr, addr_len, flags);
net/mptcp/subflow.c +3 -0
index e1fbcab257e6d..63f8b2f0e6a7d 100644
@@ -165,6 +165,7 @@ static int subflow_check_req(struct request_sock *req,
 			if (mptcp_token_exists(subflow_req->token)) {
 				if (retries-- > 0)
 					goto again;
+				SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_TOKENFALLBACKINIT);
 			} else {
 				subflow_req->mp_capable = 1;
 			}
@@ -176,6 +177,8 @@ static int subflow_check_req(struct request_sock *req,
 			subflow_req->mp_capable = 1;
 		else if (retries-- > 0)
 			goto again;
+		else
+			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_TOKENFALLBACKINIT);
 
 	} else if (mp_opt.mp_join && listener->request_mptcp) {
 		subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq;
Signature · 1 line
2.26.2
author
#2 lore raw

PATCH 2/3 mptcp: add active MPC mibs

In reply to Paolo Abeni

We are not currently tracking the active MPTCP connection attempts. Let's add the related counters.

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>
---
 net/mptcp/mib.c      | 2 ++
 net/mptcp/mib.h      | 2 ++
 net/mptcp/protocol.c | 2 ++
 net/mptcp/subflow.c  | 1 +
 4 files changed, 7 insertions(+)
net/mptcp/mib.c +2 -0
index b0429aca4f76c..eb2dc6dbe212b 100644
@@ -10,6 +10,8 @@
 
 static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("MPCapableSYNRX", MPTCP_MIB_MPCAPABLEPASSIVE),
+	SNMP_MIB_ITEM("MPCapableSYNTX", MPTCP_MIB_MPCAPABLEACTIVE),
+	SNMP_MIB_ITEM("MPCapableSYNACKRX", MPTCP_MIB_MPCAPABLEACTIVEACK),
 	SNMP_MIB_ITEM("MPCapableACKRX", MPTCP_MIB_MPCAPABLEPASSIVEACK),
 	SNMP_MIB_ITEM("MPCapableFallbackACK", MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK),
 	SNMP_MIB_ITEM("MPCapableFallbackSYNACK", MPTCP_MIB_MPCAPABLEACTIVEFALLBACK),
net/mptcp/mib.h +2 -0
index 50e1668c9a01c..f0da4f060fe1a 100644
@@ -3,6 +3,8 @@
 enum linux_mptcp_mib_field {
 	MPTCP_MIB_NUM = 0,
 	MPTCP_MIB_MPCAPABLEPASSIVE,	/* Received SYN with MP_CAPABLE */
+	MPTCP_MIB_MPCAPABLEACTIVE,	/* Sent SYN with MP_CAPABLE */
+	MPTCP_MIB_MPCAPABLEACTIVEACK,	/* Received SYN/ACK with MP_CAPABLE */
 	MPTCP_MIB_MPCAPABLEPASSIVEACK,	/* Received third ACK with MP_CAPABLE */
 	MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK,/* Server-side fallback during 3-way handshake */
 	MPTCP_MIB_MPCAPABLEACTIVEFALLBACK, /* Client-side fallback during 3-way handshake */
net/mptcp/protocol.c +2 -0
index 920f577daecd6..615fd81faa9a3 100644
@@ -3222,6 +3222,8 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
 		MPTCP_INC_STATS(sock_net(ssock->sk), MPTCP_MIB_TOKENFALLBACKINIT);
 		mptcp_subflow_early_fallback(msk, subflow);
 	}
+	if (likely(!__mptcp_check_fallback(msk)))
+		MPTCP_INC_STATS(sock_net(sock->sk), MPTCP_MIB_MPCAPABLEACTIVE);
 
 do_connect:
 	err = ssock->ops->connect(ssock, uaddr, addr_len, flags);
net/mptcp/subflow.c +1 -0
index 63f8b2f0e6a7d..3cad8aa0c2d67 100644
@@ -395,6 +395,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 		subflow->remote_key = mp_opt.sndr_key;
 		pr_debug("subflow=%p, remote_key=%llu", subflow,
 			 subflow->remote_key);
+		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK);
 		mptcp_finish_connect(sk);
 	} else if (subflow->request_join) {
 		u8 hmac[SHA256_DIGEST_SIZE];
Signature · 1 line
2.26.2
author
#3 lore raw

PATCH 3/3 mptcp: remove unneeded check on first subflow

In reply to Paolo Abeni

Currently we explicitly check for the first subflow being NULL in a couple of places, even if we don't need any special actions in such scenario.

Just drop the unneeded checks, to avoid confusion.

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>
---
 net/mptcp/options.c  | 2 +-
 net/mptcp/protocol.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
net/mptcp/options.c +1 -1
index b252aadad3fc8..6a9bfc1b9d9c6 100644
@@ -950,7 +950,7 @@ bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool us
 	 * should match. If they mismatch, the peer is misbehaving and
 	 * we will prefer the most recent information.
 	 */
-	if (READ_ONCE(msk->rcv_data_fin) || !READ_ONCE(msk->first))
+	if (READ_ONCE(msk->rcv_data_fin))
 		return false;
 
 	WRITE_ONCE(msk->rcv_data_fin_seq,
net/mptcp/protocol.c +1 -1
index 615fd81faa9a3..2d361c923a07d 100644
@@ -493,7 +493,7 @@ static bool mptcp_check_data_fin(struct sock *sk)
 	u64 rcv_data_fin_seq;
 	bool ret = false;
 
-	if (__mptcp_check_fallback(msk) || !msk->first)
+	if (__mptcp_check_fallback(msk))
 		return ret;
 
 	/* Need to ack a DATA_FIN received from a peer while this side
Signature · 1 line
2.26.2
Reviewed-by on the v1 series
#4 lore raw
In reply to Paolo Abeni
Quoted 10 lines · Paolo Abeni

A bunch of patches I kept sitting in my local three for a while The first 2 add a few more MIBs counters, for client and error detection's sake.
The last one cleans-up a bit msk->first usage.

Paolo Abeni (3):
mptcp: add mib for token creation fallback
mptcp: add active MPC mibs
mptcp: remove unneeded check on first subflow

Quoted 9 lines
net/mptcp/mib.c      | 3 +++
net/mptcp/mib.h      | 3 +++
net/mptcp/options.c  | 2 +-
net/mptcp/protocol.c | 8 ++++++--
net/mptcp/subflow.c  | 4 ++++
5 files changed, 17 insertions(+), 3 deletions(-)
Signature · 1 line
2.26.2

These look good for the export branch, thanks Paolo.

Reviewed-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>

--
Mat Martineau
Intel

#5 lore raw
In reply to Paolo Abeni

Hi Paolo, Mat,

Quoted 9 lines · Paolo Abeni

A bunch of patches I kept sitting in my local three for a while The first 2 add a few more MIBs counters, for client and error detection's sake.
The last one cleans-up a bit msk->first usage.

Paolo Abeni (3):
mptcp: add mib for token creation fallback
mptcp: add active MPC mibs
mptcp: remove unneeded check on first subflow

Thank you for the patches and the reviews!

Just applied at the end of the tree with Mat's RvB tags:

- 126867fc6c69: mptcp: add mib for token creation fallback
- d79fd47eb3ff: mptcp: add active MPC mibs
- a067c0c19a59: mptcp: remove unneeded check on first subflow
- Results: 8d9171e1a9d2..12ba6e545134

Tests + export are in progress!

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net