From: Vikas Bansal <vikas.bansal@samsung.com>
To: mathias.nyman@intel.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: sumit.batra@samsung.com, Vikas Bansal <vikas.bansal@samsung.com>
Subject: [PATCH] BugFix in XHCI controller driver for scatter gather DMA
Date: Wed, 23 Dec 2015 17:28:28 +0530 [thread overview]
Message-ID: <1450871908-4035-1-git-send-email-vikas.bansal@samsung.com> (raw)
From: Sumit Batra <sumit.batra@samsung.com>
Pre-Condition
URB with Scatter Gather list is queued to bulk OUT endpoint.
Every buffer in scatter gather list is not a multiple of maximum packet
size for that endpoint(short packet).
CHAIN bit is set for all TRBs in a TD so that the DMA happens to all of
them at once.
Issue
DMA operation copies all the CHAINED TRBs at contiguous device memory.
But since the original packet was a short packet, so the actual data is
re-aligned after this DMA operation.
At device end this re-aligned data causes data integrity issue with
applications like ICMP ping.
Solution
Don't set the CHAINED bit for these TRBs, if their buffers are not a
multiple of maximum packet size.
This will reduce the benefit in throughput as required from a scatter
gather implementation, but this reduces the CPU utilization.
And solves the data integrity issue on Device End
Signed-off-by: Sumit Batra <sumit.batra@samsung.com>
Signed-off-by: Vikas Bansal <vikas.bansal@samsung.com>
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 7d34cbf..7363dee 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3110,7 +3110,9 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
* TRB to indicate it's the last TRB in the chain.
*/
if (num_trbs > 1) {
- field |= TRB_CHAIN;
+ if (this_sg_len %
+ usb_endpoint_maxp(&urb->ep->desc) == 0)
+ field |= TRB_CHAIN;
} else {
/* FIXME - add check for ZERO_PACKET flag before this */
td->last_trb = ep_ring->enqueue;
next reply other threads:[~2015-12-23 11:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-23 11:58 Vikas Bansal [this message]
2015-12-23 13:48 ` Mathias Nyman
-- strict thread matches above, loose matches on Subject: below --
2015-12-21 12:46 Vikas Bansal
2015-12-21 18:23 ` Sergei Shtylyov
2015-12-21 12:15 Vikas Bansal
2015-12-21 12:25 ` Sergei Shtylyov
2015-12-21 12:04 Vikas Bansal
2015-12-21 12:50 ` Oliver Neukum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450871908-4035-1-git-send-email-vikas.bansal@samsung.com \
--to=vikas.bansal@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=sumit.batra@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®