Re: How to increase the speed of ?USB reading?

Maybe instead of you repeatedly posting the same message, providing some
relevant data would get you an answer. How fast in MB/sec? What level of
USB (1, 2, or 3)? Provide the read code proving proper usage of overlapped
I/O and thread utilization.

wrote in message news:xxxxx@ntdev…
>
> How to increase the speed of USB reading ?
>
> A usb device which performans bulk transfer.
>
> The reading operaion launched in the APP layer can’t meet the speed
> requirement, so there should be set up some mechanisms in order to
> transfer data as soon as posssible.
>
> The simple way I can find is allocating some buffers in the driver, the
> driver itself builds reading IRPs continuously and implementing the
> reading operaion and stores the reading data in the buffer . So , the APP
> can get the data in buffer sometimes but not often .
>
> Is this ways should launch a kernel thread to perfomrmans reading
> operations?
>
> Or is there any more accurate ways ?
>
> Thanks.
>
>
>
>
>

How many concurrent reads do you have pending at any point in time?

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@gmail.com
Sent: June 12, 2010 8:52 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to increase the speed of ?USB reading?

A usb device which performans bulk transfer.

The reading operaion launched in the APP layer can’t meet the speed requirement, so there should be set up some mechanisms in order to transfer data as soon as posssible.

The simple way I can find is allocating some buffers in the driver, the driver itself builds reading IRPs continuously and implementing the reading operaion ?and stores the reading data in the buffer . So , the APP can reading the data in buffer sometimes but not often .

Is this ways should launch a kernel thread to perfomrmans reading operations?

Or is there any ?more accurate? ways ?

Thanks.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

sorry for repeat posting , I just want to conquer the garbage characters problem .

The occasion is:
a USB2.0( cypress 68013 ) device;
the speed requires 4MB/s ;
windows XP .

Just now , we just utilize the cypress’s driver package, and just access the device form the APP layber , it can’t run fast enough , so we want to launch the reading operation in the kernel .

If any one has the authorization ? please delete the garbage characters post.

Thanks.

By the way , I deeply hope this froum can be more functional .

Before you write your own driver, look at both WinUSB and making sure that your app has enough pending io to the device such that you use as much of the HC schedule as possible.

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@gmail.com
Sent: June 12, 2010 11:45 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Re: How to increase the speed of ?USB reading?

sorry for repeat posting , I just want to conquer the garbage characters problem .

The occasion is:
a USB2.0( cypress 68013 ) device;
the speed requires 4MB/s ;
windows XP .

Just now , we just utilize the cypress’s driver package, and just access the device form the APP layber , it can’t run fast enough , so we want to launch the reading operation in the kernel .


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

You mean just use the WinUSB driver provided by Mircosoft ? and then can send musch “pending io” to it ? what is the HC schedule means ? high critical ?

I don’t mush of the WinUSB ,and we want to build our own driver.

I deeply hope you realize this forum is just a front-end for a mailing list (like listserv) that’s also accessible via NNTP. That’s why you can’t edit or delete posts: A few short seconds after you’ve “posted” them, they’ve been emailed to several thousand people.

So, is the forum likely to increase in functionality? Not anytime soon.

Peter
OSR

HC == host controller. Why are you bell bent on writing your own driver if you can reuse one?

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@gmail.com
Sent: June 13, 2010 12:29 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Re: How to increase the speed of ?USB reading?

You mean just use the WinUSB driver provided by Mircosoft ? and then can send musch “pending io” to it ? what is the HC schedule means ? high critical ?

I don’t mush of the WinUSB ,and we want to build our own driver.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Can the WinUSB providing source code ?

Any way , I just want to know a method , I would very preciate if some one can give me a positive answer .

Thanks

You do not get WinUSB source code, it does run on xp through win7 though. I gave you the right advice, have multiple pending reads to the hardware at the same time. It doesn’t matter if it is your driver or WinUSB, it is the same approach. If you want to write your own driver and the associated cost of maintaining and debugging it, look at the usbsamp sample in the win7 WDK.

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@gmail.com
Sent: June 13, 2010 9:28 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Re: How to increase the speed of ?USB reading?

Can the WinUSB providing source code ?

Any way , I just want to know a method , I would very preciate if some one can give me a positive answer .

Thanks


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

> How to increase the speed of USB [bulk transfer reads]?

The reading operaion launched in the APP layer can’t meet the speed
requirement, so there should be set up some mechanisms in order to
transfer data as soon as posssible.

(1) Is your “speed requirement” violated by the system’s bandwidth or
latency? (If you don’t understand the question, please learn about
bandwidth and latency [problems], then come back with a reply.)

(2) As Doron already pointed out, use multiple pending requests to make
sure the OS fully utilizes the host controller for your app requests and
your logic does not add latency.

(3) What is your application level transfer block size? (No, not the
64/512 bytes on USB level, but the “APDU” size.)
If e.g. the application block size is in the 16kB range, using WUDF
results in a 10-15% bandwidth degradation compared to WDM. If your
blocks can be made much bigger (e.g. several MB), WUDF/KMDF/WinUSB
should be very much able to saturate the USB bus.

Can the WinUSB providing source code ?

(4) Windows is a commercial operating system developed and maintained by
Microsoft Corporation. MS happens to live from selling it. Also the OS
is used in commercial environments. Understandably, MS will very likely
not make its OS source code base open in the foreseeable future.
If you want to look at operating system USB code, go and check out any
open source OS that has an USB driver.
If you want to look at Windows source code, go and check out the
academic and industry programmes where MS offers this (under NDA).

