LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: wlf <wulf@rock-chips.com>
To: Doug Anderson <dianders@google.com>,
William Wu <william.wu@rock-chips.com>
Cc: hminas@synopsys.com, felipe.balbi@linux.intel.com,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Sergei Shtylyov" <sergei.shtylyov@cogentembedded.com>,
"Heiko Stübner" <heiko@sntech.de>,
LKML <linux-kernel@vger.kernel.org>,
linux-usb@vger.kernel.org,
"open list:ARM/Rockchip SoC..."
<linux-rockchip@lists.infradead.org>,
"Frank Wang" <frank.wang@rock-chips.com>,
黄涛 <huangtao@rock-chips.com>,
"daniel.meng" <daniel.meng@rock-chips.com>,
"John Youn" <John.Youn@synopsys.com>, 王征增 <wzz@rock-chips.com>,
zsq@rock-chips.com, 許嘉銘 <Allen.Hsu@quantatw.com>,
"Stan Tsui" <StanTsui@aopen.com>,
"Spruce Wu (吳建勳)" <Spruce.Wu@quantatw.com>,
"Martin Tsai" <Martin.Tsai@quantatw.com>,
"Kevin Hsueh" <Kevin.Shai@quantatw.com>,
"Mon-Jer Wu (吳孟哲)" <Mon-Jer.Wu@quantatw.com>,
"Claud Chang (張恭築)" <Claud.Chang@quantatw.com>,
"San Lin (林建菱)" <San.Lin@quantatw.com>,
"Ren Kuo" <Ren.Kuo@quantatw.com>,
"David H.T. Wang" <davidhtwang@aopen.com>,
"Fong Lin" <fonglin@aopen.com>,
"Steven Cheng" <stevencheng@aopen.com>,
"Tom Chen" <tomchen@aopen.com>, "Don Chang" <donchang@aopen.com>,
milesschofield@aopen.com
Subject: Re: [PATCH v4 1/2] usb: dwc2: alloc dma aligned buffer for isoc split in
Date: Fri, 11 May 2018 17:33:55 +0800 [thread overview]
Message-ID: <60703355-c0e5-f6f4-0933-1efb7b46dded@rock-chips.com> (raw)
In-Reply-To: <CAD=FV=VGhnQ2NQqn+HYNadxor8a4gNwj8hmSvGXxxstKiUJmdA@mail.gmail.com>
Dear Doug,
在 2018年05月11日 05:01, Doug Anderson 写道:
> Hi,
>
> On Wed, May 9, 2018 at 3:11 AM, William Wu <william.wu@rock-chips.com> wrote:
>> The commit 3bc04e28a030 ("usb: dwc2: host: Get aligned DMA in
>> a more supported way") rips out a lot of code to simply the
>> allocation of aligned DMA. However, it also introduces a new
>> issue when use isoc split in transfer.
>>
>> In my test case, I connect the dwc2 controller with an usb hs
>> Hub (GL852G-12), and plug an usb fs audio device (Plantronics
>> headset) into the downstream port of Hub. Then use the usb mic
>> to record, we can find noise when playback.
>>
>> It's because that the usb Hub uses an MDATA for the first
>> transaction and a DATA0 for the second transaction for the isoc
>> split in transaction. An typical isoc split in transaction sequence
>> like this:
>>
>> - SSPLIT IN transaction
>> - CSPLIT IN transaction
>> - MDATA packet
>> - CSPLIT IN transaction
>> - DATA0 packet
>>
>> The DMA address of MDATA (urb->dma) is always DWORD-aligned, but
>> the DMA address of DATA0 (urb->dma + qtd->isoc_split_offset) may
>> not be DWORD-aligned, it depends on the qtd->isoc_split_offset (the
>> length of MDATA). In my test case, the length of MDATA is usually
>> unaligned, this cause DATA0 packet transmission error.
>>
>> This patch use kmem_cache to allocate aligned DMA buf for isoc
>> split in transaction. Note that according to usb 2.0 spec, the
>> maximum data payload size is 1023 bytes for each fs isoc ep,
>> and the maximum allowable interrupt data payload size is 64 bytes
>> or less for fs interrupt ep. So we set the size of object to be
>> 1024 bytes in the kmem cache.
>>
>> Signed-off-by: William Wu <william.wu@rock-chips.com>
>> ---
>> Changes in v4:
>> - get rid of "qh->dw_align_buf_size"
>> - allocate unaligned_cache for Address DMA mode and Desc DMA mode
>> - freeing order opposite of allocation
> You only did half of this. You changed the order under "error4" but
> forgot to make dwc2_hcd_remove() match.
Ah, sorry, I'm careless.
>
>
>> - do dma_map_single() with the size of DWC2_KMEM_UNALIGNED_BUF_SIZE
>>
>> Changes in v3:
>> - Modify the commit message
>> - Use Kmem_cache to allocate aligned DMA buf
>> - Fix coding style
>>
>> Changes in v2:
>> - None
>>
>> drivers/usb/dwc2/core.h | 3 ++
>> drivers/usb/dwc2/hcd.c | 87 ++++++++++++++++++++++++++++++++++++++++++--
>> drivers/usb/dwc2/hcd.h | 8 ++++
>> drivers/usb/dwc2/hcd_intr.c | 8 ++++
>> drivers/usb/dwc2/hcd_queue.c | 3 ++
>> 5 files changed, 105 insertions(+), 4 deletions(-)
> My only remaining comment is a really nitty detail. Unless someone
> else feels strongly about it, I'm not sure it's worth spinning the
> patch just for that nit unless someone else has review comments.
>
> I believe I've looked at this enough to say:
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
Thank you very much for your review. I will submit V5 patches to fix the
order of memory free in dwc2_hcd_remove(), and also add Review-by.
>
>
>
next prev parent reply other threads:[~2018-05-11 9:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-09 10:10 [PATCH v4 0/2] usb: dwc2: fix isoc split in transfer issue William Wu
2018-05-09 10:11 ` [PATCH v4 1/2] usb: dwc2: alloc dma aligned buffer for isoc split in William Wu
2018-05-10 21:01 ` Doug Anderson
2018-05-11 9:33 ` wlf [this message]
2018-05-09 10:11 ` [PATCH v4 2/2] usb: dwc2: fix isoc split in transfer with no data William Wu
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=60703355-c0e5-f6f4-0933-1efb7b46dded@rock-chips.com \
--to=wulf@rock-chips.com \
--cc=Allen.Hsu@quantatw.com \
--cc=Claud.Chang@quantatw.com \
--cc=John.Youn@synopsys.com \
--cc=Kevin.Shai@quantatw.com \
--cc=Martin.Tsai@quantatw.com \
--cc=Mon-Jer.Wu@quantatw.com \
--cc=Ren.Kuo@quantatw.com \
--cc=San.Lin@quantatw.com \
--cc=Spruce.Wu@quantatw.com \
--cc=StanTsui@aopen.com \
--cc=daniel.meng@rock-chips.com \
--cc=davidhtwang@aopen.com \
--cc=dianders@google.com \
--cc=donchang@aopen.com \
--cc=felipe.balbi@linux.intel.com \
--cc=fonglin@aopen.com \
--cc=frank.wang@rock-chips.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=hminas@synopsys.com \
--cc=huangtao@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=milesschofield@aopen.com \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=stevencheng@aopen.com \
--cc=tomchen@aopen.com \
--cc=william.wu@rock-chips.com \
--cc=wzz@rock-chips.com \
--cc=zsq@rock-chips.com \
--subject='Re: [PATCH v4 1/2] usb: dwc2: alloc dma aligned buffer for isoc split in' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).