Skip to contentSkip to conversation

mptcp: Consistently use READ_ONCE/WRITE_ONCE with msk->ack_seq

RFC PATCH In review Mat Martineau 3 participants 10 messages Sep 26, 2020 – Sep 30, 2020

Subsystems (2)
lore
Share & tools
lore

Mat Martineau

author
#0 lore raw

RFC PATCH 1/2 mptcp: Consistently use READ_ONCE/WRITE_ONCE with msk->ack_seq

The msk->ack_seq value is sometimes read without the msk lock held, so make proper use of READ_ONCE and WRITE_ONCE.

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

---

This does create some merge conflicts with net-next - what's the best way to handle that?

net/mptcp/options.c | 4 ++--

 net/mptcp/protocol.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
net/mptcp/options.c +2 -2
index 7fa822b55c34..120ef39fe589 100644
@@ -518,11 +518,11 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 
 	if (subflow->use_64bit_ack) {
 		ack_size = TCPOLEN_MPTCP_DSS_ACK64;
-		opts->ext_copy.data_ack = msk->ack_seq;
+		opts->ext_copy.data_ack = READ_ONCE(msk->ack_seq);
 		opts->ext_copy.ack64 = 1;
 	} else {
 		ack_size = TCPOLEN_MPTCP_DSS_ACK32;
-		opts->ext_copy.data_ack32 = (uint32_t)(msk->ack_seq);
+		opts->ext_copy.data_ack32 = (uint32_t)READ_ONCE(msk->ack_seq);
 		opts->ext_copy.ack64 = 0;
 	}
 	opts->ext_copy.use_ack = 1;
net/mptcp/protocol.c +4 -4
index 365ba96c84b0..5d747c6a610e 100644
@@ -123,7 +123,7 @@ static void __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
 
 	skb_ext_reset(skb);
 	skb_orphan(skb);
-	msk->ack_seq += copy_len;
+	WRITE_ONCE(msk->ack_seq, msk->ack_seq + copy_len);
 
 	tail = skb_peek_tail(&sk->sk_receive_queue);
 	if (offset == 0 && tail) {
@@ -261,7 +261,7 @@ static void mptcp_check_data_fin(struct sock *sk)
 	if (mptcp_pending_data_fin(sk, &rcv_data_fin_seq)) {
 		struct mptcp_subflow_context *subflow;
 
-		msk->ack_seq++;
+		WRITE_ONCE(msk->ack_seq, msk->ack_seq + 1);
 		WRITE_ONCE(msk->rcv_data_fin, 0);
 
 		sk->sk_shutdown |= RCV_SHUTDOWN;
@@ -1720,7 +1720,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk,
 		msk->remote_key = mp_opt->sndr_key;
 		mptcp_crypto_key_sha(msk->remote_key, NULL, &ack_seq);
 		ack_seq++;
-		msk->ack_seq = ack_seq;
+		WRITE_ONCE(msk->ack_seq, ack_seq);
 	}
 
 	sock_reset_flag(nsk, SOCK_RCU_FREE);
@@ -2072,7 +2072,7 @@ bool mptcp_finish_join(struct sock *sk)
 	parent_sock = READ_ONCE(parent->sk_socket);
 	if (parent_sock && !sk->sk_socket)
 		mptcp_sock_graft(sk, parent_sock);
-	subflow->map_seq = msk->ack_seq;
+	subflow->map_seq = READ_ONCE(msk->ack_seq);
 	return true;
 }
 

base-commit: 4e1b469ab0c2c6e6611a0af9f88c7745250dbf64

Signature · 1 line
2.28.0
author
#1 lore raw

RFC PATCH 2/2 mptcp: Handle incoming 32-bit DATA_FIN values

The peer may send a DATA_FIN mapping with either a 32-bit or 64-bit sequence number. When a 32-bit sequence number is received for the DATA_FIN, it must be expanded to 64 bits before comparing it to the last acked sequence number. This expansion was missing.

