I have an USB2.0 device that communicates pieces of data as large bulk
transfers (1-2 MB). On XP I can receive them correctly. As the doc says,
MaximumTransferSize seems practically unlimited.
On Vista RC2 (5744), USBD_CreateConfigurationRequestEx comes back with
MaximumTransferSize set to 0x400000 (no matter what I put there before). This
is too small for my bulk transfer (though the doc doesn't know anything about
such a limit on Vista).

Any way to override this limit?

Any way to split up the transfer without modifying the device's firmware?
I'm not that fluent with the dirty details of USB bulk transfer so I'm not
sure what kind of concepts would apply here?!

Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744)? by Alexander

Alexander
Fri Oct 13 00:12:49 CDT 2006

You don't have to use such large transfers. Use multiple smaller overlapped
requests.

"Thomas Schimming" <Thomas Schimming@discussions.microsoft.com> wrote in
message news:CF42F3FE-724D-401D-BD3B-10F4A84BA9AA@microsoft.com...
>I have an USB2.0 device that communicates pieces of data as large bulk
> transfers (1-2 MB). On XP I can receive them correctly. As the doc says,
> MaximumTransferSize seems practically unlimited.
> On Vista RC2 (5744), USBD_CreateConfigurationRequestEx comes back with
> MaximumTransferSize set to 0x400000 (no matter what I put there before).
> This
> is too small for my bulk transfer (though the doc doesn't know anything
> about
> such a limit on Vista).
>
> Any way to override this limit?
>
> Any way to split up the transfer without modifying the device's firmware?
> I'm not that fluent with the dirty details of USB bulk transfer so I'm not
> sure what kind of concepts would apply here?!



Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by ThomasSchimming

ThomasSchimming
Fri Oct 13 02:41:02 CDT 2006

Sorry to be a bit ignorant here. Do you mean that I can just send down two
URBs for half the size and the second one catches the second half of my data
block? Or is there some additional magic to be done so that this overlapping
works as it should?

"Alexander Grigoriev" wrote:

> You don't have to use such large transfers. Use multiple smaller overlapped
> requests.
>
> "Thomas Schimming" <Thomas Schimming@discussions.microsoft.com> wrote in
> message news:CF42F3FE-724D-401D-BD3B-10F4A84BA9AA@microsoft.com...
> >I have an USB2.0 device that communicates pieces of data as large bulk
> > transfers (1-2 MB). On XP I can receive them correctly. As the doc says,
> > MaximumTransferSize seems practically unlimited.
> > On Vista RC2 (5744), USBD_CreateConfigurationRequestEx comes back with
> > MaximumTransferSize set to 0x400000 (no matter what I put there before).
> > This
> > is too small for my bulk transfer (though the doc doesn't know anything
> > about
> > such a limit on Vista).
> >
> > Any way to override this limit?
> >
> > Any way to split up the transfer without modifying the device's firmware?
> > I'm not that fluent with the dirty details of USB bulk transfer so I'm not
> > sure what kind of concepts would apply here?!
>
>
>

Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by fat_boy

fat_boy
Fri Oct 13 04:51:22 CDT 2006


Thomas Schimming wrote:
> Sorry to be a bit ignorant here. Do you mean that I can just send down two
> URBs for half the size and the second one catches the second half of my data
> block?

Yes. You can break the data down into what ever size you like. We
found 1k to be optimal on XP. Any larger write and the USB system
would eventually stall. At 64 bytes, throughput was abysmal.


>Or is there some additional magic to be done so that this overlapping
> works as it should?
>
> "Alexander Grigoriev" wrote:
>
> > You don't have to use such large transfers. Use multiple smaller overlapped
> > requests.
> >
> > "Thomas Schimming" <Thomas Schimming@discussions.microsoft.com> wrote in
> > message news:CF42F3FE-724D-401D-BD3B-10F4A84BA9AA@microsoft.com...
> > >I have an USB2.0 device that communicates pieces of data as large bulk
> > > transfers (1-2 MB). On XP I can receive them correctly. As the doc says,
> > > MaximumTransferSize seems practically unlimited.
> > > On Vista RC2 (5744), USBD_CreateConfigurationRequestEx comes back with
> > > MaximumTransferSize set to 0x400000 (no matter what I put there before).
> > > This
> > > is too small for my bulk transfer (though the doc doesn't know anything
> > > about
> > > such a limit on Vista).
> > >
> > > Any way to override this limit?
> > >
> > > Any way to split up the transfer without modifying the device's firmware?
> > > I'm not that fluent with the dirty details of USB bulk transfer so I'm not
> > > sure what kind of concepts would apply here?!
> >
> >
> >


Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by Tim

