ubsa speed limit

Dominic Fandrey kamikaze at bsdforen.de
Fri May 2 12:29:09 UTC 2008


Adam McDougall wrote:
> Dominic Fandrey wrote:
>> When I download a single file it seems that the download speed is 
>> limited to 32k (raw data as shown by netstat). Under Windows I can 
>> reach values around 60k. I can achieve more throughput (though not as 
>> much as under Windows), when downloading several files at once.
>>
> Try this hack, its using concepts I gathered from people patching the 
> Linux driver, basically increasing the block size of transfers.
> 
> Edit ubsa.c and recompile/reload the ubsa driver.  Its located around 
> line 362.  Basically replace UGETW(ed->wMaxPacketSize); or 
> UGETW(ed->wMaxPacketSize); with 2048.  I think the default is 512 and 
> you can play with different values to evaluate its effect on speed.  I 
> realized a large performance boost from 2048, I think at least 80k/sec 
> transfer rate.
> 
>                } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
>                    UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
>                        ucom->sc_bulkin_no = ed->bEndpointAddress;
> -                       ucom->sc_ibufsize = UGETW(ed->wMaxPacketSize);
> +                       ucom->sc_ibufsize = 2048;
> +                       // ucom->sc_ibufsize = UGETW(ed->wMaxPacketSize);
>                } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT &&
>                    UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
>                        ucom->sc_bulkout_no = ed->bEndpointAddress;
> -                       ucom->sc_obufsize = UGETW(ed->wMaxPacketSize);
> +                       ucom->sc_obufsize = 2048;
> +                       // ucom->sc_obufsize = UGETW(ed->wMaxPacketSize);
>                }
>        }

Thanks a lot. This improves the situation a lot. However I found the 
improvement somewhat unsteady. I think that a 2k or 4k buffer is still not 
sufficient if the answering time is high. A 16k buffer leads to a much more 
steady data stream for me.

I think the best solution would be dynamic buffer allocation similar to what 
is done on layer 4.


More information about the freebsd-stable mailing list