Fixes 3721b9b64676 (mptcp: Track received DATA_FIN sequence number and add related helpers)
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
---
 net/mptcp/options.c  |  7 ++++---
 net/mptcp/protocol.h |  2 +-
 net/mptcp/subflow.c  | 17 ++++++++++++++---
 3 files changed, 19 insertions(+), 7 deletions(-)
net/mptcp/options.c +4 -3
index 120ef39fe589..afa486912f5a 100644
@@ -782,7 +782,7 @@ static void update_una(struct mptcp_sock *msk,
 	}
 }
 
-bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq)
+bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit)
 {
 	/* Skip if DATA_FIN was already received.
 	 * If updating simultaneously with the recvmsg loop, values
@@ -792,7 +792,8 @@ bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq)
 	if (READ_ONCE(msk->rcv_data_fin) || !READ_ONCE(msk->first))
 		return false;
 
-	WRITE_ONCE(msk->rcv_data_fin_seq, data_fin_seq);
+	WRITE_ONCE(msk->rcv_data_fin_seq,
+		   expand_ack(READ_ONCE(msk->ack_seq), data_fin_seq, use_64bit));
 	WRITE_ONCE(msk->rcv_data_fin, 1);
 
 	return true;
@@ -875,7 +876,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
 	 */
 	if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) {
 		if (mp_opt.data_fin && mp_opt.data_len == 1 &&
-		    mptcp_update_rcv_data_fin(msk, mp_opt.data_seq) &&
+		    mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64) &&
 		    schedule_work(&msk->work))
 			sock_hold(subflow->conn);
 
net/mptcp/protocol.h +1 -1
index 60b27d44c184..20f04ac85409 100644
@@ -387,7 +387,7 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk);
 bool mptcp_finish_join(struct sock *sk);
 void mptcp_data_acked(struct sock *sk);
 void mptcp_subflow_eof(struct sock *sk);
-bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq);
+bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit);
 
 void __init mptcp_token_init(void);
 static inline void mptcp_token_init_request(struct request_sock *req)
net/mptcp/subflow.c +14 -3
index 8cbeb68f3775..8519962af3ba 100644
@@ -731,7 +731,8 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 
 	if (mpext->data_fin == 1) {
 		if (data_len == 1) {
-			bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq);
+			bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq,
+								 mpext->dsn64);
 			pr_debug("DATA_FIN with no payload seq=%llu", mpext->data_seq);
 			if (subflow->map_valid) {
 				/* A DATA_FIN might arrive in a DSS
@@ -748,8 +749,18 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 				return MAPPING_DATA_FIN;
 			}
 		} else {
-			mptcp_update_rcv_data_fin(msk, mpext->data_seq + data_len);
-			pr_debug("DATA_FIN with mapping seq=%llu", mpext->data_seq + data_len);
+			u64 data_fin_seq;
+
+			if (mpext->dsn64) {
+				data_fin_seq = mpext->data_seq;
+			} else {
+				data_fin_seq = expand_seq(subflow->map_seq,
+							  subflow->map_data_len,
+							  mpext->data_seq);
+			}
+
+			mptcp_update_rcv_data_fin(msk, data_fin_seq + data_len, 1);
+			pr_debug("DATA_FIN with mapping seq=%llu", data_fin_seq + data_len);
 		}
 
 		/* Adjust for DATA_FIN using 1 byte of sequence space */
Signature · 1 line
2.28.0
author
#2 lore raw

[MPTCP] Re: [RFC PATCH net 2/2] mptcp: Handle incoming 32-bit DATA_FIN values

Quoted 8 lines · Mat Martineau

The peer may send a DATA_FIN mapping with either a 32-bit or 64-bit sequence number. When a 32-bit sequence number is received for the DATA_FIN, it must be expanded to 64 bits before comparing it to the last acked sequence number. This expansion was missing.

Fixes 3721b9b64676 (mptcp: Track received DATA_FIN sequence number and add related helpers)
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>

I'm hoping to send this to netdev on Tuesday, anyone see any problem with that plan?

What's the best way to handle introducing code to -net that will create a conflict on a future net-next merge?

Thanks,

Mat

Quoted 90 lines

---

net/mptcp/options.c  |  7 ++++---
net/mptcp/protocol.h |  2 +-
net/mptcp/subflow.c  | 17 ++++++++++++++---
3 files changed, 19 insertions(+), 7 deletions(-)
net/mptcp/options.c +4 -3
index 120ef39fe589..afa486912f5a 100644
@@ -782,7 +782,7 @@ static void update_una(struct mptcp_sock *msk,
 	}
 }
 
-bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq)
+bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit)
 {
 	/* Skip if DATA_FIN was already received.
 	 * If updating simultaneously with the recvmsg loop, values
@@ -792,7 +792,8 @@ bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq)
 	if (READ_ONCE(msk->rcv_data_fin) || !READ_ONCE(msk->first))
 		return false;
 
-	WRITE_ONCE(msk->rcv_data_fin_seq, data_fin_seq);
+	WRITE_ONCE(msk->rcv_data_fin_seq,
+		   expand_ack(READ_ONCE(msk->ack_seq), data_fin_seq, use_64bit));
 	WRITE_ONCE(msk->rcv_data_fin, 1);
 
 	return true;
@@ -875,7 +876,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
 	 */
 	if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) {
 		if (mp_opt.data_fin && mp_opt.data_len == 1 &&
-		    mptcp_update_rcv_data_fin(msk, mp_opt.data_seq) &&
+		    mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64) &&
 		    schedule_work(&msk->work))
 			sock_hold(subflow->conn);
 
net/mptcp/protocol.h +1 -1
index 60b27d44c184..20f04ac85409 100644
@@ -387,7 +387,7 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk);
 bool mptcp_finish_join(struct sock *sk);
 void mptcp_data_acked(struct sock *sk);
 void mptcp_subflow_eof(struct sock *sk);
-bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq);
+bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit);
 
 void __init mptcp_token_init(void);
 static inline void mptcp_token_init_request(struct request_sock *req)
net/mptcp/subflow.c +14 -3
index 8cbeb68f3775..8519962af3ba 100644
@@ -731,7 +731,8 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 
 	if (mpext->data_fin == 1) {
 		if (data_len == 1) {
-			bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq);
+			bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq,
+								 mpext->dsn64);
 			pr_debug("DATA_FIN with no payload seq=%llu", mpext->data_seq);
 			if (subflow->map_valid) {
 				/* A DATA_FIN might arrive in a DSS
@@ -748,8 +749,18 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 				return MAPPING_DATA_FIN;
 			}
 		} else {
-			mptcp_update_rcv_data_fin(msk, mpext->data_seq + data_len);
-			pr_debug("DATA_FIN with mapping seq=%llu", mpext->data_seq + data_len);
+			u64 data_fin_seq;
+
+			if (mpext->dsn64) {
+				data_fin_seq = mpext->data_seq;
+			} else {
+				data_fin_seq = expand_seq(subflow->map_seq,
+							  subflow->map_data_len,
+							  mpext->data_seq);
+			}
+
+			mptcp_update_rcv_data_fin(msk, data_fin_seq + data_len, 1);
+			pr_debug("DATA_FIN with mapping seq=%llu", data_fin_seq + data_len);
 		}
 
 		/* Adjust for DATA_FIN using 1 byte of sequence space */
Signature · 1 line
2.28.0

--
Mat Martineau
Intel

#3 lore raw

[MPTCP] Re: [RFC PATCH net 2/2] mptcp: Handle incoming 32-bit DATA_FIN values

In reply to Mat Martineau
Quoted 78 lines · Mat Martineau

The peer may send a DATA_FIN mapping with either a 32-bit or 64-bit sequence number. When a 32-bit sequence number is received for the DATA_FIN, it must be expanded to 64 bits before comparing it to the last acked sequence number. This expansion was missing.

Fixes 3721b9b64676 (mptcp: Track received DATA_FIN sequence number and add related helpers)
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
---
 net/mptcp/options.c  |  7 ++++---
 net/mptcp/protocol.h |  2 +-
 net/mptcp/subflow.c  | 17 ++++++++++++++---
 3 files changed, 19 insertions(+), 7 deletions(-)
net/mptcp/options.c +4 -3
index 120ef39fe589..afa486912f5a 100644
@@ -782,7 +782,7 @@ static void update_una(struct mptcp_sock *msk,
 	}
 }
 
-bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq)
+bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit)
 {
 	/* Skip if DATA_FIN was already received.
 	 * If updating simultaneously with the recvmsg loop, values
@@ -792,7 +792,8 @@ bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq)
 	if (READ_ONCE(msk->rcv_data_fin) || !READ_ONCE(msk->first))
 		return false;
 
-	WRITE_ONCE(msk->rcv_data_fin_seq, data_fin_seq);
+	WRITE_ONCE(msk->rcv_data_fin_seq,
+		   expand_ack(READ_ONCE(msk->ack_seq), data_fin_seq, use_64bit));
 	WRITE_ONCE(msk->rcv_data_fin, 1);
 
 	return true;
@@ -875,7 +876,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
 	 */
 	if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) {
 		if (mp_opt.data_fin && mp_opt.data_len == 1 &&
-		    mptcp_update_rcv_data_fin(msk, mp_opt.data_seq) &&
+		    mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64) &&
 		    schedule_work(&msk->work))
 			sock_hold(subflow->conn);
 
net/mptcp/protocol.h +1 -1
index 60b27d44c184..20f04ac85409 100644
@@ -387,7 +387,7 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk);
 bool mptcp_finish_join(struct sock *sk);
 void mptcp_data_acked(struct sock *sk);
 void mptcp_subflow_eof(struct sock *sk);
-bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq);
+bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit);
 
 void __init mptcp_token_init(void);
 static inline void mptcp_token_init_request(struct request_sock *req)