Tim
Sat Oct 14 00:57:46 CDT 2006

"fat_boy" <zzebowa@hotmail.com> wrote:
>
>Thomas Schimming wrote:
>> Sorry to be a bit ignorant here. Do you mean that I can just send down two
>> URBs for half the size and the second one catches the second half of my data
>> block?
>
>Yes. You can break the data down into what ever size you like. We
>found 1k to be optimal on XP. Any larger write and the USB system
>would eventually stall. At 64 bytes, throughput was abysmal.

This also depends on your hardware. If your hardware is able send data in
a stream, and transfer as much as is available, then you do have this
flexibility. Some hardware is pickier, and requires buffers of a certain
size for correct operation.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by ThomasSchimming

ThomasSchimming
Mon Oct 16 07:38:01 CDT 2006

"Tim Roberts" wrote:

> "fat_boy" <zzebowa@hotmail.com> wrote:
> >
> >Thomas Schimming wrote:
> >> Sorry to be a bit ignorant here. Do you mean that I can just send down two
> >> URBs for half the size and the second one catches the second half of my data
> >> block?
> >
> >Yes. You can break the data down into what ever size you like. We
> >found 1k to be optimal on XP. Any larger write and the USB system
> >would eventually stall. At 64 bytes, throughput was abysmal.
>
> This also depends on your hardware. If your hardware is able send data in
> a stream, and transfer as much as is available, then you do have this
> flexibility. Some hardware is pickier, and requires buffers of a certain
> size for correct operation.
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
>

In my case I have "separate" bulk transfers of a certain size (>1MB). As far
as I understand the docs, there is no notion in the protocol to delimit such
transfers other than the fact that at the end of such a transfer there is a
NAK instead of more data?!

Currently (on XP), by using a large bulk transfer with the "right"
blocklength, I am able to synchronize to the transfers of the device
(essentially I need to be able to catch the starts/ends right).

So I'm still not clear about how I would detect these starts/ends with say
1k blocked bulk transfers. I realize that this is probably all due to poor
design of the USB end of the device, but I don't have the option to work on
that side of the fence.

Also, how many 1k URBs would you recommend to have pending in order to avoid
missing any data? What about thread priority of the "data loop"?

Thanks for any thoughts.

Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by Maxim

Maxim
Mon Oct 16 07:44:11 CDT 2006

> transfers other than the fact that at the end of such a transfer there is a
> NAK instead of more data?!

USB NAK means - "wait, the data will arrive a bit later". To terminate the bulk
transfer (EOF condition), the device sends the incomplete or zero-length
packet.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by ThomasSchimming

ThomasSchimming
Mon Oct 16 09:59:02 CDT 2006

"Maxim S. Shatskih" wrote:

> > transfers other than the fact that at the end of such a transfer there is a
> > NAK instead of more data?!
>
> USB NAK means - "wait, the data will arrive a bit later". To terminate the bulk
> transfer (EOF condition), the device sends the incomplete or zero-length
> packet.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com

Ok sorry. My mistake/ignorance. Of course I mean how to detect the EOF
condition assuming that I have a certain number of 1k bulk URBs pending.

The only thing that comes to mind is to cleverly choosing my buffer length
such that the "last one" will receive less than 100% data as a result of the
EOF. Or can I detect the EOF condition more directly?

Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by Alexander

Alexander
Mon Oct 16 22:29:32 CDT 2006

1K URBs might have been optimal for USB 1.1, but for USB 2.0/EHCI (which is
smarter than UHCI), send URB for at least 1 ms worth of data, that means >64
KB (actually this is more than 1 ms). 1MB is reasonable size.

