tech-kern archive

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

Fix for slow run(4) configuration on OHCI/UHCI



Hi all,

When I connect a USB WiFi adapter based on a Ralink RT5370 chip to a
USB port that uses an OHCI or UHCI host controller, running "ifconfig
run0 up" takes a very long time, about 20-30 seconds.

This is because the run(4) driver writes a large amount of data to the
device just two bytes at a time using the WRITE_2 command, and each
write takes two full USB frames of 1 millisecond each on UHCI, or
three frames on OCHI.  With an EHCI or XHCI controller, the large
number of transfers is not a problem as these controllers can perform
multiple control transfers within a single frame.

The driver already contains code to do the transfers in larger blocks
using the WRITE_REGION_1 command, but it's #if'ed out with a comment
saying it is "not stable on RT2860".  The FreeBSD driver is similar,
except that its version of the #if'ed-out code limits the transfers
to a maximum of 64 bytes at a time.

I have verified that enabling the use of WRITE_REGION_1 with the
64-bit limit from FreeBSD works with my RT5370 based adapter, and
makes it configure about ten times faster on OHCI and UHCI.

I'm now using the following patch, which enables the use of
WRITE_REGION_1 using blocks of up to 64 bytes for the RT5370 only:

  https://www.gson.org/netbsd/patches/run-faster.patch

OK to commit?
-- 
Andreas Gustafsson, gson%gson.org@localhost


Home | Main Index | Thread Index | Old Index