net/mptcp/subflow.c +2 -2
index 8cbeb68f3775..8519962af3ba 100644
@@ -731,7 +731,8 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 
 	if (mpext->data_fin == 1) {
 		if (data_len == 1) {
-			bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq);
+			bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq,
+								 mpext->dsn64);
 			pr_debug("DATA_FIN with no payload seq=%llu", mpext->data_seq);
 			if (subflow->map_valid) {
 				/* A DATA_FIN might arrive in a DSS
@@ -748,8 +749,18 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 				return MAPPING_DATA_FIN;
 			}
 		} else {
-			mptcp_update_rcv_data_fin(msk, mpext->data_seq + data_len);

net/mptcp/subflow.c static enum mapping_status get_mapping_status(struct sock *ssk, · line 760

Quoted 10 lines
net/mptcp/subflow.c +9 -1
-			pr_debug("DATA_FIN with mapping seq=%llu", mpext->data_seq + data_len);
+			u64 data_fin_seq;
+
+			if (mpext->dsn64) {
+				data_fin_seq = mpext->data_seq;
+			} else {
+				data_fin_seq = expand_seq(subflow->map_seq,
+							  subflow->map_data_len,
+							  mpext->data_seq);
+			}

If you wrap the above chunk of code in an helper, you can additionally remove some code duplication with a similar chunk.

Not strictly related to this patch, but it looks like (to me) that seq expansion is done in a way more conforming to the RFC in expand_ack() and it feels strange we have 2 different helper to do the expansions, perhaps we should unify them?

/P

author
#4 lore raw

[MPTCP] Re: [RFC PATCH net 2/2] mptcp: Handle incoming 32-bit DATA_FIN values

Quoted 93 lines · Paolo Abeni
Quoted 78 lines · Mat Martineau

The peer may send a DATA_FIN mapping with either a 32-bit or 64-bit sequence number. When a 32-bit sequence number is received for the DATA_FIN, it must be expanded to 64 bits before comparing it to the last acked sequence number. This expansion was missing.

Fixes 3721b9b64676 (mptcp: Track received DATA_FIN sequence number and add related helpers)
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
---
 net/mptcp/options.c  |  7 ++++---
 net/mptcp/protocol.h |  2 +-
 net/mptcp/subflow.c  | 17 ++++++++++++++---
 3 files changed, 19 insertions(+), 7 deletions(-)
net/mptcp/options.c +4 -3
index 120ef39fe589..afa486912f5a 100644
@@ -782,7 +782,7 @@ static void update_una(struct mptcp_sock *msk,
 	}
 }
 
-bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq)
+bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit)
 {
 	/* Skip if DATA_FIN was already received.
 	 * If updating simultaneously with the recvmsg loop, values
@@ -792,7 +792,8 @@ bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq)
 	if (READ_ONCE(msk->rcv_data_fin) || !READ_ONCE(msk->first))
 		return false;
 
-	WRITE_ONCE(msk->rcv_data_fin_seq, data_fin_seq);
+	WRITE_ONCE(msk->rcv_data_fin_seq,
+		   expand_ack(READ_ONCE(msk->ack_seq), data_fin_seq, use_64bit));
 	WRITE_ONCE(msk->rcv_data_fin, 1);
 
 	return true;
@@ -875,7 +876,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
 	 */
 	if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) {
 		if (mp_opt.data_fin && mp_opt.data_len == 1 &&
-		    mptcp_update_rcv_data_fin(msk, mp_opt.data_seq) &&
+		    mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64) &&
 		    schedule_work(&msk->work))
 			sock_hold(subflow->conn);
 
net/mptcp/protocol.h +1 -1
index 60b27d44c184..20f04ac85409 100644
@@ -387,7 +387,7 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk);
 bool mptcp_finish_join(struct sock *sk);
 void mptcp_data_acked(struct sock *sk);
 void mptcp_subflow_eof(struct sock *sk);
-bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq);
+bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit);
 
 void __init mptcp_token_init(void);
 static inline void mptcp_token_init_request(struct request_sock *req)
