[ros-diffs] [cgutman] 36441: - Check for miniport hangs at the appropriate time - Call MiniReset if required

cgutman at svn.reactos.org cgutman at svn.reactos.org
Tue Sep 23 22:54:02 CEST 2008


Author: cgutman
Date: Tue Sep 23 15:54:02 2008
New Revision: 36441

URL: http://svn.reactos.org/svn/reactos?rev=36441&view=rev
Log:
 - Check for miniport hangs at the appropriate time
 - Call MiniReset if required

Modified:
    branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c

Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c
URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c?rev=36441&r1=36440&r2=36441&view=diff
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Tue Sep 23 15:54:02 2008
@@ -632,6 +632,27 @@
    KeLowerIrql(OldIrql);
 
    return Status;
+}
+
+VOID STDCALL
+HangTimer( PVOID Context )
+{
+  PLOGICAL_ADAPTER Adapter = Context;
+  BOOLEAN AddressingReset;
+
+  while (Adapter->NdisMiniportBlock.PnPDeviceState == NdisPnPDeviceStarted)
+  {
+    AddressingReset = FALSE;
+
+    NdisMSleep(Adapter->NdisMiniportBlock.CheckForHangSeconds * 1000000);
+
+    if (MiniCheckForHang(Adapter))
+        MiniReset(Adapter, &AddressingReset);
+
+    /* FIXME: We should call MiniportSetInformation if AddressingReset is TRUE */
+  }
+
+  PsTerminateSystemThread(STATUS_SUCCESS);
 }
 
 
@@ -1421,6 +1442,8 @@
   PNDIS_CONFIGURATION_PARAMETER ConfigParam;
   NDIS_HANDLE ConfigHandle;
   ULONG Size;
+  HANDLE HangTimerHandle;
+  
 /* FIXME - KIRQL OldIrql; */
 
   /*
@@ -1639,6 +1662,10 @@
 
   Adapter->NdisMiniportBlock.OldPnPDeviceState = Adapter->NdisMiniportBlock.PnPDeviceState;
   Adapter->NdisMiniportBlock.PnPDeviceState = NdisPnPDeviceStarted;
+
+  PsCreateSystemThread(&HangTimerHandle, THREAD_ALL_ACCESS, 0, 0, 0,
+                       HangTimer, Adapter);
+  ZwClose(HangTimerHandle);
 
   /* Put adapter in adapter list for this miniport */
   ExInterlockedInsertTailList(&Adapter->NdisMiniportBlock.DriverHandle->DeviceList, &Adapter->MiniportListEntry, &Adapter->NdisMiniportBlock.DriverHandle->Lock);



More information about the Ros-diffs mailing list