diff options
author | Diana Z <dzigterman@chromium.org> | 2021-03-19 14:33:25 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-23 22:24:21 +0000 |
commit | 9ab043078548fd30c010b7c3d5dd394e29096491 (patch) | |
tree | b72e8964b45a4fb0070cab9869b9d9d656388028 /common | |
parent | b505164da7edb881c87dd5381eb09fb41b18a05a (diff) | |
download | chrome-ec-9ab043078548fd30c010b7c3d5dd394e29096491.tar.gz |
TCPMv2: Increment Vconn swap counter after send
During initial connection, Vconn swaps may be discarded without sending.
Only count a Vconn swap for the purposes of the counter when the swap
was successfully sent.
BRANCH=Volteer
BUG=b:182885623
TEST=verify two Voxels connected together are reliably able to enter TBT
mode
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Ia76f03ee4c517d297061bda9dc9b5bfbf5990485
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776213
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index e8610f3c75..93e9ff3bb6 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -1780,7 +1780,6 @@ int pd_is_port_partner_dualrole(int port) static bool port_try_vconn_swap(int port) { if (pe[port].vconn_swap_counter < N_VCONN_SWAP_COUNT) { - pe[port].vconn_swap_counter++; PE_SET_FLAG(port, PE_FLAGS_VCONN_SWAP_TO_ON); set_state_pe(port, get_last_state_pe(port)); return true; @@ -6248,6 +6247,9 @@ static void pe_vcs_send_swap_run(int port) PE_CHK_FLAG(port, PE_FLAGS_MSG_RECEIVED)) { PE_CLR_FLAG(port, PE_FLAGS_MSG_RECEIVED); + /* Increment once message has successfully sent */ + pe[port].vconn_swap_counter++; + type = PD_HEADER_TYPE(rx_emsg[port].header); cnt = PD_HEADER_CNT(rx_emsg[port].header); sop = PD_HEADER_GET_SOP(rx_emsg[port].header); |