net/mptcp/subflow.c +2 -2
index 8cbeb68f3775..8519962af3ba 100644
@@ -731,7 +731,8 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 
 	if (mpext->data_fin == 1) {
 		if (data_len == 1) {
-			bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq);
+			bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq,
+								 mpext->dsn64);
 			pr_debug("DATA_FIN with no payload seq=%llu", mpext->data_seq);
 			if (subflow->map_valid) {
 				/* A DATA_FIN might arrive in a DSS
@@ -748,8 +749,18 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 				return MAPPING_DATA_FIN;
 			}
 		} else {
-			mptcp_update_rcv_data_fin(msk, mpext->data_seq + data_len);

net/mptcp/subflow.c static enum mapping_status get_mapping_status(struct sock *ssk, · line 760

Quoted 10 lines
net/mptcp/subflow.c +9 -1
-			pr_debug("DATA_FIN with mapping seq=%llu", mpext->data_seq + data_len);
+			u64 data_fin_seq;
+
+			if (mpext->dsn64) {
+				data_fin_seq = mpext->data_seq;
+			} else {
+				data_fin_seq = expand_seq(subflow->map_seq,
+							  subflow->map_data_len,
+							  mpext->data_seq);
+			}

If you wrap the above chunk of code in an helper, you can additionally remove some code duplication with a similar chunk.

Quoted 4 lines

Not strictly related to this patch, but it looks like (to me) that seq expansion is done in a way more conforming to the RFC in expand_ack() and it feels strange we have 2 different helper to do the expansions, perhaps we should unify them?

Yes, I do think it would be good to unify them (but separately from this patch). Having taken another look, I think this patch is cleaner if mptcp_update_rcv_data_fin() does the expansion.

--
Mat Martineau
Intel

#5 lore raw
In reply to Mat Martineau

Hi Mat,

Quoted 8 lines · Mat Martineau

The msk->ack_seq value is sometimes read without the msk lock held, so make proper use of READ_ONCE and WRITE_ONCE.

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

---

This does create some merge conflicts with net-next - what's the best way to handle that?

Should we send to netdev ML about how we resolve the conflicts?

I am adding the two patches you sent upstream to the "export" branch and resolved the conflicts.

- d80ba0d7cf7f: mptcp: Consistently use READ_ONCE/WRITE_ONCE with msk->ack_seq
- 69bd9c6e1c45: mptcp: Handle incoming 32-bit DATA_FIN values

About the conflicts I had:

Patch 1:
- protocol.c: using the version from net-next and modifying __mptcp_move_skb() where we have:

   msk->ack_seq += copy_len;

Patch 2:
- subflow.c: we don't use the returned value of mptcp_update_rcv_data_fin() in net-next
- protocol.h: we take the new version of mptcp_update_rcv_data_fin() and we keep mptcp_destroy_common() unchanged.

I don't know if we need to provide a Git repo or a diff. Note that on my side, I don't have the result of a merge but a modification of the patches for net-next. I don't think that's what they want.

Note that we no longer read the output of mptcp_update_rcv_data_fin().

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#6 lore raw

Hi Mat,

Quoted 13 lines · Matthieu Baerts

Hi Mat,

Quoted 8 lines · Mat Martineau

The msk->ack_seq value is sometimes read without the msk lock held, so make proper use of READ_ONCE and WRITE_ONCE.

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

---

This does create some merge conflicts with net-next - what's the best way to handle that?

Should we send to netdev ML about how we resolve the conflicts?

(...)

Quoted 3 lines

Patch 2:
- subflow.c: we don't use the returned value of
mptcp_update_rcv_data_fin() in net-next

I just noticed your commit ef59b1953c26 ("mptcp: Wake up MPTCP worker when DATA_FIN found on a TCP FIN packet") is not on net-next yet.

So we do use the returned value if I put your two new patches on top of ef59b1953c26!

The "export" branch is going to be updated soon.

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#7 lore raw

Hi Mat,

Quoted 23 lines · Matthieu Baerts

Hi Mat,

Quoted 13 lines · Matthieu Baerts

Hi Mat,

Quoted 8 lines · Mat Martineau

The msk->ack_seq value is sometimes read without the msk lock held, so make proper use of READ_ONCE and WRITE_ONCE.

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

---

This does create some merge conflicts with net-next - what's the best way to handle that?

Should we send to netdev ML about how we resolve the conflicts?

(...)

Quoted 3 lines

Patch 2:
- subflow.c: we don't use the returned value of
mptcp_update_rcv_data_fin() in net-next

Quoted 7 lines

I just noticed your commit ef59b1953c26 ("mptcp: Wake up MPTCP worker when DATA_FIN found on a TCP FIN packet") is not on net-next yet.

So we do use the returned value if I put your two new patches on top of ef59b1953c26!

The "export" branch is going to be updated soon.

I also just pushed a new branch: merge_net_net-next_20200930

You can have a look at bac51c27a3c9 ("Merge remote-tracking branch 'net' into net-next") for the merge resolution. We have the explanation with 'git show' but I don't know if we can have the same view on GitHub.

This link is not helpful :)

https://github.com/multipath-tcp/mptcp_net-next/commit/merge_net_net-next_20200930

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
author
#8 lore raw
Quoted 36 lines · Matthieu Baerts

Hi Mat,

Quoted 23 lines · Matthieu Baerts

Hi Mat,

Quoted 13 lines · Matthieu Baerts

Hi Mat,

Quoted 8 lines · Mat Martineau

The msk->ack_seq value is sometimes read without the msk lock held, so make proper use of READ_ONCE and WRITE_ONCE.

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

---

This does create some merge conflicts with net-next - what's the best way to handle that?

Should we send to netdev ML about how we resolve the conflicts?

(...)

Quoted 3 lines

Patch 2:
- subflow.c: we don't use the returned value of
mptcp_update_rcv_data_fin() in net-next

Quoted 7 lines

I just noticed your commit ef59b1953c26 ("mptcp: Wake up MPTCP worker when DATA_FIN found on a TCP FIN packet") is not on net-next yet.

So we do use the returned value if I put your two new patches on top of ef59b1953c26!

The "export" branch is going to be updated soon.

I also just pushed a new branch: merge_net_net-next_20200930

Quoted 8 lines

You can have a look at bac51c27a3c9 ("Merge remote-tracking branch 'net' into net-next") for the merge resolution. We have the explanation with 'git show' but I don't know if we can have the same view on GitHub.

This link is not helpful :)

https://github.com/multipath-tcp/mptcp_net-next/commit/merge_net_net-next_20200930

Hi Matthieu -

I mentioned my recommended merge resolution in the cover letter for the latest -net changes:

"""
This does introduce two merge conflicts with net-next, but both have straightforward resolution. Patch 1 modifies a line that got removed in net-next so the modification can be dropped when merging. Patch 2 will require a trivial conflict resolution for a modified function declaration.
"""

Rather than update __mptcp_move_skb() as part of the merge commit, I think it would be better to just drop the change during the merge and send a separate patch to net-next to add the WRITE_ONCE() to __mptcp_move_skb().

--
Mat Martineau
Intel

#9 lore raw

Hi Mat,

Quoted 54 lines · Mat Martineau
Quoted 36 lines · Matthieu Baerts

Hi Mat,

Quoted 23 lines · Matthieu Baerts

Hi Mat,

Quoted 13 lines · Matthieu Baerts

Hi Mat,

Quoted 8 lines · Mat Martineau

The msk->ack_seq value is sometimes read without the msk lock held, so make proper use of READ_ONCE and WRITE_ONCE.

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

---

This does create some merge conflicts with net-next - what's the best way to handle that?

Should we send to netdev ML about how we resolve the conflicts?

(...)

Quoted 3 lines

Patch 2:
- subflow.c: we don't use the returned value of
mptcp_update_rcv_data_fin() in net-next

Quoted 7 lines

I just noticed your commit ef59b1953c26 ("mptcp: Wake up MPTCP worker when DATA_FIN found on a TCP FIN packet") is not on net-next yet.

So we do use the returned value if I put your two new patches on top of ef59b1953c26!

The "export" branch is going to be updated soon.

I also just pushed a new branch: merge_net_net-next_20200930

Quoted 10 lines

You can have a look at bac51c27a3c9 ("Merge remote-tracking branch 'net' into net-next") for the merge resolution. We have the explanation with 'git show' but I don't know if we can have the same view on GitHub.

This link is not helpful :)

https://github.com/multipath-tcp/mptcp_net-next/commit/merge_net_net-next_20200930

Hi Matthieu -

I mentioned my recommended merge resolution in the cover letter for the latest -net changes:

Quoted 7 lines

"""
This does introduce two merge conflicts with net-next, but both have straightforward resolution. Patch 1 modifies a line that got removed in net-next so the modification can be dropped when merging. Patch 2 will require a trivial conflict resolution for a modified function declaration.
"""

Indeed, my bad, I missed that!

Quoted 4 lines

Rather than update __mptcp_move_skb() as part of the merge commit, I think it would be better to just drop the change during the merge and send a separate patch to net-next to add the WRITE_ONCE() to __mptcp_move_skb().

Indeed, certainly easier for the maintainer. We will have to remember fixing this but I should keep track of this particular modification in the "export" branch anyway.

Cheers,
Matt

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