question for NDIS

Hi,
I am new to NDIS. I have some basic doubts.

  1. In what circumstances the MiniportISR and MiniportHandleInterrupt
    ms-help:bea-4189-aafa-260bcf819eda.xml.htm> can run concurrently in SMP
    machine?
    2) If these functions will not run parallel then is there a one-to-one
    correspondence between the execution of MiniportISR and
    MiniportHandleInterrupt?

    Thanks,
    Raja</ms-help:>

They may run concurrently on an SMP system. Even an UP system your
MiniportIsr can interrupt your MiniportHandleInterrupt. And no, there need
not be a 1-1 correspondence between MiniportIsr and MiniportHandleInterrupt
invocations. There relationship is best expressed as N-1 where N is one or
more invocations of MiniportIsr resulting in one invocation of
MiniportHandleInterrupt.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Kannan, Raja
Sent: Thursday, November 17, 2005 12:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] question for NDIS

Hi,
I am new to NDIS. I have some basic doubts.

  1. In what circumstances the MiniportISR and
    ms-help:4189-aafa-260bcf819eda.xml.htm> MiniportHandleInterrupt can run
    concurrently in SMP machine?
    2) If these functions will not run parallel then is there a one-to-one
    correspondence between the execution of MiniportISR and
    MiniportHandleInterrupt?

    Thanks,
    Raja


    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</ms-help:>

Thanks Mark.

the following is from MSDN.

Network Devices and Protocols: Windows DDK

DPC Handler

Every miniport driver that manages a network interface card (NIC) that
interrupts must have a MiniportHandleInterrupt
http:5f0a418c-0bea-4189-aafa-260bcf819eda.xml.asp> function. Even if NDIS
completely handles the interrupt, it always queues a deferred procedure
call (DPC) for the miniport driver, causing the miniport driver’s
MiniportHandleInterrupt handler to run. If MiniportISR
http:60c9ed82-b8c6-418a-85b3-8dcd5b7c0d97.xml.asp> processes an interrupt,
it controls whether MiniportHandleInterrupt is queued by the value
MiniportISR returns in the InterruptRecognized and
QueueMiniportHandleInterrupt arguments. If MiniportISR sets
QueueMiniportHandleInterrupt to TRUE, MiniportHandleInterrupt is queued
for execution at IRQL = DISPATCH_LEVEL.

MiniportHandleInterrupt is called after interrupts have been disabled on
the NIC by the MiniportISR or MiniportDisableInterrupt
http:4468b5ad-a284-439f-82c1-1f0fb1cd036d.xml.asp> function.
MiniportHandleInterrupt should read whatever data it needs to finish
processing the interrupt-driven I/O operation. MiniportHandleInterrupt
then reenables interrupts on the NIC, either by letting NDIS call the
miniport driver’s MiniportEnableInterrupt
http:7c385688-a565-47fc-be43-8adae15d6011.xml.asp> function after
MiniportHandleInterrupt returns control or by enabling the interrupt
from within MiniportHandleInterrupt, which is faster. Until interrupts
are reenabled, no further interrupts can occur on the NIC. To ensure
that no receive data is missed, MiniportHandleInterrupt should reenable
interrupts as quickly as possible.

My understanding is:

MiniportISR disables interrupt before it returns control and
MiniportHandleInterrupt
ms-help:bea-4189-aafa-260bcf819eda.xml.htm> reenables the interrupt that was
disabled by ISR, before it returns control.

A NIC driver’s ISR is not reentrant, although two instantiations of a
MiniportISR function can execute concurrently in SMP machines.

If it is true, for every recognized MiniportISR only one
MiniportHandleInterrupt
ms-help:bea-4189-aafa-260bcf819eda.xml.htm> will be queued. Am I right?



From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Thursday, November 17, 2005 5:47 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] question for NDIS

They may run concurrently on an SMP system. Even an UP system your
MiniportIsr can interrupt your MiniportHandleInterrupt. And no, there
need not be a 1-1 correspondence between MiniportIsr and
MiniportHandleInterrupt invocations. There relationship is best
expressed as N-1 where N is one or more invocations of MiniportIsr
resulting in one invocation of MiniportHandleInterrupt.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com



From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Kannan, Raja
Sent: Thursday, November 17, 2005 12:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] question for NDIS

Hi,
I am new to NDIS. I have some basic doubts.

1) In what circumstances the MiniportISR and
MiniportHandleInterrupt
ms-help:bea-4189-aafa-260bcf819eda.xml.htm> can run concurrently in SMP
machine?
2) If these functions will not run parallel then is there a
one-to-one correspondence between the execution of MiniportISR and
MiniportHandleInterrupt?