I don’t think you said what the device is, but if it’s a file system,
you could enable NTFS compression or whatever, and that will give you a
2-3x boost in apparent bandwidth as you’ll be copying less data (and
then it’s up to the CPU to uncompress it). You may be able to use other
compression schemes with other USB devices to lessen the amount of data
that is actually copied.

Also, are you after increasing the bandwidth (amount of data coming
through per time period) or the delay (time between a request and when
the first data arrives)? If the first, you’re probably not going to be
able to do much as you might already be hitting the point where you’re
running at the limits of the physical USB bandwidth. Have you performed
measurement tests to see?

It’s very possible to get 40 MB/s on a USB-2 host with Cypress USB device, I’v done that. You need to post requests large enough, though. Use 16 kB as a good start. Even posting a single 16 kB request to a bulk pipe will give you at least 8 MB/s, assuming that the host controller driver will miss every other frame.

On 6/12/2010 11:46 PM, xxxxx@gmail.com wrote:

The occasion is:
a USB2.0( cypress 68013 ) device;
the speed requires 4MB/s ;
windows XP .

Just now , we just utilize the cypress’s driver package, and just access the device form the APP layber , it can’t run fast enough , so we want to launch the reading operation in the kernel .

You can stream 30 MB/s from a bulk pipe on a FX2 device (and I don’t
want to hear any teasing). The KEY, as has been pointed out several
times in this thread, is that you must have multiple requests
outstanding at any given time.

Remember that USB is a scheduled bus. The host controller lays out a
plan for the next millisecond based on the requests that it has at the
time. If you only have one request to read 4k bytes, for example, then
that’s all the host controller will schedule. You won’t get another
chance until that request gets sent back up to your application, is
processed, and is returned. That’s a lot of wasted time.

But if you send 10 requests for 64k bytes, for example, then the host
controller will schedule them all. As each one completes, your other
requests will be processed while your application handles it and returns
it for processing.

That can be done with WinUSB just as easily as it can from a kernel driver.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thanks,

The device can be known as a AD card.

“have multiple pending reads to the hardware at the same time” ?? Can you give me some more information to implemet this ? Just launch “large size( like 4k bytes )” reading operation in APP ?

Thanks again.

On 6/15/2010 9:13 AM, xxxxx@gmail.com wrote:

The device can be known as a AD card.

“have multiple pending reads to the hardware at the same time” ?? Can you give me some more information to implemet this ? Just launch “large size( like 4k bytes )” reading operation in APP ?

If you use FILE_FLAG_OVERLAPPED when you open the file, you can call
ReadFile several times in a row. Each ReadFile submits a read request,
and then returns control to you before the read has completed. That
way, when the first read finishes, there is already another request
waiting to go, without having to wait for you to resubmit.

There are lots of web articles on overlapped I/O.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I think you mean that I should have to realization a FILE_FLAG_OVERLAPPED driver ?
If I don’t follow this , hwo to do ? The APP Just reads , In my driver , making the IRP pending and queue them ?And then how to ?

Another quetion is if I launch “large size( like 4k bytes )” reading operation in APP , then the USB bus dirver( Mircosoft’s USBD.sys driver) will divided it into 512B( bulk type ) ? that will transfer 8 times , until all these 8 transfer is over, the IRP will be completed ?

On 6/15/2010 9:51 AM, xxxxx@gmail.com wrote:

I think you mean that I should have to realization a FILE_FLAG_OVERLAPPED driver ?

The driver probably does not have to change. You’re already creating an
URB and sending it to the device, then returning STATUS_PENDING while
the URB runs. Right?

It is your application that has to specify FILE_FLAG_OVERLAPPED when it
calls CreateFile.

If I don’t follow this , hwo to do ? The APP Just reads , In my driver , making the IRP pending and queue them ?And then how to ?

As I said, there are many web sites that describe overlapped I/O on
Windows. If you’re going to have 3 requests outstanding, you create 3
OVERLAPPED structures, each with an event inside it. You then call
ReadFile three times in a row. Then, as an example, you can call
WaitForMultipleObjects to wait for one of the requests to complete. You
call GetOverlappedResult to make sure it completed successfully, then
you process it, and resubmit it by calling ReadFile again.

Another quetion is if I launch “large size( like 4k bytes )” reading operation in APP , then the USB bus dirver( Mircosoft’s USBD.sys driver) will divided it into 512B( bulk type ) ? that will transfer 8 times , until all these 8 transfer is over, the IRP will be completed ?

Yes. The limit for a single transfer depends on the operating system,
but up to 1MB or 2MB is safe.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thanks all above .

Yesterday , I got to know the URB’s UrbLink field.

I think if I can do it like this :
To form a chain of URBs to ONE IRP and then send to the USBD.sys, so , a series of USB bus’s sequential millisecond can be occupied by this BIG IRP . So It is me to help the host controller do its schedule operation.

Sorry no. UrbLink is not supported. You need to send multiple IRPs. Each IRP has one URB in it

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, June 16, 2010 8:55 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Re: How to increase the speed of ?USB reading?

Thanks all above .

Yesterday , I got to know the URB’s UrbLink field.

I think if I can do it like this :
To form a chain of URBs to ONE IRP and then send to the USBD.sys, so , a series of USB bus’s sequential millisecond can be occupied by this BIG IRP . So It is me to help the host controller do its schedule operation.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer