Skip to content

Commit

Permalink
mptcp: add MP_FAIL response support
Browse files Browse the repository at this point in the history
This patch adds a new struct member mp_fail_response_expect in struct
mptcp_subflow_context to support MP_FAIL response. In the single subflow
with checksum error and contiguous data special case, a MP_FAIL is sent
in response to another MP_FAIL.

Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
geliangtang authored and davem330 committed Apr 27, 2022
1 parent 4293248 commit 9c81be0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion net/mptcp/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,16 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)

pr_debug("fail_seq=%llu", fail_seq);

if (!mptcp_has_another_subflow(sk) && READ_ONCE(msk->allow_infinite_fallback))
if (mptcp_has_another_subflow(sk) || !READ_ONCE(msk->allow_infinite_fallback))
return;

if (!READ_ONCE(subflow->mp_fail_response_expect)) {
pr_debug("send MP_FAIL response and infinite map");

subflow->send_mp_fail = 1;
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
subflow->send_infinite_map = 1;
}
}

/* path manager helpers */
Expand Down
1 change: 1 addition & 0 deletions net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ struct mptcp_subflow_context {
stale : 1, /* unable to snd/rcv data, do not use for xmit */
local_id_valid : 1; /* local_id is correctly initialized */
enum mptcp_data_avail data_avail;
bool mp_fail_response_expect;
u32 remote_nonce;
u64 thmac;
u32 local_nonce;
Expand Down
2 changes: 2 additions & 0 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,8 @@ static bool subflow_check_data_avail(struct sock *ssk)
tcp_send_active_reset(ssk, GFP_ATOMIC);
while ((skb = skb_peek(&ssk->sk_receive_queue)))
sk_eat_skb(ssk, skb);
} else {
WRITE_ONCE(subflow->mp_fail_response_expect, true);
}
WRITE_ONCE(subflow->data_avail, MPTCP_SUBFLOW_NODATA);
return true;
Expand Down

0 comments on commit 9c81be0

Please sign in to comment.