The infinite mapping support
Subsystems (3)
v6 cover The infinite mapping support
v6:
- use allow_infinite_fallback instead of last_retrans_seq.
- rename mptcp_is_data_contiguous to mptcp_allow_infinite_fallback.
- rename last_fully_acked_dss_start_seq to last_ack_dss_start.
v5:
- move last_retrans_seq from msk to mptcp_subflow_context
v4:
- update patch 1 and patch 2
v3:
- drop MPTCP_INFINITE_DONE flag
- drop MAPPING_INFINITE
- add mptcp_is_data_contiguous helper
- add the fallback check
- The u32 target testcase has not been completed yet.
v2:
- add MPTCP_INFINITE_DONE flag
- add MAPPING_INFINITE mapping status
- add start_seq in the msk
v1:
- add noncontiguous flag
- add the mibs check
- tag: export/20210904T080009
Geliang Tang (9):
mptcp: don't send RST for single subflow
mptcp: add the fallback check
mptcp: track and update contiguous data status
mptcp: add last_ack_dss_start in the msk
mptcp: infinite mapping sending
mptcp: infinite mapping receiving
mptcp: add mib for infinite map sending
selftests: mptcp: add infinite map mibs check
DO-NOT-MERGE: mptcp: mp_fail test
include/net/mptcp.h | 3 +- net/mptcp/mib.c | 1 + net/mptcp/mib.h | 1 + net/mptcp/options.c | 2 +- net/mptcp/pm.c | 5 ++ net/mptcp/protocol.c | 34 +++++++++++ net/mptcp/protocol.h | 23 +++++++- net/mptcp/subflow.c | 54 +++++++++--------- .../testing/selftests/net/mptcp/mptcp_join.sh | 56 +++++++++++++++++++ 9 files changed, 149 insertions(+), 30 deletions(-)
Signature · 1 line
2.31.1
PATCH v6 1/9 mptcp: don't send RST for single subflow
When a bad checksum is detected and a single subflow is in use, don't send RST + MP_FAIL, send data_ack + MP_FAIL instead.
--- net/mptcp/subflow.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/mptcp/subflow.c +5 -5
@@ -1167,14 +1167,14 @@ static bool subflow_check_data_avail(struct sock *ssk)/* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) {if (mptcp_has_another_subflow (ssk)) { + 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
PATCH v6 2/9 mptcp: add the fallback check
In reply to Geliang TangThis patch added the fallback check in subflow_check_data_avail. Only do the fallback when the msk isn't fallen back yet.
--- net/mptcp/subflow.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-)
net/mptcp/subflow.c +24 -21
@@ -1164,35 +1164,38 @@ static bool subflow_check_data_avail(struct sock *ssk)return false; fallback: -/* RFC 8684 section 3.7. */ -if (subflow->send_mp_fail) { -if (mptcp_has_another_subflow (ssk)) { +if (!__mptcp_check_fallback (msk)) { +/* RFC 8684 section 3.7. */ +if (subflow->send_mp_fail) { +if (mptcp_has_another_subflow (ssk)) { + 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); + } +WRITE_ONCE (subflow->data_avail,0 ); +return true; + } + +if (subflow->mp_join || subflow->fully_established) { +/* fatal protocol error, close the socket. +* subflow_error_report() will introduce the appropriate barriers +*/ ssk->sk_err =EBADMSG ;tcp_set_state (ssk,TCP_CLOSE ); subflow->reset_transient =0 ; - subflow->reset_reason =MPTCP_RST_EMIDDLEBOX ; + subflow->reset_reason =MPTCP_RST_EMPTCP ;tcp_send_active_reset (ssk,GFP_ATOMIC ); -while ((skb =skb_peek (&ssk->sk_receive_queue))) -sk_eat_skb (ssk, skb); +WRITE_ONCE (subflow->data_avail,0 ); +return false; } -WRITE_ONCE (subflow->data_avail,0 ); -return true; - } -if (subflow->mp_join || subflow->fully_established) { -/* fatal protocol error, close the socket. -* subflow_error_report() will introduce the appropriate barriers -*/ - ssk->sk_err =EBADMSG ; -tcp_set_state (ssk,TCP_CLOSE ); - subflow->reset_transient =0 ; - subflow->reset_reason =MPTCP_RST_EMPTCP ; -tcp_send_active_reset (ssk,GFP_ATOMIC ); -WRITE_ONCE (subflow->data_avail,0 ); -return false; +__mptcp_do_fallback (msk); } -__mptcp_do_fallback (msk); skb =skb_peek (&ssk->sk_receive_queue); subflow->map_valid =1 ; subflow->map_seq =READ_ONCE (msk->ack_seq);
Signature · 1 line
2.31.1
PATCH v6 3/9 mptcp: track and update contiguous data status
In reply to Geliang TangThis patch added a new member allow_infinite_fallback in mptcp_sock, which gets initialized to 'true' when the connection begins and is set to 'false' on any retransmit or successful MP_JOIN.
Rename the helper function mptcp_is_data_contiguous() to mptcp_allow_infinite_fallback(). In it, only do infinite mapping fallback if there is a single subflow AND there have been no retransmissions AND there have never been any MP_JOINs.
--- net/mptcp/protocol.c | 2 ++ net/mptcp/protocol.h | 10 +++++++--- net/mptcp/subflow.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-)
net/mptcp/protocol.c +2 -0
@@ -2464,6 +2464,7 @@ static void __mptcp_retrans(struct sock *sk) dfrag->already_sent =max (dfrag->already_sent, info.sent);tcp_push (ssk,0 , info.mss_now,tcp_sk (ssk)->nonagle, info.size_goal); +WRITE_ONCE (msk->allow_infinite_fallback, false); }release_sock (ssk);
@@ -2542,6 +2543,7 @@ static int __mptcp_init_sock(struct sock *sk) msk->first =NULL ;inet_csk (sk)->icsk_sync_mss = mptcp_sync_mss;WRITE_ONCE (msk->csum_enabled,mptcp_is_checksum_enabled (sock_net (sk))); +WRITE_ONCE (msk->allow_infinite_fallback, true); msk->recovery = false;mptcp_pm_data_init (msk);
net/mptcp/protocol.h +7 -3
@@ -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 allow_infinite_fallback;spinlock_t join_list_lock;struct work_struct work;struct sk_buff *ooo_last_skb;
@@ -612,17 +613,20 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk,inet_csk (sk)->icsk_af_ops = ctx->icsk_af_ops; } -static inline bool mptcp_has_another_subflow (struct sock *ssk) +static inline bool mptcp_allow_infinite_fallback (struct sock *ssk) {struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk), *tmp;struct mptcp_sock *msk =mptcp_sk (subflow->conn);mptcp_for_each_subflow (msk, tmp) { +if (tmp->mp_join) +return false; +if (tmp != subflow) -return true; +return false; } -return false; +return READ_ONCE (msk->allow_infinite_fallback); }void __init mptcp_proto_init (void );
net/mptcp/subflow.c +1 -1
@@ -1167,7 +1167,7 @@ static bool subflow_check_data_avail(struct sock *ssk)if (!__mptcp_check_fallback (msk)) {/* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { -if (mptcp_has_another_subflow (ssk)) { +if (!mptcp_allow_infinite_fallback (ssk)) { ssk->sk_err =EBADMSG ;tcp_set_state (ssk,TCP_CLOSE ); subflow->reset_transient =0 ;
Signature · 1 line
2.31.1
PATCH v6 4/9 mptcp: add last_ack_dss_start in the msk
In reply to Geliang TangThis patch added a new member named last_ack_dss_start to the msk to keep track of the beginning of the last fully-acked data segment. This would be updated in __mptcp_clean_una.
--- net/mptcp/protocol.c | 3 +++ net/mptcp/protocol.h | 1 + 2 files changed, 4 insertions(+)
net/mptcp/protocol.c +3 -0
@@ -1071,6 +1071,7 @@ static void __mptcp_clean_una(struct sock *sk)WRITE_ONCE (msk->first_pending,mptcp_send_next (sk)); } + msk->last_ack_dss_start = dfrag->data_seq;dfrag_clear (sk, dfrag); cleaned = true; }
@@ -2891,6 +2892,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk, msk->snd_una = msk->write_seq; msk->wnd_end = msk->snd_nxt + req->rsk_rcv_wnd; msk->setsockopt_seq =mptcp_sk (sk)->setsockopt_seq; + msk->last_ack_dss_start = subflow_req->idsn -1 ;if (mp_opt->suboptions &OPTIONS_MPTCP_MPC ) { msk->can_ack = true;
@@ -3147,6 +3149,7 @@ void mptcp_finish_connect(struct sock *ssk)WRITE_ONCE (msk->rcv_wnd_sent, ack_seq);WRITE_ONCE (msk->can_ack,1 );WRITE_ONCE (msk->snd_una, msk->write_seq); +WRITE_ONCE (msk->last_ack_dss_start, subflow->idsn -1 );mptcp_pm_new_connection (msk, ssk,0 );
net/mptcp/protocol.h +1 -0
@@ -224,6 +224,7 @@ struct mptcp_sock {u64 remote_key;u64 write_seq;u64 snd_nxt; +u64 last_ack_dss_start;u64 ack_seq;u64 rcv_wnd_sent;u64 rcv_data_fin_seq;
Signature · 1 line
2.31.1
PATCH v6 5/9 mptcp: infinite mapping sending
In reply to Geliang TangThis patch added the infinite mapping sending logic.
Added a new flag send_infinite_map in struct mptcp_subflow_context. 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_map to set the infinite mapping.
--- include/net/mptcp.h | 3 ++- net/mptcp/options.c | 2 +- net/mptcp/pm.c | 5 +++++ net/mptcp/protocol.c | 19 +++++++++++++++++++ net/mptcp/protocol.h | 12 ++++++++++++ 5 files changed, 39 insertions(+), 2 deletions(-)
include/net/mptcp.h +2 -1
@@ -35,7 +35,8 @@ struct mptcp_ext { frozen:1 , reset_transient:1; u8 reset_reason:4, - csum_reqd:1; + csum_reqd:1, + infinite_map:1; };#define MPTCP_RM_IDS_MAX 8
net/mptcp/options.c +1 -1
@@ -816,7 +816,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, opts->suboptions =0 ; -if (unlikely (__mptcp_check_fallback (msk))) +if (unlikely (__mptcp_check_fallback (msk) && !mptcp_check_infinite_map (skb)))return false;if (unlikely (skb &&TCP_SKB_CB (skb)->tcp_flags &TCPHDR_RST )) {
net/mptcp/pm.c +5 -0
@@ -251,7 +251,12 @@ 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); +pr_debug ("fail_seq=%llu" , fail_seq); + +if (mptcp_allow_infinite_fallback (sk)) + subflow->send_infinite_map =1 ; }/* path manager helpers */
net/mptcp/protocol.c +19 -0
@@ -1274,6 +1274,23 @@ 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_map (struct mptcp_sock *msk,struct sock *ssk, +struct mptcp_ext *mpext) +{ +if (!mpext) +return ; + + mpext->infinite_map =1 ; + mpext->data_seq =READ_ONCE (msk->last_ack_dss_start); + mpext->subflow_seq =0 ; + mpext->data_len =0 ; + mpext->csum =0 ; + +mptcp_subflow_ctx (ssk)->send_infinite_map =0 ; +pr_fallback (msk); +__mptcp_do_fallback (msk); +} +static int mptcp_sendmsg_frag (struct sock *sk,struct sock *ssk,struct mptcp_data_frag *dfrag,struct mptcp_sendmsg_info *info)
@@ -1406,6 +1423,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 (mptcp_subflow_ctx (ssk)->send_infinite_map) +mptcp_update_infinite_map (msk, ssk, mpext);mptcp_subflow_ctx (ssk)->rel_write_seq += copy;return copy; }
net/mptcp/protocol.h +12 -0
@@ -433,6 +433,7 @@ struct mptcp_subflow_context { backup : 1, send_mp_prio : 1, send_mp_fail : 1, + send_infinite_map : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */
@@ -872,6 +873,17 @@ 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_map (struct sk_buff *skb) +{ +struct mptcp_ext *mpext; + + mpext = skb ?mptcp_get_ext (skb) :NULL ; +if (mpext && mpext->infinite_map) +return true; + +return false; +} +static inline bool subflow_simultaneous_connect (struct sock *sk) {struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk);
Signature · 1 line
2.31.1
PATCH v6 6/9 mptcp: infinite mapping receiving
In reply to Geliang TangThis patch added the infinite mapping receiving logic. When the infinite mapping is received, set the map_data_len of the subflow to 0.
In subflow_check_data_avail, only reset the subflow when the map_data_len of the subflow is non-zero.
--- net/mptcp/subflow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/subflow.c +2 -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->map_data_len =0 ;return MAPPING_INVALID ; }
@@ -1180,7 +1181,7 @@ 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->map_data_len) {/* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */
Signature · 1 line
2.31.1
PATCH v6 7/9 mptcp: add mib for infinite map sending
In reply to Geliang TangThis 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 | 1 + 3 files changed, 3 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 +1 -0
@@ -1286,6 +1286,7 @@ static void mptcp_update_infinite_map(struct mptcp_sock *msk, struct sock *ssk, mpext->data_len =0 ; mpext->csum =0 ; +MPTCP_INC_STATS (sock_net (ssk),MPTCP_MIB_INFINITEMAPTX );mptcp_subflow_ctx (ssk)->send_infinite_map =0 ;pr_fallback (msk);__mptcp_do_fallback (msk);
Signature · 1 line
2.31.1
PATCH v6 8/9 selftests: mptcp: add infinite map mibs check
In reply to Geliang TangThis 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 v6 9/9 DO-NOT-MERGE: mptcp: mp_fail test
In reply to Geliang Tang./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
@@ -1292,6 +1292,8 @@ static void mptcp_update_infinite_map(struct mptcp_sock *msk, struct sock *ssk,__mptcp_do_fallback (msk); } +static int j; +static int mptcp_sendmsg_frag (struct sock *sk,struct sock *ssk,struct mptcp_data_frag *dfrag,struct mptcp_sendmsg_info *info)
@@ -1426,6 +1428,13 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,mptcp_update_data_checksum (skb, copy);if (mptcp_subflow_ctx (ssk)->send_infinite_map)mptcp_update_infinite_map (msk, ssk, 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
Re: [PATCH mptcp-next v6 3/9] mptcp: track and update contiguous data status
In reply to Geliang TangQuoted 56 lines · Geliang Tang
This patch added a new member
allow_infinite_fallbackinmptcp_sock, which gets initialized to 'true' when the connection begins and is set to 'false' on any retransmit or successfulMP_JOIN.Rename the helper function
mptcp_is_data_contiguous()tomptcp_allow_infinite_fallback(). In it, only do infinite mapping fallback if there is a single subflow AND there have been no retransmissions AND there have never been anyMP_JOINs.Suggested-by Paolo Abeni <[email protected]>Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/protocol.c | 2 ++ net/mptcp/protocol.h | 10 +++++++--- net/mptcp/subflow.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-)net/mptcp/protocol.c +2
-0@@ -2464,6 +2464,7 @@ static void __mptcp_retrans(struct sock *sk) dfrag->already_sent =max (dfrag->already_sent, info.sent);tcp_push (ssk,0 , info.mss_now,tcp_sk (ssk)->nonagle, info.size_goal); +WRITE_ONCE (msk->allow_infinite_fallback, false); }release_sock (ssk);@@ -2542,6 +2543,7 @@ static int __mptcp_init_sock(struct sock *sk) msk->first =NULL ;inet_csk (sk)->icsk_sync_mss = mptcp_sync_mss;WRITE_ONCE (msk->csum_enabled,mptcp_is_checksum_enabled (sock_net (sk))); +WRITE_ONCE (msk->allow_infinite_fallback, true); msk->recovery = false;mptcp_pm_data_init (msk);net/mptcp/protocol.h +2
-1@@ -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 allow_infinite_fallback;spinlock_t join_list_lock;struct work_struct work;struct sk_buff *ooo_last_skb;@@ -612,17 +613,20 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk,inet_csk (sk)->icsk_af_ops = ctx->icsk_af_ops; } -static inline bool mptcp_has_another_subflow (struct sock *ssk) +static inline bool mptcp_allow_infinite_fallback (struct sock *ssk) {
net/mptcp/protocol.h static inline void mptcp_subflow_tcp_fallback(struct sock *sk, · line 626
Quoted 10 lines
net/mptcp/protocol.h +4
-1struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk), *tmp;struct mptcp_sock *msk =mptcp_sk (subflow->conn);mptcp_for_each_subflow (msk, tmp) { +if (tmp->mp_join) +return false; +if (tmp != subflow) -return true; +return false;
Sorry I missed your patch-1 v5 reply yesterday! I think it's better for now to implement the simpler check discussed in the meeting last week and in the v5 review, which is to set allow_infinite_fallback = false when a join happens (in mptcp_finish_join() and __mptcp_subflow_connect()). Then there's no need to iterate over the subflows here.
We don't have a good answer yet for how to guarantee a subflow and the MPTCP-level stream are in a correct state to fallback *after* retransmissions or joins, so I think it's important to get this single-subflow infinite mapping working and tests implemented first. There must be absolute certainty that fallback will not corrupt the application data stream.
Mat
Quoted 25 lines
net/mptcp/protocol.h +1
-1} -return false; +return READ_ONCE (msk->allow_infinite_fallback); }void __init mptcp_proto_init (void );net/mptcp/subflow.c +1
-1@@ -1167,7 +1167,7 @@ static bool subflow_check_data_avail(struct sock *ssk)if (!__mptcp_check_fallback (msk)) {/* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { -if (mptcp_has_another_subflow (ssk)) { +if (!mptcp_allow_infinite_fallback (ssk)) { ssk->sk_err =EBADMSG ;tcp_set_state (ssk,TCP_CLOSE ); subflow->reset_transient =0 ;Signature · 1 line
2.31.1
--
Mat Martineau
Intel
Re: [PATCH mptcp-next v6 4/9] mptcp: add last_ack_dss_start in the msk
In reply to Geliang TangQuoted 4 lines · Geliang Tang
This patch added a new member named
last_ack_dss_startto the msk to keep track of the beginning of the last fully-acked data segment. This would be updated in__mptcp_clean_una.
Can drop this patch, see patch 5 reply for more details.
Mat
Quoted 52 lines
Suggested-by Paolo Abeni <[email protected]>Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/protocol.c| 3 +++net/mptcp/protocol.h| 1 +2 files changed, 4 insertions(+)net/mptcp/protocol.c +3
-0@@ -1071,6 +1071,7 @@ static void __mptcp_clean_una(struct sock *sk)WRITE_ONCE (msk->first_pending,mptcp_send_next (sk)); } + msk->last_ack_dss_start = dfrag->data_seq;dfrag_clear (sk, dfrag); cleaned = true; }@@ -2891,6 +2892,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk, msk->snd_una = msk->write_seq; msk->wnd_end = msk->snd_nxt + req->rsk_rcv_wnd; msk->setsockopt_seq =mptcp_sk (sk)->setsockopt_seq; + msk->last_ack_dss_start = subflow_req->idsn -1 ;if (mp_opt->suboptions &OPTIONS_MPTCP_MPC ) { msk->can_ack = true;@@ -3147,6 +3149,7 @@ void mptcp_finish_connect(struct sock *ssk)WRITE_ONCE (msk->rcv_wnd_sent, ack_seq);WRITE_ONCE (msk->can_ack,1 );WRITE_ONCE (msk->snd_una, msk->write_seq); +WRITE_ONCE (msk->last_ack_dss_start, subflow->idsn -1 );mptcp_pm_new_connection (msk, ssk,0 );net/mptcp/protocol.h +1
-0@@ -224,6 +224,7 @@ struct mptcp_sock {u64 remote_key;u64 write_seq;u64 snd_nxt; +u64 last_ack_dss_start;u64 ack_seq;u64 rcv_wnd_sent;u64 rcv_data_fin_seq;Signature · 1 line
2.31.1
--
Mat Martineau
Intel
Re: [PATCH mptcp-next v6 5/9] mptcp: infinite mapping sending
In reply to Geliang TangQuoted 70 lines · Geliang Tang
This patch added the infinite mapping sending logic.
Added a new flag
send_infinite_mapin structmptcp_subflow_context. Set it true when a single contiguous subflow is in use inmptcp_pm_mp_fail_received.In
mptcp_sendmsg_frag, if this flag is true, call the new functionmptcp_update_infinite_mapto set the infinite mapping.Suggested-by Paolo Abeni <[email protected]>Signed-off-by Geliang Tang <[email protected]>---
include/net/mptcp.h | 3 ++- net/mptcp/options.c | 2 +- net/mptcp/pm.c | 5 +++++ net/mptcp/protocol.c | 19 +++++++++++++++++++ net/mptcp/protocol.h | 12 ++++++++++++ 5 files changed, 39 insertions(+), 2 deletions(-)include/net/mptcp.h +2
-1@@ -35,7 +35,8 @@ struct mptcp_ext { frozen:1 , reset_transient:1; u8 reset_reason:4, - csum_reqd:1; + csum_reqd:1, + infinite_map:1; };#define MPTCP_RM_IDS_MAX 8net/mptcp/options.c +1
-1@@ -816,7 +816,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, opts->suboptions =0 ; -if (unlikely (__mptcp_check_fallback (msk))) +if (unlikely (__mptcp_check_fallback (msk) && !mptcp_check_infinite_map (skb)))return false;if (unlikely (skb &&TCP_SKB_CB (skb)->tcp_flags &TCPHDR_RST )) {net/mptcp/pm.c +5
-0@@ -251,7 +251,12 @@ 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); +pr_debug ("fail_seq=%llu" , fail_seq); + +if (mptcp_allow_infinite_fallback (sk)) + subflow->send_infinite_map =1 ; }/* path manager helpers */ net/mptcp/protocol.c +0
-0@@ -1274,6 +1274,23 @@ 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)); }
net/mptcp/protocol.c static void mptcp_update_data_checksum(struct sk_buff *skb, int added) · line 1285
Quoted 10 lines
net/mptcp/protocol.c +9
-0+static void mptcp_update_infinite_map (struct mptcp_sock *msk,struct sock *ssk, +struct mptcp_ext *mpext) +{ +if (!mpext) +return ; + + mpext->infinite_map =1 ; + mpext->data_seq =READ_ONCE (msk->last_ack_dss_start); + mpext->subflow_seq =0 ;
To match up with Christoph's reply from a couple of days ago (if I'm reading it right), I think you just delete the above 2 lines so data_seq and subflow_seq are unmodified from the values they were set to in mptcp_sendmsg_frag().
Mat
Quoted 55 lines
net/mptcp/protocol.c +8
-0+ mpext->data_len =0 ; + mpext->csum =0 ; + +mptcp_subflow_ctx (ssk)->send_infinite_map =0 ; +pr_fallback (msk); +__mptcp_do_fallback (msk); +} +static int mptcp_sendmsg_frag (struct sock *sk,struct sock *ssk,struct mptcp_data_frag *dfrag,struct mptcp_sendmsg_info *info)@@ -1406,6 +1423,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 (mptcp_subflow_ctx (ssk)->send_infinite_map) +mptcp_update_infinite_map (msk, ssk, mpext);mptcp_subflow_ctx(ssk)->rel_write_seq += copy; return copy; }net/mptcp/protocol.h +12
-0@@ -433,6 +433,7 @@ struct mptcp_subflow_context { backup : 1, send_mp_prio : 1, send_mp_fail : 1, + send_infinite_map : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */@@ -872,6 +873,17 @@ 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_map (struct sk_buff *skb) +{ +struct mptcp_ext *mpext; + + mpext = skb ?mptcp_get_ext (skb) :NULL ; +if (mpext && mpext->infinite_map) +return true; + +return false; +} +static inline bool subflow_simultaneous_connect (struct sock *sk) {struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk);Signature · 1 line
2.31.1
--
Mat Martineau
Intel