TCPMv2: Handle message discard in vcs_evaluate_swap

If the port partner sent a message while we were attempting to reply to
a Vconn swap, soft reset with the incoming message's SOP.

BRANCH=None
BUG=b:157228506
TEST=on drawcia with Apple A2119, PE does not get stuck in
vcs_evaluate_swap

Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Ifb40ee6bec02b88d96088d72b1a9371417b3338a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558908
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
This commit is contained in:
Diana Z 2020-11-24 14:40:32 -07:00 committed by Commit Bot
parent 4c6709899b
commit 7365b16a1e
1 changed files with 19 additions and 0 deletions

View File

@ -5926,6 +5926,25 @@ static void pe_vcs_evaluate_swap_run(int port)
*/
pe_set_ready_state(port);
}
return;
}
/*
* On outgoing discard, soft reset with SOP of incoming message
*
* See Table 6-65 Response to an incoming Message (except VDM) in PD 3.0
* Version 2.0 Specification.
*/
if (PE_CHK_FLAG(port, PE_FLAGS_MSG_DISCARDED) &&
PE_CHK_FLAG(port, PE_FLAGS_MSG_RECEIVED)) {
enum tcpm_transmit_type sop =
PD_HEADER_GET_SOP(rx_emsg[port].header);
PE_CLR_FLAG(port, PE_FLAGS_MSG_DISCARDED);
PE_CLR_FLAG(port, PE_FLAGS_MSG_RECEIVED);
pe_send_soft_reset(port, sop);
return;
}
}