From e86b4052a6d3698ea5af4aa70450c9326e2e2b62 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Tue, 1 Jul 2014 16:22:53 -0700 Subject: [PATCH] pd: resolve transmission conflicts faster Until now when send_validate() receives another valid packet in place of the GoodCRC, it was continuing its retries loop. But given that the presence of a valid packet indicates that the other side is trying to send us something, it's better to bail out immediatly and wait for its retry. Signed-off-by: Vincent Palatin BRANCH=none BUG=chrome-os-partner:29847 TEST=repeatly plug and unplug a Zinger to a Samus and record the traces of the PD negociations. Change-Id: I901bd8d85999ed195ed9887d7375806f61222f8b Reviewed-on: https://chromium-review.googlesource.com/206391 Reviewed-by: Alec Berg Tested-by: Vincent Palatin Commit-Queue: Vincent Palatin --- common/usb_pd_protocol.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index de5dfcf0c1..36350449a0 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -318,6 +318,13 @@ static int send_validate_message(void *ctxt, uint16_t header, uint8_t cnt, udelay(20); return bit_len; } else { + /* + * we have received a good packet + * but not the expected GoodCRC, + * the other side is trying to contact us, + * bail out immediatly so we can get the retry. + */ + return -4; /* CPRINTF("ERR ACK/%d %04x\n", id, head); */ } }