- Limit the number of interrupts that are handled per call to MiniportHandleInterrupt to prevent us from staying at DISPATCH_LEVEL for too long

svn path=/trunk/; revision=43693
This commit is contained in:
Cameron Gutman 2009-10-23 00:27:00 +00:00
parent 0fba4d8f11
commit 612660aeee
4 changed files with 15 additions and 13 deletions

View file

@ -55,7 +55,8 @@
/* Interrupt Mask Register value */
#define DRIVER_INTERRUPT_MASK IMR_ALLE - IMR_RDCE
/* Maximum number of interrupts handled per call to MiniportHandleInterrupt */
#define INTERRUPT_LIMIT 10
/* Global structures */

View file

@ -1315,6 +1315,7 @@ VOID NTAPI MiniportHandleInterrupt(
UCHAR ISRMask;
UCHAR Mask;
PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
UINT i = 0;
ISRMask = Adapter->InterruptMask;
NdisRawReadPortUchar(Adapter->IOBase + PG0_ISR, &ISRValue);
@ -1323,12 +1324,14 @@ VOID NTAPI MiniportHandleInterrupt(
Adapter->InterruptStatus |= (ISRValue & ISRMask);
if (ISRValue != 0x00)
/* Acknowledge interrupts */
NdisRawWritePortUchar(Adapter->IOBase + PG0_ISR, ISRValue);
Mask = 0x01;
while (Adapter->InterruptStatus != 0x00) {
while (Adapter->InterruptStatus != 0x00 && i++ < INTERRUPT_LIMIT) {
if (ISRValue != 0x00) {
/* Acknowledge interrupts */
NdisRawWritePortUchar(Adapter->IOBase + PG0_ISR, ISRValue);
Mask = 0x01;
}
NDIS_DbgPrint(MID_TRACE, ("Adapter->InterruptStatus (0x%X) Mask (0x%X).\n",
Adapter->InterruptStatus, Mask));
@ -1409,12 +1412,6 @@ VOID NTAPI MiniportHandleInterrupt(
NDIS_DbgPrint(MID_TRACE, ("ISRValue (0x%X).\n", ISRValue));
Adapter->InterruptStatus |= (ISRValue & ISRMask);
if (ISRValue != 0x00) {
/* Acknowledge interrupts */
NdisRawWritePortUchar(Adapter->IOBase + PG0_ISR, ISRValue);
Mask = 0x01;
}
}
NICEnableInterrupts((PNIC_ADAPTER)MiniportAdapterContext);

View file

@ -66,6 +66,7 @@ MiniportHandleInterrupt(
{
PADAPTER Adapter = (PADAPTER)MiniportAdapterContext;
USHORT Data;
UINT i = 0;
DPRINT("Called\n");
@ -78,7 +79,7 @@ MiniportHandleInterrupt(
DPRINT("CSR0 is 0x%x\n", Data);
while(Data & CSR0_INTR)
while((Data & CSR0_INTR) && i++ < INTERRUPT_LIMIT)
{
/* Clear interrupt flags early to avoid race conditions. */
NdisRawWritePortUshort(Adapter->PortOffset + RDP, Data);

View file

@ -149,6 +149,9 @@ MiGetMediaDuplex(PADAPTER Adapter);
/* flags */
#define RESET_IN_PROGRESS 0x1
/* Maximum number of interrupts handled per call to MiniportHandleInterrupt */
#define INTERRUPT_LIMIT 10
#if DBG
#define BREAKPOINT DbgBreakPoint();
#else