Commit 31bf11de authored by Paolo Abeni's avatar Paolo Abeni Committed by Jakub Kicinski

mptcp: introduce MAPPING_BAD_CSUM

This allow moving a couple of conditional out of the fast path,
making the code more easy to follow and will simplify the next
patch.

Fixes: ae66fb2b ("mptcp: Do TCP fallback on early DSS checksum failure")
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0c1f78a4
...@@ -843,7 +843,8 @@ enum mapping_status { ...@@ -843,7 +843,8 @@ enum mapping_status {
MAPPING_INVALID, MAPPING_INVALID,
MAPPING_EMPTY, MAPPING_EMPTY,
MAPPING_DATA_FIN, MAPPING_DATA_FIN,
MAPPING_DUMMY MAPPING_DUMMY,
MAPPING_BAD_CSUM
}; };
static void dbg_bad_map(struct mptcp_subflow_context *subflow, u32 ssn) static void dbg_bad_map(struct mptcp_subflow_context *subflow, u32 ssn)
...@@ -958,9 +959,7 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff * ...@@ -958,9 +959,7 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *
subflow->map_data_csum); subflow->map_data_csum);
if (unlikely(csum)) { if (unlikely(csum)) {
MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR); MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR);
if (subflow->mp_join || subflow->valid_csum_seen) return MAPPING_BAD_CSUM;
subflow->send_mp_fail = 1;
return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY;
} }
subflow->valid_csum_seen = 1; subflow->valid_csum_seen = 1;
...@@ -1182,10 +1181,8 @@ static bool subflow_check_data_avail(struct sock *ssk) ...@@ -1182,10 +1181,8 @@ static bool subflow_check_data_avail(struct sock *ssk)
status = get_mapping_status(ssk, msk); status = get_mapping_status(ssk, msk);
trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue)); trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue));
if (unlikely(status == MAPPING_INVALID)) if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY ||
goto fallback; status == MAPPING_BAD_CSUM))
if (unlikely(status == MAPPING_DUMMY))
goto fallback; goto fallback;
if (status != MAPPING_OK) if (status != MAPPING_OK)
...@@ -1227,7 +1224,10 @@ static bool subflow_check_data_avail(struct sock *ssk) ...@@ -1227,7 +1224,10 @@ static bool subflow_check_data_avail(struct sock *ssk)
fallback: fallback:
if (!__mptcp_check_fallback(msk)) { if (!__mptcp_check_fallback(msk)) {
/* RFC 8684 section 3.7. */ /* RFC 8684 section 3.7. */
if (subflow->send_mp_fail) { if (status == MAPPING_BAD_CSUM &&
(subflow->mp_join || subflow->valid_csum_seen)) {
subflow->send_mp_fail = 1;
if (!READ_ONCE(msk->allow_infinite_fallback)) { if (!READ_ONCE(msk->allow_infinite_fallback)) {
ssk->sk_err = EBADMSG; ssk->sk_err = EBADMSG;
tcp_set_state(ssk, TCP_CLOSE); tcp_set_state(ssk, TCP_CLOSE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment