diff options
author | Karthikeyan Ramasubramanian <kramasub@chromium.org> | 2019-03-01 16:52:26 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-28 14:13:58 -0700 |
commit | 316cf2a3afee7f0ebfa39f32d394220974539c67 (patch) | |
tree | 74928d16435f9f5c7670aec39b8d7b116600c4c3 /include/usb_pd_tcpc.h | |
parent | e3e9d6ab178738f354d4615dab7d28af0b139384 (diff) | |
download | chrome-ec-316cf2a3afee7f0ebfa39f32d394220974539c67.tar.gz |
common/usb_pd_tcpc: Ignore repeat messages
Sometimes messages with the same ID are retransmitted at the physical
layer. Under such scenario do not handle the repeat messages.
BUG=b:129337537
BRANCH=None
TEST=make -j buildall; Ensure that the DUT boots to ChromeOS. Ensure
that the servo_v4 boots fine. Ensure that the DUT boots fine in
normal mode and recovery mode with and without battery. Ensure that the
repeat request messages triggered aritificially are dropped without any
side-effects. Ensure that the DUT is detected in CCD with
pass-through connected after multiple EC reboots, servo_v4 reboots and
USB-C unplug/replug procedure.
Change-Id: I850cd3536ff5e62c34f9dabcc0f8f53bb196ce4c
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1513033
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'include/usb_pd_tcpc.h')
-rw-r--r-- | include/usb_pd_tcpc.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/usb_pd_tcpc.h b/include/usb_pd_tcpc.h index 812a194a85..f5785921a4 100644 --- a/include/usb_pd_tcpc.h +++ b/include/usb_pd_tcpc.h @@ -60,4 +60,22 @@ int tcpc_transmit(int port, enum tcpm_transmit_type type, uint16_t header, int rx_buf_is_empty(int port); void rx_buf_clear(int port); +/** + * Invalidate last message received at the port when the port gets disconnected + * or reset(soft/hard). This is used to identify and handle the duplicate + * messages. + * + * @param port USB PD TCPC port number + */ +void invalidate_last_message_id(int port); + +/** + * Identify and drop any duplicate messages received at the port. + * + * @param port USB PD TCPC port number + * @param msg_header Message Header containing the RX message ID + * @return 1 if the received message is a duplicate one, 0 otherwise. + */ +int consume_repeat_message(int port, uint16_t msg_header); + #endif /* __CROS_EC_USB_PD_TCPC_H */ |