Re: [PATCH 1/2] usb: xhci: fix isoc silent reschedule creating stream gap on CFC controllers

From: Mathias Nyman

Date: Tue May 05 2026 - 09:45:39 EST


On 5/5/26 02:31, Nicola Lunghi wrote:
xhci_get_isoc_frame_id() silently rescheduled the first TRB to
start_frame_id+1 when the requested start frame was out of the valid
scheduling window or landed exactly on its boundary. This creates an
explicit one-frame hole in the isochronous stream.

Agreed, setting start_frame to start_frame_id + 1 would only make
sense for the very first URB, otherwise we create glitches.

Looks like the whole start_frame_id calculation is incorrect.

xhci specification 4.11.2.5 'Start Frame ID' formula sums together several
values in frame units, while driver currently sums values in microframes, and
then turns it into frames.

xhci 4.11.2.5
"Software should not schedule an Isoch TD with a Frame ID value that is less than
the Start Frame ID, where:

Start Frame ID = (Frame Index of the current MFINDEX register value + IST + 1) MOD 2048
where IST shall be rounded up to the nearest frame boundary if it is defined in
microframes"

Looks like we don't consider the ESIT rules for frame id either (xhci 4.11.2.5.1).
frame ID must be aligned with starting frames of an ESIT, so if ESIT is 2ms then
allowed frame ID values are 0,2,4,6... not 1,3,5..

Thanks
Mathias