Commit in reactos/drivers/net/ndis/ndis on MAIN
miniport.c+20-171.44 -> 1.45
protocol.c+3-11.22 -> 1.23
+23-18
2 modified files
miniport:
Make sure MiniQueueDpc is not called from PASSIVE_LEVEL.
Moved NdisMQueryInformationComplete so that the function and not the macro
is called from the DPC.  This was breaking stuff severely.
The adapter lock needn't be held when doing MiniDequeueWorkItem because we're
at DISPATCH_LEVEL already by virtue of being in a DPC target.
protocol:
Make sure MiniQueueWorkItem is called at DISPATCH_LEVEL.

reactos/drivers/net/ndis/ndis
miniport.c 1.44 -> 1.45
diff -u -r1.44 -r1.45
--- miniport.c	30 Nov 2004 04:23:42 -0000	1.44
+++ miniport.c	1 Dec 2004 08:02:28 -0000	1.45
@@ -627,6 +627,7 @@
   NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
 
   ASSERT(Adapter);
+  ASSERT(KeGetCurrentIrql() >= DISPATCH_LEVEL);
 
 #if 0
   if (Adapter->WorkQueueLevel < NDIS_MINIPORT_WORK_QUEUE_SIZE - 1) 
@@ -756,6 +757,24 @@
 }
 
 
+#undef NdisMQueryInformationComplete
+/*
+ * @implemented
+ */
+VOID
+EXPORT
+NdisMQueryInformationComplete(
+    IN  NDIS_HANDLE MiniportAdapterHandle,
+    IN  NDIS_STATUS Status)
+{
+    PNDIS_MINIPORT_BLOCK MiniportBlock = 
+	(PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
+    ASSERT(MiniportBlock);
+    if( MiniportBlock->QueryCompleteHandler )
+	(MiniportBlock->QueryCompleteHandler)(MiniportAdapterHandle, Status);
+}
+
+
 VOID STDCALL MiniportDpc(
     IN PKDPC Dpc,
     IN PVOID DeferredContext,
@@ -777,7 +796,6 @@
 
   NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
 
-  /* XXX is adapter lock held here?  should be... */
   NdisStatus = MiniDequeueWorkItem(Adapter, &WorkItemType, &WorkItemContext);
 
   if (NdisStatus == NDIS_STATUS_SUCCESS) 
@@ -853,7 +871,7 @@
             switch (((PNDIS_REQUEST)WorkItemContext)->RequestType) 
               {
                 case NdisRequestQueryInformation:
-                  NdisMQueryInformationComplete((NDIS_HANDLE)Adapter, NdisStatus);
+		  NdisMQueryInformationComplete((NDIS_HANDLE)Adapter, NdisStatus);
                   break;
 
                 case NdisRequestSetInformation:
@@ -1046,21 +1064,6 @@
   *NdisWrapperHandle = Miniport;
 }
 
-#undef NdisMQueryInformationComplete
-
-
-/*
- * @implemented
- */
-VOID
-EXPORT
-NdisMQueryInformationComplete(
-    IN  NDIS_HANDLE MiniportAdapterHandle,
-    IN  NDIS_STATUS Status)
-{
-  (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->QueryCompleteHandler)(MiniportAdapterHandle, Status);
-}
-
 
 VOID STDCALL NdisIBugcheckCallback(
     IN PVOID   Buffer,

reactos/drivers/net/ndis/ndis
protocol.c 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- protocol.c	23 Nov 2004 18:58:47 -0000	1.22
+++ protocol.c	1 Dec 2004 08:02:28 -0000	1.23
@@ -147,14 +147,16 @@
           Adapter->MiniportBusy = TRUE;
         }
     }
-  KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
 
+  /* MiniQueueWorkItem must be called at IRQL >= DISPATCH_LEVEL */
   if (QueueWorkItem) 
     {
       MiniQueueWorkItem(Adapter, NdisWorkItemRequest, (PVOID)NdisRequest);
       return NDIS_STATUS_PENDING;
     } 
 
+  KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
+
   /* MiniportQueryInformation (called by MiniDoRequest) runs at DISPATCH_LEVEL */
   /* TODO (?): move the irql raise into MiniDoRequest */
   KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
CVSspam 0.2.8