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

2020-05-30 Thread Christos Zoulas
In article <24273.15131.928644.743...@guava.gson.org>,
Andreas Gustafsson   wrote:
>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?

Yes, let's do it but put a comment in the commit message that provides
a summary of this message, so next time someone encounters an issue,
they find the information in one place.

christos



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

2020-05-29 Thread Andreas Gustafsson
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, g...@gson.org