Thanks,
Raja


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


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</ms-help:></ms-help:></ms-help:></http:></http:></http:></http:>

So if on a MP system with N processors and N NICS N invocations of your
MiniportIsr can execute concurrently, each requesting a separate invocation
of your MiniportHandleInterrupt routine, then the concurrency of your
MiniportHandleInterrupt routine is also N. Also note that how you handle
interrupt enable disable for your NICs is part of your driver design. While
the docs are confusing, for most nics you will not implement enable/disable
interrupt routines but will instead directly disable interrupts from the NIC
in your isr and then re-enable interrupts from the nic in your dpc
(MiniportHandleInterrupt) routine. Finally, even though you have disabled
interrupts from your NIC, presumably your NIC is still trying to do work
even though its ability to interrupt the system has been disabled,
consequently your dpc routine should not assume that one invocation means
‘I’ve got one item of work to consume’, but instead should be operating in a
loop polling its NIC and performing all available work items - with the
consequence that your dpc routine may also get invoked with nothing to do
because the previous invocation did it.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Kannan, Raja
Sent: Friday, November 18, 2005 12:23 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] question for NDIS

Thanks Mark.

the following is from MSDN.

Network Devices and Protocols: Windows DDK

DPC Handler

Every miniport driver that manages a network interface card (NIC) that
interrupts must have a
http:418c-0bea-4189-aafa-260bcf819eda.xml.asp> MiniportHandleInterrupt function.
Even if NDIS completely handles the interrupt, it always queues a deferred
procedure call (DPC) for the miniport driver, causing the miniport driver’s
MiniportHandleInterrupt handler to run. If
http:ed82-b8c6-418a-85b3-8dcd5b7c0d97.xml.asp> MiniportISR processes an
interrupt, it controls whether MiniportHandleInterrupt is queued by the
value MiniportISR returns in the InterruptRecognized and
QueueMiniportHandleInterrupt arguments. If MiniportISR sets
QueueMiniportHandleInterrupt to TRUE, MiniportHandleInterrupt is queued for
execution at IRQL = DISPATCH_LEVEL.

MiniportHandleInterrupt is called after interrupts have been disabled on the
NIC by the MiniportISR or
http:b5ad-a284-439f-82c1-1f0fb1cd036d.xml.asp> MiniportDisableInterrupt function.
MiniportHandleInterrupt should read whatever data it needs to finish
processing the interrupt-driven I/O operation. MiniportHandleInterrupt then
reenables interrupts on the NIC, either by letting NDIS call the miniport
driver’s
http:5688-a565-47fc-be43-8adae15d6011.xml.asp> MiniportEnableInterrupt function
after MiniportHandleInterrupt returns control or by enabling the interrupt
from within MiniportHandleInterrupt, which is faster. Until interrupts are
reenabled, no further interrupts can occur on the NIC. To ensure that no
receive data is missed, MiniportHandleInterrupt should reenable interrupts
as quickly as possible.

My understanding is:

MiniportISR disables interrupt before it returns control and
ms-help:4189-aafa-260bcf819eda.xml.htm> MiniportHandleInterrupt reenables the
interrupt that was disabled by ISR, before it returns control.

A NIC driver’s ISR is not reentrant, although two instantiations of a
MiniportISR function can execute concurrently in SMP machines.

If it is true, for every recognized MiniportISR only one
ms-help:4189-aafa-260bcf819eda.xml.htm> MiniportHandleInterrupt will be queued. Am
I right?



From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Thursday, November 17, 2005 5:47 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] question for NDIS

They may run concurrently on an SMP system. Even an UP system your
MiniportIsr can interrupt your MiniportHandleInterrupt. And no, there need
not be a 1-1 correspondence between MiniportIsr and MiniportHandleInterrupt
invocations. There relationship is best expressed as N-1 where N is one or
more invocations of MiniportIsr resulting in one invocation of
MiniportHandleInterrupt.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com



From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Kannan, Raja
Sent: Thursday, November 17, 2005 12:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] question for NDIS

Hi,
I am new to NDIS. I have some basic doubts.

1) In what circumstances the MiniportISR and
ms-help:4189-aafa-260bcf819eda.xml.htm> MiniportHandleInterrupt can run
concurrently in SMP machine?
2) If these functions will not run parallel then is there a one-to-one
correspondence between the execution of MiniportISR and
MiniportHandleInterrupt?

Thanks,
Raja


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


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

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</ms-help:></ms-help:></ms-help:></http:></http:></http:></http:>