Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751434AbbLUMZK (ORCPT ); Mon, 21 Dec 2015 07:25:10 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:36122 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145AbbLUMZI (ORCPT ); Mon, 21 Dec 2015 07:25:08 -0500 Subject: Re: [PATCH] BugFix in XHCI controller driver for scatter gather DMA To: Vikas Bansal , mathias.nyman@intel.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <1450700141-4798-1-git-send-email-vikas.bansal@samsung.com> Cc: sumit.batra@samsung.com From: Sergei Shtylyov Message-ID: <5677EFA1.8050309@cogentembedded.com> Date: Mon, 21 Dec 2015 15:25:05 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1450700141-4798-1-git-send-email-vikas.bansal@samsung.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1893 Lines: 46 Hello. On 12/21/2015 3:15 PM, Vikas Bansal wrote: > From: Sumit Batra > > 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 > Signed-off-by: Vikas Bansal > diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c > index 7d34cbf..862d7cd 100644 > --- a/drivers/usb/host/xhci-ring.c > +++ b/drivers/usb/host/xhci-ring.c > @@ -3110,7 +3110,8 @@ 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) Space needed after *if*. Please run your patches thru scripts/checkpatch.pl. [...] MBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/