Cancel IO on system-supplied IRP queue

Dear all,

I am implementing an USB functional driver for WinXP.
I want to implement IRP queuing in my driver. My device can perform one IO
operation at any time.
I excluded ISR or DPC from my code (Actually I don’t need them).
In this scenario I planed to use System supplied IRP queue to queue my IRPs.

If I use system supplied queue can my driver implement the following
scenarios successfully?

  1. When a cancel request is sent to the driver, if the current request
    being processed by the device originated from the same thread as is sending
    the cancel, then when the driver waits until it receives the device
    response. That response is then discarded and will not be forwarded to the
    thread. The cancel must complete immediately, however.

  2. When a cancel request is sent to the driver, if the current
    request being processed by the device originated from a different thread,
    the pending request for the canceling application is removed from the queue,
    but the current request continues to be processed normally. A given thread
    should only have one request in the queue.

Regards,
Ramya

You say you want a serial queue, but you are describing threads here. I think what you are trying to say is that for a given file handle (or PFILE_OBJECT in your driver), you want only one outstanding request at a time. I would further guess that your device is exclusive access, so really there is only one outstanding request at a time for the entire device, not just per file handle.

I think when you are asking about originating thread or a different thread, that you are referring to the active request in the queue or a request that is pending in the queue. The thread itself has nothing to do with it. Rather, you just have an irp queue with one active irp in it and the rest are queued. You should use a CSQ (the library is provided for you in the DDK) and look at the src\general\startio DDK sample which implements a serialized CSQ already.

I would also recommend that you check out KMDF which has just been release, http://www.microsoft.com/whdc/default.mspx or http://www.microsoft.com/whdc/driver/wdf/KMDF_pkg.mspx. KMDF implements a serial queue, full pnp and power integration with the queue and USB specific functionality as well (including selective suspend).

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Ramya Desai
Sent: Monday, December 05, 2005 6:07 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Cancel IO on system-supplied IRP queue

Dear all,

I am implementing an USB functional driver for WinXP.
I want to implement IRP queuing in my driver. My device can perform one IO operation at any time.
I excluded ISR or DPC from my code (Actually I don’t need them).
In this scenario I planed to use System supplied IRP queue to queue my IRPs.

If I use system supplied queue can my driver implement the following scenarios successfully?
?
1)? When a cancel request is sent to the driver, if the current request being processed by the device originated from the same thread as is sending the cancel, then when the driver?waits until it?receives the device response. That response is?then discarded and will not be forwarded to the thread.??The cancel must complete?immediately,?however.
?
2)? When a cancel request is sent to the driver, if the current request?being processed by the device originated from a different thread, the pending request for the canceling application is removed from the queue, but the current request?continues to be processed normally.? A given thread should only have one request in the queue.?

Regards,
Ramya
— Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To unsubscribe send a blank email to xxxxx@lists.osr.com

Usually, the cancellation can only cancel the IRP which is not delivered to
the device yet, and is sitting in the queue. But, if you will write the
suitable cancel routine - then yes, you can even cancel the hardware operation
by it.

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

----- Original Message -----
From: “Ramya Desai”
To: “Windows System Software Devs Interest List”
Sent: Monday, December 05, 2005 5:07 PM
Subject: [ntdev] Cancel IO on system-supplied IRP queue

Dear all,

I am implementing an USB functional driver for WinXP.
I want to implement IRP queuing in my driver. My device can perform one IO
operation at any time.
I excluded ISR or DPC from my code (Actually I don’t need them).
In this scenario I planed to use System supplied IRP queue to queue my IRPs.

If I use system supplied queue can my driver implement the following
scenarios successfully?

1) When a cancel request is sent to the driver, if the current request
being processed by the device originated from the same thread as is sending
the cancel, then when the driver waits until it receives the device
response. That response is then discarded and will not be forwarded to the
thread. The cancel must complete immediately, however.

2) When a cancel request is sent to the driver, if the current
request being processed by the device originated from a different thread,
the pending request for the canceling application is removed from the queue,
but the current request continues to be processed normally. A given thread
should only have one request in the queue.

Regards,
Ramya


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com