"Thomas Schimming" <ThomasSchimming@discussions.microsoft.com> wrote in
message news:EDAEC5FD-1F01-410F-95F0-3601E3A5336C@microsoft.com...
> "Tim Roberts" wrote:
>
>> "fat_boy" <zzebowa@hotmail.com> wrote:
>> >
>> >Thomas Schimming wrote:
>> >> Sorry to be a bit ignorant here. Do you mean that I can just send down
>> >> two
>> >> URBs for half the size and the second one catches the second half of
>> >> my data
>> >> block?
>> >
>> >Yes. You can break the data down into what ever size you like. We
>> >found 1k to be optimal on XP. Any larger write and the USB system
>> >would eventually stall. At 64 bytes, throughput was abysmal.
>>
>> This also depends on your hardware. If your hardware is able send data
>> in
>> a stream, and transfer as much as is available, then you do have this
>> flexibility. Some hardware is pickier, and requires buffers of a certain
>> size for correct operation.
>> --
>> - Tim Roberts, timr@probo.com
>> Providenza & Boekelheide, Inc.
>>
>
> In my case I have "separate" bulk transfers of a certain size (>1MB). As
> far
> as I understand the docs, there is no notion in the protocol to delimit
> such
> transfers other than the fact that at the end of such a transfer there is
> a
> NAK instead of more data?!
>
> Currently (on XP), by using a large bulk transfer with the "right"
> blocklength, I am able to synchronize to the transfers of the device
> (essentially I need to be able to catch the starts/ends right).
>
> So I'm still not clear about how I would detect these starts/ends with say
> 1k blocked bulk transfers. I realize that this is probably all due to poor
> design of the USB end of the device, but I don't have the option to work
> on
> that side of the fence.
>
> Also, how many 1k URBs would you recommend to have pending in order to
> avoid
> missing any data? What about thread priority of the "data loop"?
>
> Thanks for any thoughts.



Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by fredsky

fredsky
Tue Oct 17 03:28:59 CDT 2006

For our design we use 512 KB URB block and we use Overlapped IO to have
always 3 pending IRP. However we have found that splicing one IRP into
multiples concurrent URBS become incredibly difficult to manage if the
hardware sends 0 length buffers because as this is a completion case we
must complete the main IRP. The question is what are we supposed to do
with remaining URBS sent down to USB Host Driver ?? Because these URBs
are associated with main IRP buffer I believe I must complete them all,
but it's not so easy. Add the fact that next URB may have already
received some new data, we end with an IRP that is filled with two
different block of data.

So by reading (or writing) large block of data but always on at the
time we still have good performance (we only need to submit one URB to
USB Host Driver after it has transferred 512 KB, so the penalty is
negligible) ans our driver stay simple (and stable by definition).


So if you need to transfer say 2 MB by IRP the whole schema would be :

