Re: Interrupts are not coming sometime in NIC miniport



An ISR should do only what is absolutely necessary, nothing more. That
is, usually, you need to check whether the IRQ was actually from your
device. This is usually done by reading some interrupt register on the
device. Then, if your device has actually requested an interrupt, you
usually disable further interrupts from this device in the ISR. Some
devices even combine these two steps into one, i.e. reading the IRQ
source register automatically clears the interrupt enable bit (only) if
an interrupt is pending.

The DPC then does all the real work. So the ISR is mainly used as a
trigger only to initiate the DPC.

Note also, that a DPC usually runs until "no more work" is to be done.
This way, interrupts can be reduced to a minimum. However, in order to
allow other DPCs to run (such that the system can "breathe"), it is
still a good idea to leave the DPC after "some time" has elapsed even
if more work is left. In this case, another DPC needs to be scheduled
of course (to handle all the left work). Since there is unfortunately
no way to directly schedule a DPC using NDIS functions, all you can do
is actually have the NIC fire another interrupt.

Stephan
---
Uv wrote:
Hello Rahul

Is this HandleInterrupt routine your ISR or your DPC?
If it is your DPC then you are going about it the wrong way : When your
device interrupts, your interrupt handler should run long enough to
pick up (copy) all the relevant data from your device and store it in a
common buffer. It should then signal your DPC routine that some data is
ready to be processed further and re-enable the NIC interrupts.
After this the ISR should return because it has nothing else to do.
Therefore in the ISR:
1. Is this interrupt for me? If not return immediately.
2. This interrupt is for me... therefore acknowledge my device so that
it knows that I have seen the interrupt.
3. Allocate non-paged memory to store the data to be passed to the DPC.
This will usually not be "allocation". It will be "pick up a memory
block from a pre-allocated list".
4. Fill up blob with data from the NICs data buffers.
5. Add blob to a queue shared between DPC and ISR.
6. Request the OS to queue a DPC
7. Cleanup if any and return from ISR

Some "arbitrarily" long time later your DPC routine is invoked. It
wakes up, checks that queue shared between ISR and DPC and finds that
there is something to do. It must remove an item from the queue
(syncronised with the ISR) and start work on it.
It loops until the queue is empty and the returns.

This is the way you are supposed to do almost any device programming

Hope this helped.
Uv

rahuljain2462607@xxxxxxxxx wrote:
Hi,

We are making a NDIS miniport driver for NIC on Windows 2000. Sometimes
miniport driver seems to hang for some fraction of seconds and then it
starts again(Packets are countinously coming to NIC). When it again
starts running first time it shows all recieve buffers are full and
again it starts running normal. we found that for that interval for
which it seems hang interrupts are not coming.
Packets are coming on NIC on same speed so why interrupts stop coming
in between for sometime.We are disabling NIC interrupt as soon as it
calls our ISR and enable interrupt when we completly handle interrupt
in HandleInterrupt routine.

Thanks,
Rahul Jain

.



Relevant Pages

  • Re: Interrupts are not coming sometime in NIC miniport
    ... Is this HandleInterrupt routine your ISR or your DPC? ... After this the ISR should return because it has nothing else to do. ... Is this interrupt for me? ...
    (microsoft.public.development.device.drivers)
  • Re: Interrupts are not coming sometime in NIC miniport
    ... the interrupts on the NIC during ISR and re-enables them at the end of DPC. ... A typical NIC reads interrupt status register in its DPC handler to ... Is this HandleInterrupt routine your ISR or your DPC? ... Fill up blob with data from the NICs data buffers. ...
    (microsoft.public.development.device.drivers)
  • Re: DPC crashing in NT4 legacy driver
    ... I'm trying to get the simplest possible DPC to run from an ISR without ... I can handle interrupts OK and acknowledge them in the hardware in my ... However when I try to call a DPC the system reboots. ... BOOLEAN TcmInterruptServiceRoutine(IN PKINTERRUPT Interrupt, IN OUT ...
    (microsoft.public.development.device.drivers)
  • DPC crashing in NT4 legacy driver
    ... I'm trying to get the simplest possible DPC to run from an ISR without ... However when I try to call a DPC the system reboots. ... BOOLEAN TcmInterruptServiceRoutine(IN PKINTERRUPT Interrupt, IN OUT ... NTSTATUS TcmSetupISR(PDEVICE_OBJECT deviceObject, ...
    (microsoft.public.development.device.drivers)
  • RE: DPC/ISR synchronization (windows ce)
    ... > the device's interrupt should be disabled in the ISR and enabled in the DPC. ... threads with lesser priority. ...
    (microsoft.public.development.device.drivers)