summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-07-01 16:22:53 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-03 02:55:43 +0000
commite86b4052a6d3698ea5af4aa70450c9326e2e2b62 (patch)
tree2e87a720362581f336a0bbbb703937f02282833f /common
parentf9c24c37c46b24ce8a0ee1c7b914a87bb61fbe8a (diff)
downloadchrome-ec-e86b4052a6d3698ea5af4aa70450c9326e2e2b62.tar.gz
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 <vpalatin@chromium.org> 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 <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usb_pd_protocol.c7
1 files changed, 7 insertions, 0 deletions
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); */
}
}