Hello all,
I am reading windows 2000 DDK and I came across some sentences and I have
some doubts about the same.
why DpcForIsr calls IoStartNextPacket? IoStartNextPacket says that it
removes the next IRP from your queue and sends it to StartIo .Basically
why there is need to remove the next IRP?
Also the DpcForIsr calls IoCompleteRequest to complete the request of the
specified IRP.Also boosts it.Is it always necessary?If not then in which
conditions it is necessary?
Also,
What might be the possible control flow sequence in the following?
DpcForIsr.
StartIo
OnInterrupt
IoRequestDpc
Thanx.
Anand.
Lets say we have a driver for a BusMaster PCI device that uses system IRP
queuing and performs DMA transfers for Read requests. Now lets say that
this driver gets 10 read requests in quick succession. The driver will
queue those ten requests right? But, the first time it attempts to queue a
request the queue will be empty and not busy, so the Read IRP will be sent
on to the drivers StartIo routine. From here the driver will setup a DMA
request and start the DMA at some point after the DMA callback is called or
some such. Sometime later the PCI device will interrupt to signal that the
DMA is done. From here the driver’s ISR is called, in which the driver does
whatever is needed on the hardware to stop the PCI device from yanking on
the interrupt line. Then the driver requests a DpcForIsr to finish whatever
processing necessary after an interrupt and end of DMA. The DpcForIsr will
then finish processing and complete the Read IRP, thus sending whatever data
and/or information necessary back to user land. At this point, there is a
queue with 9 IRPs in it sitting idle. Thus the DpcForIsr will call
IoStartNextPacket to get the next IRP from the queue moving on to StartIo.
Often the DpcForIsr will call IoStartNextPacket before completing the
previous request, but that really isn’t that important to this discussion.
This is just an example of how a queue, an ISR, a DpcForIsr, and StartIo
might work together.
Priority boosting when completing an IRP is intended just to let the thread
that performed the request make up a little time that it lost waiting on the
I/O. So, in the example above the user thread making the Read request had
to wait on the DMA to complete, and thus a boost might help it make up that
time. Many drivers do not boost the priority, it depends on the application
and time criticalness and such.
–
Bill McKenzie
Windows DDK MVP
OSR - Windows System Software Development, Training, and Consulting
“Anand” wrote in message news:xxxxx@ntdev…
>
> Hello all,
> I am reading windows 2000 DDK and I came across some sentences and I have
> some doubts about the same.
>
> why DpcForIsr calls IoStartNextPacket? IoStartNextPacket says that it
> removes the next IRP from your queue and sends it to StartIo .Basically
> why there is need to remove the next IRP?
> Also the DpcForIsr calls IoCompleteRequest to complete the request of the
> specified IRP.Also boosts it.Is it always necessary?If not then in which
> conditions it is necessary?
> Also,
> What might be the possible control flow sequence in the following?
> DpcForIsr.
> StartIo
> OnInterrupt
> IoRequestDpc
> Thanx.
> Anand.
>
>
> why DpcForIsr calls IoStartNextPacket? IoStartNextPacket says that
it
removes the next IRP from your queue and sends it to StartIo
.Basically
why there is need to remove the next IRP?
To continue processing incoming packets.
Also the DpcForIsr calls IoCompleteRequest to complete the request
of the
specified IRP.Also boosts it.Is it always necessary?If not then in
which
conditions it is necessary?
DpcForIsr can be called for many reasons. Main of them is that the
hardware have completed the IO operation. Thus, the kernel must be
notified on it.
Max