- Queue a work item to do our work that was previously done in MiniportDpc so SendHa...
authorCameron Gutman <aicommander@gmail.com>
Sun, 14 Sep 2008 04:02:04 +0000 (04:02 +0000)
committerCameron Gutman <aicommander@gmail.com>
Sun, 14 Sep 2008 04:02:04 +0000 (04:02 +0000)
svn path=/branches/aicom-network-fixes/; revision=36206

drivers/network/ndis/ndis/miniport.c

index f6449ae..e854bd4 100644 (file)
@@ -748,35 +748,23 @@ NdisMQueryInformationComplete(
     KeLowerIrql(OldIrql);
 }
 
-\f
-VOID NTAPI MiniportDpc(
-    IN PKDPC Dpc,
-    IN PVOID DeferredContext,
-    IN PVOID SystemArgument1,
-    IN PVOID SystemArgument2)
-/*
- * FUNCTION: Deferred routine to handle serialization
- * ARGUMENTS:
- *     Dpc             = Pointer to DPC object
- *     DeferredContext = Pointer to context information (LOGICAL_ADAPTER)
- *     SystemArgument1 = Unused
- *     SystemArgument2 = Unused
- */
+VOID NTAPI MiniportWorker(
+    IN PDEVICE_OBJECT DeviceObject,
+    IN PVOID Context)
 {
+  PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(Context);
+  KIRQL OldIrql;
   NDIS_STATUS NdisStatus;
   PVOID WorkItemContext;
   NDIS_WORK_ITEM_TYPE WorkItemType;
-  PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(DeferredContext);
 
-  NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
-
-  KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
+  KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
 
   NdisStatus =
       MiniDequeueWorkItem
       (Adapter, &WorkItemType, &WorkItemContext);
 
-  KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
+  KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
 
   if (NdisStatus == NDIS_STATUS_SUCCESS)
     {
@@ -872,6 +860,33 @@ VOID NTAPI MiniportDpc(
     }
 }
 
+
+\f
+VOID NTAPI MiniportDpc(
+    IN PKDPC Dpc,
+    IN PVOID DeferredContext,
+    IN PVOID SystemArgument1,
+    IN PVOID SystemArgument2)
+/*
+ * FUNCTION: Deferred routine to handle serialization
+ * ARGUMENTS:
+ *     Dpc             = Pointer to DPC object
+ *     DeferredContext = Pointer to context information (LOGICAL_ADAPTER)
+ *     SystemArgument1 = Unused
+ *     SystemArgument2 = Unused
+ */
+{
+  PIO_WORKITEM WorkItem;
+  PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(DeferredContext);
+
+  NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
+
+  WorkItem = IoAllocateWorkItem(Adapter->NdisMiniportBlock.DeviceObject);
+  if( !WorkItem ) return;
+
+  IoQueueWorkItem(WorkItem, MiniportWorker, CriticalWorkQueue, DeferredContext);
+}
+
 \f
 VOID
 NTAPI