Re: [PATCH] ALSA: usb-audio: rotate standard MIDI output port scan

From: Takashi Iwai

Date: Fri Mar 27 2026 - 07:46:02 EST


On Mon, 23 Mar 2026 14:46:24 +0100,
Cássio Gabriel wrote:
>
> snd_usbmidi_standard_output() iterates output ports in ascending order
> and drains each active port until the URB is full. On interfaces where
> multiple USB-MIDI cables share one endpoint, sustained traffic on a
> lower-numbered port can consume every refill before higher-numbered
> ports are even examined.
>
> That behavior dates back to the original implementation and still
> applies with the current multi-URB output path. snd_usbmidi_do_output()
> can refill several idle URBs in one pass, but each refill restarts the
> scan at port 0, so a busy lower-numbered port can keep higher-numbered
> ports from making progress at all.
>
> Use ep->current_port as the starting point of the scan and advance it
> after each URB fill. This keeps the existing packet formatting and
> per-port state handling intact while preventing persistent starvation of
> higher-numbered ports.
>
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@xxxxxxxxx>

Looks like a nice logical improvement.

Applied to for-next branch now. Thanks.


Takashi