Subject: Re: proposed change to ugen to enable USRP to work
To: Greg Troxel <gdt@ir.bbn.com>
From: Hans Petter Selasky <hselasky@c2i.net>
List: tech-kern
Date: 05/03/2006 22:41:20
On Wednesday 03 May 2006 21:55, Greg Troxel wrote:
> The USRP uses bulk transfers, and avoids large reads to keep latencies
> down.
>
>   I think the problem you experience entirely lies within the file
>   "usb/ugen.c".
>
> Agreed; perhaps that was too implicit.  The intent was to modify
> ugen.c to have multiple reads going at once.  But, this is different
> semantics than ugen currently has, where bus transactions only happen
> when read is called.  So we need something clean and backwards
> compatible in NetBSD that's usable by the USRP user-space library.
>
> The ugen.c on your website looks quite different from NetBSD-current's
> ugen.c.  Can you explain the lineage and differences?

My "/dev/dev/ugenX.X" is backwards compatible with the old "/dev/ugenX.X". 
Else my "ugen.c" is a fork of the "NetBSD" "ugen.c".

The main difference is that it supports isochrounous writes and high speed 
isochronous transfers. Also it is free of Giant/splxxx.

The first reason that the NetBSD's ugen performs so bad, is because 
"UGEN_BBSIZE" is set to "1024" bytes. Try setting this define to "(1<<17)".

The second reason is that it does not queue the bulk transfers correctly, so 
that the EHCI will wait up to 1 milli-second before doing the transfer.

Here is the problem I think. To transfer 4 megabytes per second, ugen has to 
interrupt, 4*1024*1024 / 1024 = 4096 times per second. That is simply too 
much. i.e. the USB host controller does not walk the memory lists that often.

On the other hand, my implementation should be 64 times faster, hence the 
buffer size is 64 times larger.

--HPS