Author: arty
Date: Fri Jul 18 06:19:29 2008
New Revision: 34574
URL:
http://svn.reactos.org/svn/reactos?rev=34574&view=rev
Log:
Patch by Cameron Gutman (aicommander <at> gmail <dot> com)
- Reenable spinlocks in MiniIndicateData
- Don't raise IRQL when calling MiniDoRequest
Modified:
trunk/reactos/drivers/network/ndis/ndis/miniport.c
trunk/reactos/drivers/network/ndis/ndis/protocol.c
Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Fri Jul 18 06:19:29
2008
@@ -156,7 +156,7 @@
* PacketSize = Total size of received packet
*/
{
- /* KIRQL OldIrql; */
+ KIRQL OldIrql;
PLIST_ENTRY CurrentEntry;
PADAPTER_BINDING AdapterBinding;
@@ -166,27 +166,8 @@
MiniDisplayPacket2(HeaderBuffer, HeaderBufferSize, LookaheadBuffer,
LookaheadBufferSize);
- /*
- * XXX Think about this. This is probably broken. Spinlocks are
- * taken out for now until i comprehend the Right Way to do this.
- *
- * This used to acquire the MiniportBlock spinlock and hold it until
- * just before the call to ReceiveHandler. It would then release and
- * subsequently re-acquire the lock.
- *
- * I don't see how this does any good, as it would seem he's just
- * trying to protect the packet list. If somebody else dequeues
- * a packet, we are in fact in bad shape, but we don't want to
- * necessarily call the receive handler at elevated irql either.
- *
- * therefore: We *are* going to call the receive handler at high irql
- * (due to holding the lock) for now, and eventually we have to
- * figure out another way to protect this packet list.
- *
- * UPDATE: this is busted; this results in a recursive lock acquisition.
- */
- //NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
- //KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
+ NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
+ KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
{
CurrentEntry = Adapter->ProtocolListHead.Flink;
NDIS_DbgPrint(DEBUG_MINIPORT, ("CurrentEntry = %x\n", CurrentEntry));
@@ -201,8 +182,7 @@
AdapterBinding = CONTAINING_RECORD(CurrentEntry, ADAPTER_BINDING,
AdapterListEntry);
NDIS_DbgPrint(DEBUG_MINIPORT, ("AdapterBinding = %x\n", AdapterBinding));
- /* see above */
- /* KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql); */
+ KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
#ifdef DBG
if(!AdapterBinding)
@@ -246,13 +226,12 @@
LookaheadBufferSize,
PacketSize);
- /* see above */
- /* KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
*/
+ KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
CurrentEntry = CurrentEntry->Flink;
}
}
- //KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
+ KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
}
Modified: trunk/reactos/drivers/network/ndis/ndis/protocol.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] Fri Jul 18 06:19:29
2008
@@ -161,14 +161,10 @@
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
- /* MiniportQueryInformation (called by MiniDoRequest) runs at DISPATCH_LEVEL */
- /* TODO (?): move the irql raise into MiniDoRequest */
- KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
- {
NdisStatus = MiniDoRequest(&Adapter->NdisMiniportBlock, NdisRequest);
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
- KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
+ KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
{
NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to free\n"));
Adapter->MiniportBusy = FALSE;
@@ -176,9 +172,7 @@
if (Adapter->WorkQueueHead)
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.DeferredDpc, NULL,
NULL);
}
- KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
- }
- KeLowerIrql(OldIrql);
+ KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
return NdisStatus;
}