From 8317dea64ce32452f1f8d53906f152e4dd6b814f Mon Sep 17 00:00:00 2001 From: Xiaoguang Wu Date: Fri, 13 Jul 2018 13:22:12 +0800 Subject: [PATCH] DM USB: fix guest kernel short packets warning There are many 'short packet' warnings in the UOS kernel dmesg output, which are result from bad short packet identification algorithm. This patch is used to fix it. Change-Id: Idfa0b87fc96893b80d5c9fe8dab4db35aa5bfe84 Tracked-On: Signed-off-by: Xiaoguang Wu Reviewed-by: Liang Yang Acked-by: Yu Wang --- devicemodel/hw/platform/usb_pmapper.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/devicemodel/hw/platform/usb_pmapper.c b/devicemodel/hw/platform/usb_pmapper.c index 96e1718b4..175bf1d2f 100644 --- a/devicemodel/hw/platform/usb_pmapper.c +++ b/devicemodel/hw/platform/usb_pmapper.c @@ -106,6 +106,13 @@ usb_dev_comp_req(struct libusb_transfer *libusb_xfer) for (i = 0; i < req->blk_count; i++) { done = 0; block = &xfer->data[idx % USB_MAX_XFER_BLOCKS]; + + /* Link TRB need to be skipped */ + if (!block->buf || !block->blen) { + idx = (idx + 1) % USB_MAX_XFER_BLOCKS; + continue; + } + if (len > buf_idx) { done = block->blen; if (done > len - buf_idx) { @@ -203,6 +210,7 @@ usb_dev_prepare_xfer(struct usb_data_xfer *xfer, int *count, int *size) if (block->processed) { idx = (idx + 1) % USB_MAX_XFER_BLOCKS; + c++; continue; } if (block->buf && block->blen > 0) {