Subject: kern/32588: umidi(4) transmit throughput
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <nbgnats@anastigmatix.net>
List: netbsd-bugs
Date: 01/21/2006 17:35:00
>Number:         32588
>Category:       kern
>Synopsis:       umidi(4) transmit throughput
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 21 17:35:00 +0000 2006
>Originator:     Chapman Flack
>Release:        2.0
>Organization:
>Environment:
NetBSD lundestad.anastigmatix.net 2.0 NetBSD 2.0 (lundestad) #112: Sat Jan 21 01:50:59 EST 2006  xxx@xxx:/usr/src/sys/arch/i386/compile/lundestad i386

>Description:
The use of 4-byte USB transfers in umidi(4) limits MIDI throughput
on USB1.1 to a scant 16% of the 1983 MIDI spec data rate. An earlier
patch (kern/32441) fixes that for receive; this patch is the fix for
transmit.
>How-To-Repeat:
Over a USB1.1 link to a USB-MIDI adapter (my configuration: ALi USB2
chipset with ehci disabled, and Midiman Midisport 2x4), blast some data
out an rmidi port (\376 is a valid single-byte MIDI message; a 3125-byte
block should transmit in one second):

$ </dev/zero tr '\0' '\376' | dd bs=3125 count=10 of=/dev/rmidi2
10+0 records in
10+0 records out
31250 bytes transferred in 62.544 secs (499 bytes/sec)

>Fix:
http://www.anastigmatix.net/cvsweb.cgi/NetBSD/umidixmt.pat

After this patch:

$ exec 3>/dev/rmidi2 4>/dev/rmidi3 5>/dev/rmidi4 6>/dev/rmidi5
$ for i in 3 4 5 6
> do </dev/zero tr '\0' '\376' | dd bs=3125 count=60 >&$i &
> done
[1] 430 1076
[2] 484 1208
[3] 794 1115
[4] 990 1046
$ 59+1 records in
59+1 records out
185399 bytes transferred in 59.183 secs (3132 bytes/sec)
60+0 records in
60+0 records out
187500 bytes transferred in 59.817 secs (3134 bytes/sec)
60+0 records in
60+0 records out
187500 bytes transferred in 59.824 secs (3134 bytes/sec)
60+0 records in
60+0 records out
187500 bytes transferred in 59.836 secs (3133 bytes/sec)

...sustained simultaneous transmission to all four ports at full MIDI
data rate.

This patch should be fuzz-free on 2.0 sources after application of the
kern/32441, 32442, and 32567 patches. There has been little cvs activity
on the affected files since 2.0, so applying to current sources should
be straightforward.