The infinite mapping support
Subsystems (3)
cover The infinite mapping support
From: Geliang Tang <[email protected]>
v1:
- add noncontiguous flag
- add the mibs check
- tag: export/20210904T080009
Geliang Tang (6):
mptcp: add noncontiguous flag
mptcp: infinite mapping sending
mptcp: infinite mapping receiving
mptcp: add a mib for the infinite mapping sending
selftests: mptcp: add infinite map mibs check
DO-NOT-MERGE: mptcp: mp_fail test
net/mptcp/mib.c | 1 + net/mptcp/mib.h | 1 + net/mptcp/options.c | 8 +++ net/mptcp/pm.c | 6 ++ net/mptcp/protocol.c | 40 ++++++++++++- net/mptcp/protocol.h | 4 ++ net/mptcp/subflow.c | 18 +++--- .../testing/selftests/net/mptcp/mptcp_join.sh | 56 +++++++++++++++++++ 8 files changed, 124 insertions(+), 10 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/6 mptcp: add noncontiguous flag
From: Geliang Tang <[email protected]>
This patch added a "noncontiguous" flag in the msk to track whether the data is contiguous on a subflow. When retransmission happens, we could set this flag, and once all retransmissions are DATA_ACK'd that flag could be cleared.
When a bad checksum is detected and a single contiguous subflow is in use, don't send RST + MP_FAIL, send data_ack + MP_FAIL instead.
--- net/mptcp/protocol.c | 13 ++++++++++--- net/mptcp/protocol.h | 1 + net/mptcp/subflow.c | 12 ++++++------ 3 files changed, 17 insertions(+), 9 deletions(-)
net/mptcp/protocol.c +10 -3
@@ -1098,8 +1098,10 @@ static void __mptcp_clean_una(struct sock *sk) }/* all retransmitted data acked, recovery completed */ -if (unlikely (msk->recovery) &&after64 (msk->snd_una, msk->recovery_snd_nxt)) +if (unlikely (msk->recovery) &&after64 (msk->snd_una, msk->recovery_snd_nxt)) { msk->recovery = false; +WRITE_ONCE (msk->noncontiguous, false); + } out:if (cleaned &&tcp_under_memory_pressure (sk))
@@ -2502,8 +2504,10 @@ static void mptcp_worker(struct work_struct *work)if (test_and_clear_bit (MPTCP_WORK_CLOSE_SUBFLOW , &msk->flags))__mptcp_close_subflow (msk); -if (test_and_clear_bit (MPTCP_WORK_RTX , &msk->flags)) +if (test_and_clear_bit (MPTCP_WORK_RTX , &msk->flags)) { +WRITE_ONCE (msk->noncontiguous, true);__mptcp_retrans (sk); + } unlock:release_sock (sk);
@@ -2872,6 +2876,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk,WRITE_ONCE (msk->fully_established, false);if (mp_opt->suboptions &OPTION_MPTCP_CSUMREQD )WRITE_ONCE (msk->csum_enabled, true); +WRITE_ONCE (msk->noncontiguous, false); msk->write_seq = subflow_req->idsn +1 ; msk->snd_nxt = msk->write_seq;
@@ -3040,8 +3045,10 @@ static void mptcp_release_cb(struct sock *sk)spin_unlock_bh (&sk->sk_lock.slock);if (flags &BIT (MPTCP_PUSH_PENDING ))__mptcp_push_pending (sk,0 ); -if (flags &BIT (MPTCP_RETRANSMIT )) +if (flags &BIT (MPTCP_RETRANSMIT )) { +WRITE_ONCE (mptcp_sk (sk)->noncontiguous, true);__mptcp_retrans (sk); + }cond_resched ();spin_lock_bh (&sk->sk_lock.slock);
net/mptcp/protocol.h +1 -0
@@ -249,6 +249,7 @@ struct mptcp_sock {bool rcv_fastclose;bool use_64bit_ack;/* Set when we received a 64-bit DSN */ bool csum_enabled; +bool noncontiguous;spinlock_t join_list_lock;struct work_struct work;struct sk_buff *ooo_last_skb;
net/mptcp/subflow.c +6 -6
@@ -1166,15 +1166,15 @@ static bool subflow_check_data_avail(struct sock *ssk) fallback:/* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { -if (mptcp_has_another_subflow (ssk)) { +if (mptcp_has_another_subflow (ssk) ||READ_ONCE (msk->noncontiguous)) { + ssk->sk_err =EBADMSG ; +tcp_set_state (ssk,TCP_CLOSE ); + subflow->reset_transient =0 ; + subflow->reset_reason =MPTCP_RST_EMIDDLEBOX ; +tcp_send_active_reset (ssk,GFP_ATOMIC );while ((skb =skb_peek (&ssk->sk_receive_queue)))sk_eat_skb (ssk, skb); } - ssk->sk_err =EBADMSG ; -tcp_set_state (ssk,TCP_CLOSE ); - subflow->reset_transient =0 ; - subflow->reset_reason =MPTCP_RST_EMIDDLEBOX ; -tcp_send_active_reset (ssk,GFP_ATOMIC );WRITE_ONCE (subflow->data_avail,0 );return true; }
Signature · 1 line
2.31.1
Re: [PATCH mptcp-next 1/6] mptcp: add noncontiguous flag
Quoted 22 lines · Geliang Tang
From: Geliang Tang <[email protected]>
This patch added a "noncontiguous" flag in the msk to track whether the data is contiguous on a subflow. When retransmission happens, we could set this flag, and once all retransmissions are DATA_ACK'd that flag could be cleared.
When a bad checksum is detected and a single contiguous subflow is in use, don't send RST +
MP_FAIL, senddata_ack+MP_FAILinstead.Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/protocol.c | 13 ++++++++++--- net/mptcp/protocol.h | 1 + net/mptcp/subflow.c | 12 ++++++------ 3 files changed, 17 insertions(+), 9 deletions(-)net/mptcp/protocol.c +0
-0
net/mptcp/protocol.c static void __mptcp_clean_una(struct sock *sk) · line 1103
Quoted 7 lines
net/mptcp/protocol.c +2
-1@@ -1098,8 +1098,10 @@ static void __mptcp_clean_una(struct sock *sk) }/* all retransmitted data acked, recovery completed */ -if (unlikely (msk->recovery) &&after64 (msk->snd_una, msk->recovery_snd_nxt)) +if (unlikely (msk->recovery) &&after64 (msk->snd_una, msk->recovery_snd_nxt)) { msk->recovery = false; +WRITE_ONCE (msk->noncontiguous, false);
This will only clear msk->noncontiguous if msk->recovery was also set, msk->noncontiguous would not get cleared if retransmission was triggered by mptcp_retransmit_timer() instead of __mptcp_retransmit_pending_data().
We could add a resend_count (or similar) field to struct mptcp_data_frag to keep track of how many times a frag has been resent. Since resending always happens at the rtx_head, a resend_count == 0 on the rtx_head dfrag would indicate that all retransmitted data had been acknowledged and msk->noncontiguous can be cleared.
net/mptcp/protocol.c static void mptcp_worker(struct work_struct *work) · line 2508
Quoted 11 lines
net/mptcp/protocol.c +1
-0+ }out:
if (cleaned && tcp_under_memory_pressure(sk))net/mptcp/protocol.c +2
-1@@ -2502,8 +2504,10 @@ static void mptcp_worker(struct work_struct *work)if (test_and_clear_bit (MPTCP_WORK_CLOSE_SUBFLOW , &msk->flags))__mptcp_close_subflow (msk); -if (test_and_clear_bit (MPTCP_WORK_RTX , &msk->flags)) +if (test_and_clear_bit (MPTCP_WORK_RTX , &msk->flags)) { +WRITE_ONCE (msk->noncontiguous, true);
This write could be done inside __mptcp_retrans(). Then it can be added in one place, and then only set if data was actually resent.
- Mat
Quoted 60 lines
net/mptcp/protocol.c +1
-0__mptcp_retrans (sk); + }unlock:
release_sock(sk);net/mptcp/protocol.c +4
-1@@ -2872,6 +2876,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk,WRITE_ONCE (msk->fully_established, false);if (mp_opt->suboptions &OPTION_MPTCP_CSUMREQD )WRITE_ONCE (msk->csum_enabled, true); +WRITE_ONCE (msk->noncontiguous, false); msk->write_seq = subflow_req->idsn +1 ; msk->snd_nxt = msk->write_seq;@@ -3040,8 +3045,10 @@ static void mptcp_release_cb(struct sock *sk)spin_unlock_bh (&sk->sk_lock.slock);if (flags &BIT (MPTCP_PUSH_PENDING ))__mptcp_push_pending (sk,0 ); -if (flags &BIT (MPTCP_RETRANSMIT )) +if (flags &BIT (MPTCP_RETRANSMIT )) { +WRITE_ONCE (mptcp_sk (sk)->noncontiguous, true);__mptcp_retrans (sk); + }cond_resched ();spin_lock_bh (&sk->sk_lock.slock);net/mptcp/protocol.h +1
-0@@ -249,6 +249,7 @@ struct mptcp_sock {bool rcv_fastclose;bool use_64bit_ack;/* Set when we received a 64-bit DSN */ bool csum_enabled; +bool noncontiguous;spinlock_t join_list_lock;struct work_struct work;struct sk_buff *ooo_last_skb;net/mptcp/subflow.c +0
-0@@ -1166,15 +1166,15 @@ static bool subflow_check_data_avail(struct sock *ssk)fallback:
/* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) {net/mptcp/subflow.c +6
-1-if (mptcp_has_another_subflow (ssk)) { +if (mptcp_has_another_subflow (ssk) ||READ_ONCE (msk->noncontiguous)) { + ssk->sk_err =EBADMSG ; +tcp_set_state (ssk,TCP_CLOSE ); + subflow->reset_transient =0 ; + subflow->reset_reason =MPTCP_RST_EMIDDLEBOX ; +tcp_send_active_reset (ssk,GFP_ATOMIC );while ((skb = skb_peek(&ssk->sk_receive_queue))) sk_eat_skb(ssk, skb); }net/mptcp/subflow.c +0
-5- ssk->sk_err =EBADMSG ; -tcp_set_state (ssk,TCP_CLOSE ); - subflow->reset_transient =0 ; - subflow->reset_reason =MPTCP_RST_EMIDDLEBOX ; -tcp_send_active_reset (ssk,GFP_ATOMIC );
Quoted 8 lines
WRITE_ONCE(subflow->data_avail, 0); return true; }Signature · 1 line
2.31.1
--
Mat Martineau
Intel
PATCH 2/6 mptcp: infinite mapping sending
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch added the infinite mapping sending logic.
Added a new flag snd_infinite_mapping_enable in mptcp_sock. Set it true when a single contiguous subflow is in use in mptcp_pm_mp_fail_received. In mptcp_sendmsg_frag, if this flag is true, call the new function mptcp_update_infinite_mapping to set the infinite mapping.
Added a new flag infinite_mapping_snd in struct mptcp_subflow_context. In mptcp_write_options, if the infinite mapping has been sent, set this flag.
In subflow_check_data_avail, if the infinite_mapping_snd flag is set, don't reset this subflow.
--- net/mptcp/options.c | 8 ++++++++ net/mptcp/pm.c | 6 ++++++ net/mptcp/protocol.c | 15 +++++++++++++++ net/mptcp/protocol.h | 2 ++ net/mptcp/subflow.c | 4 +++- 5 files changed, 34 insertions(+), 1 deletion(-)
net/mptcp/options.c +8 -0
@@ -1325,6 +1325,14 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); } } + +if (mpext->data_len ==0 ) { +const struct sock *ssk = (const struct sock *)tp; +struct mptcp_subflow_context *subflow; + + subflow =mptcp_subflow_ctx (ssk); + subflow->infinite_mapping_snd =1 ; + } }else if (OPTIONS_MPTCP_MPC & opts->suboptions) {u8 len, flag =MPTCP_CAP_HMAC_SHA256 ;
net/mptcp/pm.c +6 -0
@@ -251,7 +251,13 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup)void mptcp_pm_mp_fail_received (struct sock *sk,u64 fail_seq) { +struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk); +struct mptcp_sock *msk =mptcp_sk (subflow->conn); +pr_debug ("fail_seq=%llu" , fail_seq); + +if (!mptcp_has_another_subflow (sk) && !READ_ONCE (msk->noncontiguous)) +WRITE_ONCE (msk->snd_infinite_mapping_enable, true); }/* path manager helpers */
net/mptcp/protocol.c +15 -0
@@ -1274,6 +1274,18 @@ static void mptcp_update_data_checksum(struct sk_buff *skb, int added) mpext->csum =csum_fold (csum_block_add (csum,skb_checksum (skb, offset, added,0 ), offset)); } +static void mptcp_update_infinite_mapping (struct mptcp_sock *msk,struct mptcp_ext *mpext) +{ +if (!mpext) +return ; + + mpext->data_len =0 ; +if (READ_ONCE (msk->csum_enabled)) + mpext->csum =0 ; + +WRITE_ONCE (msk->snd_infinite_mapping_enable, false); +} +static int mptcp_sendmsg_frag (struct sock *sk,struct sock *ssk,struct mptcp_data_frag *dfrag,struct mptcp_sendmsg_info *info)
@@ -1406,6 +1418,8 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, out:if (READ_ONCE (msk->csum_enabled))mptcp_update_data_checksum (skb, copy); +if (READ_ONCE (msk->snd_infinite_mapping_enable)) +mptcp_update_infinite_mapping (msk, mpext);mptcp_subflow_ctx (ssk)->rel_write_seq += copy;return copy; }
@@ -2877,6 +2891,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk,if (mp_opt->suboptions &OPTION_MPTCP_CSUMREQD )WRITE_ONCE (msk->csum_enabled, true);WRITE_ONCE (msk->noncontiguous, false); +WRITE_ONCE (msk->snd_infinite_mapping_enable, false); msk->write_seq = subflow_req->idsn +1 ; msk->snd_nxt = msk->write_seq;
net/mptcp/protocol.h +2 -0
@@ -250,6 +250,7 @@ struct mptcp_sock {bool use_64bit_ack;/* Set when we received a 64-bit DSN */ bool csum_enabled;bool noncontiguous; +bool snd_infinite_mapping_enable;spinlock_t join_list_lock;struct work_struct work;struct sk_buff *ooo_last_skb;
@@ -433,6 +434,7 @@ struct mptcp_subflow_context { backup : 1, send_mp_prio : 1, send_mp_fail : 1, + infinite_mapping_snd : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */
net/mptcp/subflow.c +3 -1
@@ -1179,7 +1179,9 @@ static bool subflow_check_data_avail(struct sock *ssk)return true; } -if (subflow->mp_join || subflow->fully_established) { +if (subflow->mp_join || + (subflow->fully_established && + !subflow->infinite_mapping_snd)) {/* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */
Signature · 1 line
2.31.1
Re: [PATCH mptcp-next 2/6] mptcp: infinite mapping sending
Quoted 31 lines · Geliang Tang
From: Geliang Tang <[email protected]>
This patch added the infinite mapping sending logic.
Added a new flag
snd_infinite_mapping_enableinmptcp_sock. Set it true when a single contiguous subflow is in use inmptcp_pm_mp_fail_received. Inmptcp_sendmsg_frag, if this flag is true, call the new functionmptcp_update_infinite_mappingto set the infinite mapping.Added a new flag
infinite_mapping_sndin structmptcp_subflow_context. Inmptcp_write_options, if the infinite mapping has been sent, set this flag.In
subflow_check_data_avail, if theinfinite_mapping_sndflag is set, don't reset this subflow.Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/options.c | 8 ++++++++ net/mptcp/pm.c | 6 ++++++ net/mptcp/protocol.c | 15 +++++++++++++++ net/mptcp/protocol.h | 2 ++ net/mptcp/subflow.c | 4 +++- 5 files changed, 34 insertions(+), 1 deletion(-)net/mptcp/options.c +0
-0@@ -1325,6 +1325,14 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, TCPOPT_NOP << 8 | TCPOPT_NOP, ptr);
net/mptcp/options.c void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, · line 1335
Quoted 10 lines
net/mptcp/options.c +8
-0} } + +if (mpext->data_len ==0 ) { +const struct sock *ssk = (const struct sock *)tp; +struct mptcp_subflow_context *subflow; + + subflow =mptcp_subflow_ctx (ssk); + subflow->infinite_mapping_snd =1 ; + }
This doesn't belong in mptcp_write_options(). I don't think this infinite_mapping_snd field is needed. I had recommended a bit in the mptcp_ext struct so that could override the normal fallback behavior and force the DSS to be populated even though fallback had already started. Maybe there are problems with that approach that I overlooked, if so please let me know.
Quoted 26 lines
net/mptcp/options.c +0
-0}else if (OPTIONS_MPTCP_MPC & opts->suboptions) {u8 len, flag =MPTCP_CAP_HMAC_SHA256 ;net/mptcp/pm.c +6
-0@@ -251,7 +251,13 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup)void mptcp_pm_mp_fail_received (struct sock *sk,u64 fail_seq) { +struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk); +struct mptcp_sock *msk =mptcp_sk (subflow->conn); +pr_debug ("fail_seq=%llu" , fail_seq); + +if (!mptcp_has_another_subflow (sk) && !READ_ONCE (msk->noncontiguous)) +WRITE_ONCE (msk->snd_infinite_mapping_enable, true); }/* path manager helpers */ net/mptcp/protocol.c +0
-0
net/mptcp/protocol.c static void mptcp_update_data_checksum(struct sk_buff *skb, int added) · line 1282
Quoted 9 lines
net/mptcp/protocol.c +6
-0@@ -1274,6 +1274,18 @@ static void mptcp_update_data_checksum(struct sk_buff *skb, int added) mpext->csum =csum_fold (csum_block_add (csum,skb_checksum (skb, offset, added,0 ), offset)); } +static void mptcp_update_infinite_mapping (struct mptcp_sock *msk,struct mptcp_ext *mpext) +{ +if (!mpext) +return ; + + mpext->data_len =0 ;
mpext->data_seq and mpext->subflow_seq need to be set to something here. subflow_seq can probably be zero (I don't see anything specific in the RFC?).
For data_seq, please see my comments on the previous version of this patch:
https://lore.kernel.org/mptcp/[email protected]/
"""
RFC 8684 says the data_seq to use is "the start of the subflow sequence number of the most recent segment that was known to be delivered intact (i.e., was successfully DATA_ACKed)".
In other words, the data_seq from the mapping that was for the *beginning* of the last fully-acked data segment.
This is something else that we don't specifically keep track of yet. The necessary information is (all?) in the msk->rtx_queue - I think we will have to add something to the msk to keep track of the 64-bit sequence number of each mapping as they are acked. This would be updated in __mptcp_data_acked() or __mptcp_clean_una().
"""
If it looks like I'm misreading the RFC, or if I need to explain it better, please let me know!
net/mptcp/protocol.c static void mptcp_update_data_checksum(struct sk_buff *skb, int added) · line 1284
Quoted 2 lines
net/mptcp/protocol.c +2
-0+if (READ_ONCE (msk->csum_enabled)) + mpext->csum =0 ;
Better to set mpext->csum = 0 unconditionally here.
Quoted 64 lines
net/mptcp/protocol.c +4
-0+ +WRITE_ONCE (msk->snd_infinite_mapping_enable, false); +} +static int mptcp_sendmsg_frag (struct sock *sk,struct sock *ssk,struct mptcp_data_frag *dfrag,struct mptcp_sendmsg_info *info)@@ -1406,6 +1418,8 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,out:
if (READ_ONCE(msk->csum_enabled)) mptcp_update_data_checksum(skb, copy);net/mptcp/protocol.c +2
-0+if (READ_ONCE (msk->snd_infinite_mapping_enable)) +mptcp_update_infinite_mapping (msk, mpext);mptcp_subflow_ctx(ssk)->rel_write_seq += copy; return copy; }net/mptcp/protocol.c +1
-0@@ -2877,6 +2891,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk,if (mp_opt->suboptions &OPTION_MPTCP_CSUMREQD )WRITE_ONCE (msk->csum_enabled, true);WRITE_ONCE (msk->noncontiguous, false); +WRITE_ONCE (msk->snd_infinite_mapping_enable, false); msk->write_seq = subflow_req->idsn +1 ; msk->snd_nxt = msk->write_seq;net/mptcp/protocol.h +2
-0@@ -250,6 +250,7 @@ struct mptcp_sock {bool use_64bit_ack;/* Set when we received a 64-bit DSN */ bool csum_enabled;bool noncontiguous; +bool snd_infinite_mapping_enable;spinlock_t join_list_lock;struct work_struct work;struct sk_buff *ooo_last_skb;@@ -433,6 +434,7 @@ struct mptcp_subflow_context { backup : 1, send_mp_prio : 1, send_mp_fail : 1, + infinite_mapping_snd : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */net/mptcp/subflow.c +3
-1@@ -1179,7 +1179,9 @@ static bool subflow_check_data_avail(struct sock *ssk)return true; } -if (subflow->mp_join || subflow->fully_established) { +if (subflow->mp_join || + (subflow->fully_established && + !subflow->infinite_mapping_snd)) {/* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */ Signature · 1 line
2.31.1
--
Mat Martineau
Intel
PATCH 3/6 mptcp: infinite mapping receiving
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch added the infinite mapping receiving logic.
Added a new struct member infinite_mapping_rcv in struct mptcp_subflow_context, set it true when the infinite mapping is received.
In subflow_check_data_avail, if the infinite_mapping_rcv flag is set, don't reset this subflow.
--- net/mptcp/protocol.h | 1 + net/mptcp/subflow.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
net/mptcp/protocol.h +1 -0
@@ -435,6 +435,7 @@ struct mptcp_subflow_context { send_mp_prio : 1, send_mp_fail : 1, infinite_mapping_snd : 1, + infinite_mapping_rcv : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */
net/mptcp/subflow.c +3 -1
@@ -968,6 +968,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk, data_len = mpext->data_len;if (data_len ==0 ) {MPTCP_INC_STATS (sock_net (ssk),MPTCP_MIB_INFINITEMAPRX ); + subflow->infinite_mapping_rcv =1 ;return MAPPING_INVALID ; }
@@ -1181,7 +1182,7 @@ static bool subflow_check_data_avail(struct sock *ssk)if (subflow->mp_join || (subflow->fully_established && - !subflow->infinite_mapping_snd)) { + !(subflow->infinite_mapping_snd || subflow->infinite_mapping_rcv))) {/* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */
@@ -1201,6 +1202,7 @@ static bool subflow_check_data_avail(struct sock *ssk) subflow->map_data_len = skb->len; subflow->map_subflow_seq =tcp_sk (ssk)->copied_seq - subflow->ssn_offset;WRITE_ONCE (subflow->data_avail,MPTCP_SUBFLOW_DATA_AVAIL ); + subflow->infinite_mapping_rcv =0 ;return true; }
Signature · 1 line
2.31.1
Re: [PATCH mptcp-next 3/6] mptcp: infinite mapping receiving
Quoted 34 lines · Geliang Tang
From: Geliang Tang <[email protected]>
This patch added the infinite mapping receiving logic.
Added a new struct member
infinite_mapping_rcvin structmptcp_subflow_context, set it true when the infinite mapping is received.In
subflow_check_data_avail, if theinfinite_mapping_rcvflag is set, don't reset this subflow.Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/protocol.h| 1 +net/mptcp/subflow.c| 4 +++-2 files changed, 4 insertions(+), 1 deletion(-)net/mptcp/protocol.h +1
-0@@ -435,6 +435,7 @@ struct mptcp_subflow_context { send_mp_prio : 1, send_mp_fail : 1, infinite_mapping_snd : 1, + infinite_mapping_rcv : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */net/mptcp/subflow.c +0
-0
net/mptcp/subflow.c static enum mapping_status get_mapping_status(struct sock *ssk, · line 972
Quoted 5 lines
net/mptcp/subflow.c +1
-0@@ -968,6 +968,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk, data_len = mpext->data_len;if (data_len ==0 ) {MPTCP_INC_STATS (sock_net (ssk),MPTCP_MIB_INFINITEMAPRX ); + subflow->infinite_mapping_rcv =1 ;return MAPPING_INVALID ;
If this returns MAPPING_INFINITE instead, that enum value can be checked in subflow_check_data_avail() and infinite_mapping_rcv is not needed.
Quoted 24 lines
net/mptcp/subflow.c +2
-1}@@ -1181,7 +1182,7 @@ static bool subflow_check_data_avail(struct sock *ssk)if (subflow->mp_join || (subflow->fully_established && - !subflow->infinite_mapping_snd)) { + !(subflow->infinite_mapping_snd || subflow->infinite_mapping_rcv))) {/* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */ @@ -1201,6 +1202,7 @@ static bool subflow_check_data_avail(struct sock *ssk) subflow->map_data_len = skb->len; subflow->map_subflow_seq =tcp_sk (ssk)->copied_seq - subflow->ssn_offset;WRITE_ONCE (subflow->data_avail,MPTCP_SUBFLOW_DATA_AVAIL ); + subflow->infinite_mapping_rcv =0 ;return true; }Signature · 1 line
2.31.1
--
Mat Martineau
Intel
PATCH 4/6 mptcp: add a mib for the infinite mapping sending
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch added a new mib named MPTCP_MIB_INFINITEMAPTX, increase it when a infinite mapping has been sent out.
--- net/mptcp/mib.c | 1 + net/mptcp/mib.h | 1 + net/mptcp/protocol.c | 3 +++ 3 files changed, 5 insertions(+)
net/mptcp/mib.c +1 -0
@@ -24,6 +24,7 @@ static const struct snmp_mib mptcp_snmp_list[] = {SNMP_MIB_ITEM ("MPJoinAckRx" ,MPTCP_MIB_JOINACKRX ),SNMP_MIB_ITEM ("MPJoinAckHMacFailure" ,MPTCP_MIB_JOINACKMAC ),SNMP_MIB_ITEM ("DSSNotMatching" ,MPTCP_MIB_DSSNOMATCH ), +SNMP_MIB_ITEM ("InfiniteMapTx" ,MPTCP_MIB_INFINITEMAPTX ),SNMP_MIB_ITEM ("InfiniteMapRx" ,MPTCP_MIB_INFINITEMAPRX ),SNMP_MIB_ITEM ("DSSNoMatchTCP" ,MPTCP_MIB_DSSTCPMISMATCH ), SNMP_MIB_ITEM("DataCsumErr", MPTCP_MIB_DATACSUMERR),
net/mptcp/mib.h +1 -0
@@ -17,6 +17,7 @@ enum linux_mptcp_mib_field {MPTCP_MIB_JOINACKRX ,/* Received an ACK + MP_JOIN */ MPTCP_MIB_JOINACKMAC ,/* HMAC was wrong on ACK + MP_JOIN */ MPTCP_MIB_DSSNOMATCH ,/* Received a new mapping that did not match the previous one */ +MPTCP_MIB_INFINITEMAPTX ,/* Sent an infinite mapping */ MPTCP_MIB_INFINITEMAPRX ,/* Received an infinite mapping */ MPTCP_MIB_DSSTCPMISMATCH ,/* DSS-mapping did not map with TCP's sequence numbers */ MPTCP_MIB_DATACSUMERR, /* The data checksum fail */
net/mptcp/protocol.c +3 -0
@@ -1276,6 +1276,8 @@ static void mptcp_update_data_checksum(struct sk_buff *skb, int added)static void mptcp_update_infinite_mapping (struct mptcp_sock *msk,struct mptcp_ext *mpext) { +struct sock *sk = (struct sock *)msk; +if (!mpext)return ;
@@ -1283,6 +1285,7 @@ static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_eif (READ_ONCE (msk->csum_enabled)) mpext->csum =0 ; +MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_INFINITEMAPTX );WRITE_ONCE (msk->snd_infinite_mapping_enable, false); }
Signature · 1 line
2.31.1
PATCH 5/6 selftests: mptcp: add infinite map mibs check
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch added a function chk_infi_nr to check the mibs for the infinite mapping.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +38 -0
@@ -615,6 +615,43 @@ chk_fail_nr() fi } +chk_infi_nr() +{ + local mp_infi_nr_tx=$1 + local mp_infi_nr_rx=$2 + local count + local dump_stats + + printf "%-39s %s" " " "itx" + count=`ip netns exec $ns1 nstat -as | grep InfiniteMapTx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$mp_infi_nr_tx" ]; then + echo "[fail] got $count infinite map[s] TX expected $mp_infi_nr_tx" + ret=1 + dump_stats=1 + else + echo -n "[ ok ]" + fi + + echo -n " - irx " + count=`ip netns exec $ns2 nstat -as | grep InfiniteMapRx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$mp_infi_nr_rx" ]; then + echo "[fail] got $count infinite map[s] RX expected $mp_infi_nr_rx" + ret=1 + dump_stats=1 + else + echo "[ ok ]" + fi + + if [ "${dump_stats}" = 1 ]; then + echo Server ns stats + ip netns exec $ns1 nstat -as | grep MPTcp + echo Client ns stats + ip netns exec $ns2 nstat -as | grep MPTcp + fi +} + chk_join_nr() { local msg="$1"
@@ -665,6 +702,7 @@ chk_join_nr() if [ $checksum -eq 1 ]; then chk_csum_nr chk_fail_nr 0 0 + chk_infi_nr 0 0 fi }
Signature · 1 line
2.31.1
PATCH 6/6 DO-NOT-MERGE: mptcp: mp_fail test
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
./mptcp_join.sh -Cf
--- net/mptcp/protocol.c | 9 +++++++++ .../testing/selftests/net/mptcp/mptcp_join.sh | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+)
net/mptcp/protocol.c +9 -0
@@ -1289,6 +1289,8 @@ static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_eWRITE_ONCE (msk->snd_infinite_mapping_enable, false); } +static int j; +static int mptcp_sendmsg_frag (struct sock *sk,struct sock *ssk,struct mptcp_data_frag *dfrag,struct mptcp_sendmsg_info *info)
@@ -1423,6 +1425,13 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,mptcp_update_data_checksum (skb, copy);if (READ_ONCE (msk->snd_infinite_mapping_enable))mptcp_update_infinite_mapping (msk, mpext); + +pr_debug ("%s j=%d" , __func__, j++); +if (j ==20 ) + skb->data_len =1 ; +if (j >40 ) + j =0 ; +mptcp_subflow_ctx (ssk)->rel_write_seq += copy;return copy; }
tools/testing/selftests/net/mptcp/mptcp_join.sh +18 -0
@@ -977,6 +977,24 @@ chk_link_usage() subflows_tests() { + # 1 subflow + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "1 subflow" 0 0 0 + + exit + + # multiple subflows + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "multiple subflows" 2 2 2 + reset run_tests $ns1 $ns2 10.0.1.1 chk_join_nr "no JOIN" "0" "0" "0"
Signature · 1 line
2.31.1