Author: cgutman
Date: Wed Nov 19 15:49:29 2008
New Revision: 37471
URL:
http://svn.reactos.org/svn/reactos?rev=37471&view=rev
Log:
- Use ExInterlocked* routines for list manipulation
- Store the NdisMiniportBlock in the interrupt and use it in the ISR
Modified:
branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c
branches/aicom-network-fixes/drivers/network/ndis/ndis/io.c
branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c
branches/aicom-network-fixes/drivers/network/ndis/ndis/protocol.c
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c [iso-8859-1] Wed Nov
19 15:49:29 2008
@@ -139,7 +139,7 @@
while(!IsListEmpty(&ConfigurationContext->ResourceListHead))
{
- Resource =
(PMINIPORT_RESOURCE)RemoveTailList(&ConfigurationContext->ResourceListHead);
+ Resource =
(PMINIPORT_RESOURCE)ExInterlockedRemoveHeadList(&ConfigurationContext->ResourceListHead,
&ConfigurationContext->ResourceLock);
if(Resource->ResourceType == MINIPORT_RESOURCE_TYPE_MEMORY)
{
NDIS_DbgPrint(MAX_TRACE,("freeing 0x%x\n",
Resource->Resource));
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/io.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/io.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/io.c [iso-8859-1] Wed Nov 19
15:49:29 2008
@@ -55,26 +55,27 @@
* FUNCTION: Interrupt service routine
* ARGUMENTS:
* Interrupt = Pointer to interrupt object
- * ServiceContext = Pointer to context information (LOGICAL_ADAPTER)
+ * ServiceContext = Pointer to context information (PNDIS_MINIPORT_INTERRUPT)
* RETURNS
* TRUE if a miniport controlled device generated the interrupt
*/
{
BOOLEAN InterruptRecognized = FALSE;
BOOLEAN QueueMiniportHandleInterrupt = FALSE;
- PLOGICAL_ADAPTER Adapter = ServiceContext;
-
- NDIS_DbgPrint(MAX_TRACE, ("Called. Adapter (0x%X)\n", Adapter));
-
- if (Adapter->NdisMiniportBlock.Interrupt->IsrRequested) {
-
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.ISRHandler)(
+ PNDIS_MINIPORT_INTERRUPT NdisInterrupt = ServiceContext;
+ PNDIS_MINIPORT_BLOCK NdisMiniportBlock = NdisInterrupt->Miniport;
+
+ NDIS_DbgPrint(MAX_TRACE, ("Called. Interrupt (0x%X)\n", NdisInterrupt));
+
+ if (NdisInterrupt->IsrRequested) {
+ (*NdisMiniportBlock->DriverHandle->MiniportCharacteristics.ISRHandler)(
&InterruptRecognized,
&QueueMiniportHandleInterrupt,
- Adapter->NdisMiniportBlock.MiniportAdapterContext);
-
- } else if
(Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.DisableInterruptHandler)
{
-
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.DisableInterruptHandler)(
- Adapter->NdisMiniportBlock.MiniportAdapterContext);
+ NdisMiniportBlock->MiniportAdapterContext);
+
+ } else if
(NdisMiniportBlock->DriverHandle->MiniportCharacteristics.DisableInterruptHandler)
{
+
(*NdisMiniportBlock->DriverHandle->MiniportCharacteristics.DisableInterruptHandler)(
+ NdisMiniportBlock->MiniportAdapterContext);
QueueMiniportHandleInterrupt = TRUE;
InterruptRecognized = TRUE;
}
@@ -83,7 +84,7 @@
if (QueueMiniportHandleInterrupt)
{
NDIS_DbgPrint(MAX_TRACE, ("Queuing DPC.\n"));
- KeInsertQueueDpc(&Adapter->NdisMiniportBlock.Interrupt->InterruptDpc,
NULL, NULL);
+ KeInsertQueueDpc(&NdisInterrupt->InterruptDpc, NULL, NULL);
}
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
@@ -777,6 +778,7 @@
Interrupt->SharedInterrupt = SharedInterrupt;
Interrupt->IsrRequested = RequestIsr;
+ Interrupt->Miniport = &Adapter->NdisMiniportBlock;
Adapter->NdisMiniportBlock.Interrupt = Interrupt;
@@ -786,7 +788,7 @@
NDIS_DbgPrint(MAX_TRACE, ("Connecting to interrupt vector (0x%X) Affinity
(0x%X).\n", MappedIRQ, Affinity));
- Status = IoConnectInterrupt(&Interrupt->InterruptObject, ServiceRoutine,
Adapter, &Interrupt->DpcCountLock, MappedIRQ,
+ Status = IoConnectInterrupt(&Interrupt->InterruptObject, ServiceRoutine,
Interrupt, &Interrupt->DpcCountLock, MappedIRQ,
DIrql, DIrql, InterruptMode, SharedInterrupt, Affinity, FALSE);
NDIS_DbgPrint(MAX_TRACE, ("Leaving. Status (0x%X).\n", Status));
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- 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] Wed Nov
19 15:49:29 2008
@@ -1764,17 +1764,12 @@
*/
{
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)DeviceObject->DeviceExtension;
- KIRQL OldIrql;
/* Remove adapter from adapter list for this miniport */
- KeAcquireSpinLock(&Adapter->NdisMiniportBlock.DriverHandle->Lock,
&OldIrql);
- RemoveEntryList(&Adapter->MiniportListEntry);
- KeReleaseSpinLock(&Adapter->NdisMiniportBlock.DriverHandle->Lock, OldIrql);
+ ExInterlockedRemoveEntryList(&Adapter->MiniportListEntry,
&Adapter->NdisMiniportBlock.DriverHandle->Lock);
/* Remove adapter from global adapter list */
- KeAcquireSpinLock(&AdapterListLock, &OldIrql);
- RemoveEntryList(&Adapter->ListEntry);
- KeReleaseSpinLock(&AdapterListLock, OldIrql);
+ ExInterlockedRemoveEntryList(&Adapter->ListEntry, &AdapterListLock);
KeCancelTimer(&Adapter->NdisMiniportBlock.WakeUpDpcTimer.Timer);
@@ -2385,6 +2380,7 @@
ExFreePool(Miniport->RegistryPath->Buffer);
ExFreePool(Miniport->RegistryPath);
+ ExInterlockedRemoveEntryList(&Miniport->ListEntry, &MiniportListLock);
ExFreePool(Miniport);
}
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/protocol.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/protocol.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/protocol.c [iso-8859-1] Wed Nov
19 15:49:29 2008
@@ -432,21 +432,15 @@
* NdisBindingHandle = Handle returned by NdisOpenAdapter
*/
{
- KIRQL OldIrql;
PADAPTER_BINDING AdapterBinding = GET_ADAPTER_BINDING(NdisBindingHandle);
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
/* Remove from protocol's bound adapters list */
- KeAcquireSpinLock(&AdapterBinding->ProtocolBinding->Lock, &OldIrql);
- RemoveEntryList(&AdapterBinding->ProtocolListEntry);
- KeReleaseSpinLock(&AdapterBinding->ProtocolBinding->Lock, OldIrql);
+ ExInterlockedRemoveEntryList(&AdapterBinding->ProtocolListEntry,
&AdapterBinding->ProtocolBinding->Lock);
/* Remove protocol from adapter's bound protocols list */
- NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
- KeAcquireSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock,
&OldIrql);
- RemoveEntryList(&AdapterBinding->AdapterListEntry);
- KeReleaseSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock,
OldIrql);
+ ExInterlockedRemoveEntryList(&AdapterBinding->AdapterListEntry,
&AdapterBinding->Adapter->NdisMiniportBlock.Lock);
ExFreePool(AdapterBinding);
@@ -469,7 +463,6 @@
* NdisProtocolHandle = Handle returned by NdisRegisterProtocol
*/
{
- KIRQL OldIrql;
PPROTOCOL_BINDING Protocol = GET_PROTOCOL_BINDING(NdisProtocolHandle);
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
@@ -477,9 +470,7 @@
/* FIXME: Make sure no adapter bindings exist */
/* Remove protocol from global list */
- KeAcquireSpinLock(&ProtocolListLock, &OldIrql);
- RemoveEntryList(&Protocol->ListEntry);
- KeReleaseSpinLock(&ProtocolListLock, OldIrql);
+ ExInterlockedRemoveEntryList(&Protocol->ListEntry, &ProtocolListLock);
ExFreePool(Protocol);