Receiving IRPs out of sequence

Hi,
I have a USB driver which is showing different behaviour between Windows 2000 and Windows XP. It only occurs on some machines though.

The problem is with the read pipe. My driver expects to receive the read IRPs in the same order that it submits them. For some reason though, occasionally there is a stream of out-of-sequence frames/packets. For example,
1,2,3,5,4,7,6,9,8,10,11,12, etc.

I was wondering if there is any quick and easy way of swapping the order that the IRPs are received once I’m in my async read complete routine. Taking the above sequence for example, when I receive IRP 5 I detect that it is out of sequence, I need to somehow defer the processing until I receive the sequenced IRP (4) and then allow the 5 to go through.

We have only seen sequences like the above where there are only two IRPs out of sequence so it doesn’t need to be complicated.

I know I could probably come up with a rather labour intensive method but I reckon some of you IRP gurus might have a trick up your collective sleeve.

Cheers,
Lee

Maintain a reassembly queue in the completion routine and some “sequence number” value in the completion context.
If the current sequence number equals to the expected one, then expected one is incremented, and the IRP is really completed. After this, the reassembly queue is checked. If the first IRP there has sequence number == expected one, then it is taken off the queue and completed. And so on, till the sequence number condition is fine.
Otherwise, put the IRP to the reassembly queue, which must be sorted by the sequence number.

Max

----- Original Message -----
From: Lee Rhodes
To: NT Developers Interest List
Sent: Friday, June 14, 2002 12:43 PM
Subject: [ntdev] Receiving IRPs out of sequence

Hi,
I have a USB driver which is showing different behaviour between Windows 2000 and Windows XP. It only occurs on some machines though.

The problem is with the read pipe. My driver expects to receive the read IRPs in the same order that it submits them. For some reason though, occasionally there is a stream of out-of-sequence frames/packets. For example,
1,2,3,5,4,7,6,9,8,10,11,12, etc.

I was wondering if there is any quick and easy way of swapping the order that the IRPs are received once I’m in my async read complete routine. Taking the above sequence for example, when I receive IRP 5 I detect that it is out of sequence, I need to somehow defer the processing until I receive the sequenced IRP (4) and then allow the 5 to go through.

We have only seen sequences like the above where there are only two IRPs out of sequence so it doesn’t need to be complicated.

I know I could probably come up with a rather labour intensive method but I reckon some of you IRP gurus might have a trick up your collective sleeve.

Cheers,
Lee

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%