RE: [BUG REPORT] usb: dwc3: Bug while setting the USB transfer bandwidth on UVC gadget driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Balbi,

Thanks for your quick reply.

Some questions

1. You mentioned that the max bandwidth in isoc mode (USB3.0) should be 
around 4Gbps.  

I have the below calcuation on bandwidth:
In USB3.0, 1 micro frame would take 125us and can transfer max 45000 bytes
So, in 1 sec, we will have 8000 micro frames

Max bandwidth = 8000 x 4500 x 8 = 2.88Gbps

Is my understanding correct?

2. To achieve the max throughput, I need to configure the uvc gadget driver 
with below parameters. Am I right?

# modprobe g_webcam streaming_maxpacket=3072 streaming_maxburst=15 
streaming_interval=1


3. You suggest me to try on kernel v5.12 or the latest v5.13-rc. It looks not
easy in my side to upgrade the kernel version. It would affect those other 
device drivers I'm currently using. So, do you think there's any short cut 
to fix this problem under my current kernel version - v5.4?


4. I read through the procedures to capture debug info by debugfs. However,
in my test with "streaming_maxburst" set to 10 or above, my system would 
crash and I can't pick the log from that point. Any suggestion?

best regards,

Watson


-----Original Message-----
From: Felipe Balbi <balbi@xxxxxxxxxx> 
Sent: Friday, May 14, 2021 3:16 PM
To: Chow, Watson <Watson.Chow@xxxxxxxxx>; linux-usb@xxxxxxxxxxxxxxx
Subject: Re: [BUG REPORT] usb: dwc3: Bug while setting the USB transfer bandwidth on UVC gadget driver


Hi Watson,

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

"Chow, Watson" <Watson.Chow@xxxxxxxxx> 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/trans
> fer-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+U
> ltraScale+MPSoC+VCU+TRD+2020.1+-+Xilinx+Low+Latency+PS+DDR+NV12+HDMI+A
> udio+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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux