Open nickpelling opened 2 months ago
After debugging this for a while, it seems that the stream_urb_completion() error is to do with the scatter/gathers being constructed for the stream buffers. So, the patch suggested above seems to be working, and the stream_urb_completion() error is an unrelated problem.
I'm trying to get the latest U3V working under Debian Bullseye, but this is yielding lots of scatter/gather list failures like this:
Enabling the debug output in calculate_urb_sizes prints out this:
The problem seems to be that if the desired first USB transaction length of a set is not a multiple of the max packet size (i.e. before being clipped), then the code can cause a second consecutive non-multiple of the max packet size to be emitted, depending on the page alignment.
The specific case causing the problem for me has bytes_remaining = 65536, which is triggering an initial bytes_to_transfer value of 2944, which is then being rounded down to 2048 (because the max packet size is 1024). The second packet is then getting sized to 896 bytes (to go to the page boundary), which is triggering the error condition.
My patch attempting to fix this issue looks like this:
This prevents the scatter/gather failures, but instead yields a different warning when the packet is received:
[ 2382.175004] usb 7-1: stream_urb_completion: entry 90, urb 72: length = 40, expected >=64
So I'm not sure if my fix is actually fixing the problem.
Is this whole thing a known issue? Or might it be being triggered by something else entirely, e.g. the memory alignment of the USB buffers?