- Send IRP to your driver
- Send 1 URB with 512 KB transfer size
-> In Completion routine, test that you have transferred 512KB data
(otherwise it's a completion condition , ie short packet). If so, then
launch another URB, and so on until either you have transfered your
whole buffer or you have received a short packet condition.
- Then complete main IRP and dequeue another IRP (if any)

Hope this helps,
Fred.



Thomas Schimming a =E9crit :

> "Tim Roberts" wrote:
>
> > "fat_boy" <zzebowa@hotmail.com> wrote:
> > >
> > >Thomas Schimming wrote:
> > >> Sorry to be a bit ignorant here. Do you mean that I can just send do=
wn two
> > >> URBs for half the size and the second one catches the second half of=
my data
> > >> block?
> > >
> > >Yes. You can break the data down into what ever size you like. We
> > >found 1k to be optimal on XP. Any larger write and the USB system
> > >would eventually stall. At 64 bytes, throughput was abysmal.
> >
> > This also depends on your hardware. If your hardware is able send data=
in
> > a stream, and transfer as much as is available, then you do have this
> > flexibility. Some hardware is pickier, and requires buffers of a certa=
in
> > size for correct operation.
> > --
> > - Tim Roberts, timr@probo.com
> > Providenza & Boekelheide, Inc.
> >
>
> In my case I have "separate" bulk transfers of a certain size (>1MB). As =
far
> as I understand the docs, there is no notion in the protocol to delimit s=
uch
> transfers other than the fact that at the end of such a transfer there is=
a
> NAK instead of more data?!
>
> Currently (on XP), by using a large bulk transfer with the "right"
> blocklength, I am able to synchronize to the transfers of the device
> (essentially I need to be able to catch the starts/ends right).
>
> So I'm still not clear about how I would detect these starts/ends with say
> 1k blocked bulk transfers. I realize that this is probably all due to poor
> design of the USB end of the device, but I don't have the option to work =
on
> that side of the fence.
>
> Also, how many 1k URBs would you recommend to have pending in order to av=
oid
> missing any data? What about thread priority of the "data loop"?
>=20
> Thanks for any thoughts.


Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by ThomasSchimming

ThomasSchimming
Tue Oct 17 08:42:02 CDT 2006

Ok I'll try that. Can't do 1MB as Vista seems limited to 400k max (this was
my starting point in this thread). But I see the way to go.

As far as I understand my completion criteria (since I'm reading) will be an
incomplete buffer.

Or will I get an empty URB back if my device sends a ZLP and the total
transfer size is an exact multiple of my buffer size?

Thanks for all your help.


"Alexander Grigoriev" wrote:

> 1K URBs might have been optimal for USB 1.1, but for USB 2.0/EHCI (which is
> smarter than UHCI), send URB for at least 1 ms worth of data, that means >64
> KB (actually this is more than 1 ms). 1MB is reasonable size.
>
> "Thomas Schimming" <ThomasSchimming@discussions.microsoft.com> wrote in
> message news:EDAEC5FD-1F01-410F-95F0-3601E3A5336C@microsoft.com...
> > "Tim Roberts" wrote:
> >
> >> "fat_boy" <zzebowa@hotmail.com> wrote:
> >> >
> >> >Thomas Schimming wrote:
> >> >> Sorry to be a bit ignorant here. Do you mean that I can just send down
> >> >> two
> >> >> URBs for half the size and the second one catches the second half of
> >> >> my data
> >> >> block?
> >> >
> >> >Yes. You can break the data down into what ever size you like. We
> >> >found 1k to be optimal on XP. Any larger write and the USB system
> >> >would eventually stall. At 64 bytes, throughput was abysmal.
> >>
> >> This also depends on your hardware. If your hardware is able send data
> >> in
> >> a stream, and transfer as much as is available, then you do have this
> >> flexibility. Some hardware is pickier, and requires buffers of a certain
> >> size for correct operation.
> >> --
> >> - Tim Roberts, timr@probo.com
> >> Providenza & Boekelheide, Inc.
> >>
> >
> > In my case I have "separate" bulk transfers of a certain size (>1MB). As
> > far
> > as I understand the docs, there is no notion in the protocol to delimit
> > such
> > transfers other than the fact that at the end of such a transfer there is
> > a
> > NAK instead of more data?!
> >
> > Currently (on XP), by using a large bulk transfer with the "right"
> > blocklength, I am able to synchronize to the transfers of the device
> > (essentially I need to be able to catch the starts/ends right).
> >
> > So I'm still not clear about how I would detect these starts/ends with say
> > 1k blocked bulk transfers. I realize that this is probably all due to poor
> > design of the USB end of the device, but I don't have the option to work
> > on
> > that side of the fence.
> >
> > Also, how many 1k URBs would you recommend to have pending in order to
> > avoid
> > missing any data? What about thread priority of the "data loop"?
> >
> > Thanks for any thoughts.
>
>
>

Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by Alexander

Alexander
Tue Oct 17 23:24:49 CDT 2006

You don't even need to split input IRPs to several URBs.

Have your application send several overlapped IOCTL requests each suitable
for a single URB. Build an URB and send it down with the current IRP as an
IOCTL_INTERNAL_SUBMIT_URB. A completion routine should free the URB. The
driver becomes even simple, thus more stable.


"fredsky" <hardware.evs@gmail.com> wrote in message
news:1161073738.964751.221010@m7g2000cwm.googlegroups.com...
For our design we use 512 KB URB block and we use Overlapped IO to have
always 3 pending IRP. However we have found that splicing one IRP into
multiples concurrent URBS become incredibly difficult to manage if the
hardware sends 0 length buffers because as this is a completion case we
must complete the main IRP. The question is what are we supposed to do
with remaining URBS sent down to USB Host Driver ?? Because these URBs
are associated with main IRP buffer I believe I must complete them all,
but it's not so easy. Add the fact that next URB may have already
received some new data, we end with an IRP that is filled with two
different block of data.

So by reading (or writing) large block of data but always on at the
time we still have good performance (we only need to submit one URB to
USB Host Driver after it has transferred 512 KB, so the penalty is
negligible) ans our driver stay simple (and stable by definition).


So if you need to transfer say 2 MB by IRP the whole schema would be :

- Send IRP to your driver
- Send 1 URB with 512 KB transfer size
-> In Completion routine, test that you have transferred 512KB data
(otherwise it's a completion condition , ie short packet). If so, then
launch another URB, and so on until either you have transfered your
whole buffer or you have received a short packet condition.
- Then complete main IRP and dequeue another IRP (if any)

Hope this helps,
Fred.



Thomas Schimming a écrit :

> "Tim Roberts" wrote:
>
> > "fat_boy" <zzebowa@hotmail.com> wrote:
> > >
> > >Thomas Schimming wrote:
> > >> Sorry to be a bit ignorant here. Do you mean that I can just send
> > >> down two
> > >> URBs for half the size and the second one catches the second half of
> > >> my data
> > >> block?
> > >
> > >Yes. You can break the data down into what ever size you like. We
> > >found 1k to be optimal on XP. Any larger write and the USB system
> > >would eventually stall. At 64 bytes, throughput was abysmal.
> >
> > This also depends on your hardware. If your hardware is able send data
> > in
> > a stream, and transfer as much as is available, then you do have this
> > flexibility. Some hardware is pickier, and requires buffers of a
> > certain
> > size for correct operation.
> > --
> > - Tim Roberts, timr@probo.com
> > Providenza & Boekelheide, Inc.
> >
>
> In my case I have "separate" bulk transfers of a certain size (>1MB). As
> far
> as I understand the docs, there is no notion in the protocol to delimit
> such
> transfers other than the fact that at the end of such a transfer there is
> a
> NAK instead of more data?!
>
> Currently (on XP), by using a large bulk transfer with the "right"
> blocklength, I am able to synchronize to the transfers of the device
> (essentially I need to be able to catch the starts/ends right).
>
> So I'm still not clear about how I would detect these starts/ends with say
> 1k blocked bulk transfers. I realize that this is probably all due to poor
> design of the USB end of the device, but I don't have the option to work
> on
> that side of the fence.
>
> Also, how many 1k URBs would you recommend to have pending in order to
> avoid
> missing any data? What about thread priority of the "data loop"?
>
> Thanks for any thoughts.



Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by Tim

Tim
Tue Oct 17 23:30:07 CDT 2006

Thomas Schimming <ThomasSchimming@discussions.microsoft.com> wrote:
>
>In my case I have "separate" bulk transfers of a certain size (>1MB). As far
>as I understand the docs, there is no notion in the protocol to delimit such
>transfers other than the fact that at the end of such a transfer there is a
>NAK instead of more data?!

No, the end of a transfer is designated by a short packet or an empty
packet. So, you don't know ahead of time how large the transfers will be?
If you need

>Currently (on XP), by using a large bulk transfer with the "right"
>blocklength, I am able to synchronize to the transfers of the device
>(essentially I need to be able to catch the starts/ends right).

Then that's the right approach.

>So I'm still not clear about how I would detect these starts/ends with say
>1k blocked bulk transfers. I realize that this is probably all due to poor
>design of the USB end of the device, but I don't have the option to work on
>that side of the fence.

The model assumes you know how much data is coming, so that you can chop it
into user-mode sized pieces as it comes in.

>Also, how many 1k URBs would you recommend to have pending in order to avoid
>missing any data? What about thread priority of the "data loop"?

You NEVER "miss" data on a bulk pipe. If a packet is lost, the sender
retransmits until it is acknowleged.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by fredsky

fredsky
Wed Oct 18 04:42:27 CDT 2006

You're right Alex, in our app, we try to split IRP to transfer 512KB
worth of data. But in our driver, if the IRP must transfer more than
512 KB, we split it into multiple transfer one at a time and reusing
IRP as an URB (using KMDF 1.5RC1).

Fred.

Alexander Grigoriev a =E9crit :

> You don't even need to split input IRPs to several URBs.
>
> Have your application send several overlapped IOCTL requests each suitable
> for a single URB. Build an URB and send it down with the current IRP as an
> IOCTL_INTERNAL_SUBMIT_URB. A completion routine should free the URB. The
> driver becomes even simple, thus more stable.
>
>
> "fredsky" <hardware.evs@gmail.com> wrote in message
> news:1161073738.964751.221010@m7g2000cwm.googlegroups.com...
> For our design we use 512 KB URB block and we use Overlapped IO to have
> always 3 pending IRP. However we have found that splicing one IRP into
> multiples concurrent URBS become incredibly difficult to manage if the
> hardware sends 0 length buffers because as this is a completion case we
> must complete the main IRP. The question is what are we supposed to do
> with remaining URBS sent down to USB Host Driver ?? Because these URBs
> are associated with main IRP buffer I believe I must complete them all,
> but it's not so easy. Add the fact that next URB may have already
> received some new data, we end with an IRP that is filled with two
> different block of data.
>
> So by reading (or writing) large block of data but always on at the
> time we still have good performance (we only need to submit one URB to
> USB Host Driver after it has transferred 512 KB, so the penalty is
> negligible) ans our driver stay simple (and stable by definition).
>
>
> So if you need to transfer say 2 MB by IRP the whole schema would be :
>
> - Send IRP to your driver
> - Send 1 URB with 512 KB transfer size
> -> In Completion routine, test that you have transferred 512KB data
> (otherwise it's a completion condition , ie short packet). If so, then
> launch another URB, and so on until either you have transfered your
> whole buffer or you have received a short packet condition.
> - Then complete main IRP and dequeue another IRP (if any)
>
> Hope this helps,
> Fred.
>
>
>
> Thomas Schimming a =E9crit :
>
> > "Tim Roberts" wrote:
> >
> > > "fat_boy" <zzebowa@hotmail.com> wrote:
> > > >
> > > >Thomas Schimming wrote:
> > > >> Sorry to be a bit ignorant here. Do you mean that I can just send
> > > >> down two
> > > >> URBs for half the size and the second one catches the second half =
of
> > > >> my data
> > > >> block?
> > > >
> > > >Yes. You can break the data down into what ever size you like. We
> > > >found 1k to be optimal on XP. Any larger write and the USB system
> > > >would eventually stall. At 64 bytes, throughput was abysmal.
> > >
> > > This also depends on your hardware. If your hardware is able send da=
ta
> > > in
> > > a stream, and transfer as much as is available, then you do have this
> > > flexibility. Some hardware is pickier, and requires buffers of a
> > > certain
> > > size for correct operation.
> > > --
> > > - Tim Roberts, timr@probo.com
> > > Providenza & Boekelheide, Inc.
> > >
> >
> > In my case I have "separate" bulk transfers of a certain size (>1MB). As
> > far
> > as I understand the docs, there is no notion in the protocol to delimit
> > such
> > transfers other than the fact that at the end of such a transfer there =
is
> > a
> > NAK instead of more data?!
> >
> > Currently (on XP), by using a large bulk transfer with the "right"
> > blocklength, I am able to synchronize to the transfers of the device
> > (essentially I need to be able to catch the starts/ends right).
> >
> > So I'm still not clear about how I would detect these starts/ends with =
say
> > 1k blocked bulk transfers. I realize that this is probably all due to p=
oor
> > design of the USB end of the device, but I don't have the option to work
> > on
> > that side of the fence.
> >
> > Also, how many 1k URBs would you recommend to have pending in order to
> > avoid
> > missing any data? What about thread priority of the "data loop"?
> >
> > Thanks for any thoughts.


Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by Alexander

Alexander
Wed Oct 18 10:51:27 CDT 2006

There is still a possibility of device internal FIFO overflow, if you don't
drain the data fast enough.


"Tim Roberts" <timr@probo.com> wrote in message
news:brabj2htu25o87nkhb5dnsv7bdmv37q9k3@4ax.com...
>
> You NEVER "miss" data on a bulk pipe. If a packet is lost, the sender
> retransmits until it is acknowleged.
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.



Re: MaximumTransferSize limit for bulk on EHCI in Vista RC2 (5744) by Maxim

Maxim
Wed Oct 18 14:52:31 CDT 2006

The good idea is for the app/upper driver to remember the submit order of
the IRPs. The app can do this by wrapping OVERLAPPED with a larger structure
(with submit order fields - counter or offset - just below OVERLAPPED), and the
driver - via completion context.

The order of data chunks will match the submit order of the IRPs. The
_completion_ order of IRPs is arbitrary and relying on it is a very bad idea.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:%23QOcc1m8GHA.2268@TK2MSFTNGP05.phx.gbl...
> You don't even need to split input IRPs to several URBs.
>
> Have your application send several overlapped IOCTL requests each suitable
> for a single URB. Build an URB and send it down with the current IRP as an
> IOCTL_INTERNAL_SUBMIT_URB. A completion routine should free the URB. The
> driver becomes even simple, thus more stable.
>
>
> "fredsky" <hardware.evs@gmail.com> wrote in message
> news:1161073738.964751.221010@m7g2000cwm.googlegroups.com...
> For our design we use 512 KB URB block and we use Overlapped IO to have
> always 3 pending IRP. However we have found that splicing one IRP into
> multiples concurrent URBS become incredibly difficult to manage if the
> hardware sends 0 length buffers because as this is a completion case we
> must complete the main IRP. The question is what are we supposed to do
> with remaining URBS sent down to USB Host Driver ?? Because these URBs
> are associated with main IRP buffer I believe I must complete them all,
> but it's not so easy. Add the fact that next URB may have already
> received some new data, we end with an IRP that is filled with two
> different block of data.
>
> So by reading (or writing) large block of data but always on at the
> time we still have good performance (we only need to submit one URB to
> USB Host Driver after it has transferred 512 KB, so the penalty is
> negligible) ans our driver stay simple (and stable by definition).
>
>
> So if you need to transfer say 2 MB by IRP the whole schema would be :
>
> - Send IRP to your driver
> - Send 1 URB with 512 KB transfer size
> -> In Completion routine, test that you have transferred 512KB data
> (otherwise it's a completion condition , ie short packet). If so, then
> launch another URB, and so on until either you have transfered your
> whole buffer or you have received a short packet condition.
> - Then complete main IRP and dequeue another IRP (if any)
>
> Hope this helps,
> Fred.
>
>
>
> Thomas Schimming a écrit :
>
> > "Tim Roberts" wrote:
> >
> > > "fat_boy" <zzebowa@hotmail.com> wrote:
> > > >
> > > >Thomas Schimming wrote:
> > > >> Sorry to be a bit ignorant here. Do you mean that I can just send
> > > >> down two
> > > >> URBs for half the size and the second one catches the second half of
> > > >> my data
> > > >> block?
> > > >
> > > >Yes. You can break the data down into what ever size you like. We
> > > >found 1k to be optimal on XP. Any larger write and the USB system
> > > >would eventually stall. At 64 bytes, throughput was abysmal.
> > >
> > > This also depends on your hardware. If your hardware is able send data
> > > in
> > > a stream, and transfer as much as is available, then you do have this
> > > flexibility. Some hardware is pickier, and requires buffers of a
> > > certain
> > > size for correct operation.
> > > --
> > > - Tim Roberts, timr@probo.com
> > > Providenza & Boekelheide, Inc.
> > >
> >
> > In my case I have "separate" bulk transfers of a certain size (>1MB). As
> > far
> > as I understand the docs, there is no notion in the protocol to delimit
> > such
> > transfers other than the fact that at the end of such a transfer there is
> > a
> > NAK instead of more data?!
> >
> > Currently (on XP), by using a large bulk transfer with the "right"
> > blocklength, I am able to synchronize to the transfers of the device
> > (essentially I need to be able to catch the starts/ends right).
> >
> > So I'm still not clear about how I would detect these starts/ends with say
> > 1k blocked bulk transfers. I realize that this is probably all due to poor
> > design of the USB end of the device, but I don't have the option to work
> > on
> > that side of the fence.
> >
> > Also, how many 1k URBs would you recommend to have pending in order to
> > avoid
> > missing any data? What about thread priority of the "data loop"?
> >
> > Thanks for any thoughts.
>
>