linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: "Chow, Watson" <Watson.Chow@Avnet.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [BUG REPORT] usb: dwc3: Bug while setting the USB transfer bandwidth on UVC gadget driver
Date: Fri, 14 May 2021 10:16:27 +0300	[thread overview]
Message-ID: <87r1i97pkk.fsf@kernel.org> (raw)
In-Reply-To: <6bc8ab9c4e3f4bafae13a7574b1ae0e3@Avnet.com>

[-- Attachment #1: Type: text/plain, Size: 2714 bytes --]


Hi Watson,

(please teach your mailer to break lines at 80 columns)

"Chow, Watson" <Watson.Chow@Avnet.com> writes:
> Hi,
>
> I'm using the SoC (Xilinx MPSoC) with DWC3 USB controller. I need to
> emulate my hardware to work like a USB camera and so make use of the
> USB UVC gadget driver - g_webcam.

which Kernel version are you running?

> Refer to this link and the driver source code, I find 3 parameters to
> configure the ISOC transfer bandwidth.
>
> https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/transfer-data-to-isochronous-endpoints#isochronous-transfer-example
>
> They are:
>
> streaming_maxpacket : range [1 - 3072] 
> streaming_maxburst : range [0 - 15]
> streaming_interval : [1 - 16]
>
> So, I load the driver in this way
>
> # modprobe g_webcam streaming_maxpacket=3072 streaming_maxburst=9 streaming_interval=2
>
> Create my own app base on
> https://github.com/wlhe/uvc-gadget
>
> Test result
>
> In my evaluation, I can set the combination of parameters up to
> this. The streaming is ok.
>
> # modprobe g_webcam streaming_maxpacket=3072 streaming_maxburst=9 streaming_interval=2

streaming_maxburst=15 should work here too.

> This should be around 900Mbit/sec. Far less than 5Gbps bandwidth of
> USB3.0

IIRC Isoc endpoints can't take the full bus bandwidth, I don't remember
the exact limit but I think it's 80% of full bandwidth. Still, that
should be around 4Gbit/sec

> When I increase the parameter combination to:
> # modprobe g_webcam streaming_maxpacket=3072 streaming_maxburst=10 streaming_interval=2
>
> I get the below error message and everything stop.
>
> [ 1089.751559] g_webcam gadget: uvc: VS request completed with status -18.

> 1. This error is somehow related to the underflow of the transfer
> queue. Is my understanding correct?

that means the controller lost an isoc interval. There is still
discussion going on regarding isoc intervals in dwc3. It turns out the
HW doesn't make scheduling super easy for SW :-)

> If so, how to solve?
> 2.	My goal is to utilize the full bandwidth of USB3.0. How can I achive?
>
> [Some background information and my test setup]
>
> I started from the Xilinx TRD here.
>
> https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/541786361/Zynq+UltraScale+MPSoC+VCU+TRD+2020.1+-+Xilinx+Low+Latency+PS+DDR+NV12+HDMI+Audio+Video+Capture+and+Display
>
> With kernel version v5.4:
> https://github.com/Xilinx/linux-xlnx/tree/xlnx_rebase_v5.4_2020.2

v5.4 is super old, please test with v5.12 or the latest v5.13-rc. Also,
when reporting dwc3 bugs, make sure to include regdump and trace events
as described in dwc3 documentation

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

  reply	other threads:[~2021-05-14  7:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14  3:20 [BUG REPORT] usb: dwc3: Bug while setting the USB transfer bandwidth on UVC gadget driver Chow, Watson
2021-05-14  7:16 ` Felipe Balbi [this message]
2021-05-14  8:59   ` Chow, Watson
2021-05-14 10:31     ` Felipe Balbi
2021-05-17  3:58       ` Chow, Watson
2021-05-17  5:32         ` Felipe Balbi
2021-06-04  2:53           ` Chow, Watson
2021-06-04  5:15             ` Felipe Balbi
2021-06-07  6:11             ` Peter Chen
2021-06-07 11:26               ` Chow, Watson

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=87r1i97pkk.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=Watson.Chow@Avnet.com \
    --cc=linux-usb@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).