From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Vikas Bansal <vikas.bansal@samsung.com>,
mathias.nyman@intel.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: sumit.batra@samsung.com
Subject: Re: [PATCH] BugFix in XHCI controller driver for scatter gather DMA
Date: Mon, 21 Dec 2015 21:23:35 +0300 [thread overview]
Message-ID: <567843A7.5070104@cogentembedded.com> (raw)
In-Reply-To: <1450701968-5195-1-git-send-email-vikas.bansal@samsung.com>
Hello.
On 12/21/2015 03:46 PM, Vikas Bansal wrote:
> 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)
Indent with 2 extra tabs ISO 1 please -- it'll be easier on the eyes
(blends with the next statement otherwise).
> + field |= TRB_CHAIN;
> } else {
> /* FIXME - add check for ZERO_PACKET flag before this */
> td->last_trb = ep_ring->enqueue;
MBR, Sergei
next prev parent reply other threads:[~2015-12-21 18:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-21 12:46 [PATCH] BugFix in XHCI controller driver for scatter gather DMA Vikas Bansal
2015-12-21 18:23 ` Sergei Shtylyov [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-12-23 11:58 Vikas Bansal
2015-12-23 13:48 ` Mathias Nyman
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=567843A7.5070104@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.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 \
--cc=vikas.bansal@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.