mirror of
https://github.com/reactos/reactos.git
synced 2024-08-29 14:48:37 +00:00
- Acquire the adapter lock instead of just raising to DISPATCH_LEVEL (MSDN hints at this in various areas)
svn path=/trunk/; revision=40446
This commit is contained in:
parent
1e94c549a8
commit
ba9ee79954
|
@ -355,11 +355,9 @@ MiniRequestComplete(
|
|||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
Adapter->NdisMiniportBlock.PendingRequest = NULL;
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
|
||||
if( MacBlock->Binding->RequestCompleteHandler ) {
|
||||
(*MacBlock->Binding->RequestCompleteHandler)(
|
||||
|
@ -367,7 +365,7 @@ MiniRequestComplete(
|
|||
Request,
|
||||
Status);
|
||||
}
|
||||
KeLowerIrql(OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
}
|
||||
|
||||
VOID NTAPI
|
||||
|
@ -384,6 +382,7 @@ MiniSendComplete(
|
|||
* Status = Status of send operation
|
||||
*/
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = MiniportAdapterHandle;
|
||||
PADAPTER_BINDING AdapterBinding;
|
||||
KIRQL OldIrql;
|
||||
|
||||
|
@ -391,12 +390,12 @@ MiniSendComplete(
|
|||
|
||||
AdapterBinding = (PADAPTER_BINDING)Packet->Reserved[0];
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
(*AdapterBinding->ProtocolBinding->Chars.SendCompleteHandler)(
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
Packet,
|
||||
Status);
|
||||
KeLowerIrql(OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -417,6 +416,7 @@ MiniTransferDataComplete(
|
|||
IN NDIS_STATUS Status,
|
||||
IN UINT BytesTransferred)
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = MiniportAdapterHandle;
|
||||
PADAPTER_BINDING AdapterBinding;
|
||||
KIRQL OldIrql;
|
||||
|
||||
|
@ -424,13 +424,13 @@ MiniTransferDataComplete(
|
|||
|
||||
AdapterBinding = (PADAPTER_BINDING)Packet->Reserved[0];
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
(*AdapterBinding->ProtocolBinding->Chars.TransferDataCompleteHandler)(
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
Packet,
|
||||
Status,
|
||||
BytesTransferred);
|
||||
KeLowerIrql(OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -605,7 +605,7 @@ MiniQueryInformation(
|
|||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
/* call the miniport's queryinfo handler */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.QueryInformationHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
Oid,
|
||||
|
@ -613,7 +613,7 @@ MiniQueryInformation(
|
|||
Size,
|
||||
BytesWritten,
|
||||
&BytesNeeded);
|
||||
KeLowerIrql(OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
/* FIXME: Wait in pending case! */
|
||||
|
||||
|
@ -634,11 +634,11 @@ MiniCheckForHang( PLOGICAL_ADAPTER Adapter )
|
|||
BOOLEAN Ret = FALSE;
|
||||
KIRQL OldIrql;
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
if (Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.CheckForHangHandler)
|
||||
Ret = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.CheckForHangHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext);
|
||||
KeLowerIrql(OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
@ -667,16 +667,14 @@ MiniReset(
|
|||
NdisMIndicateStatus(Adapter, NDIS_STATUS_RESET_START, NULL, 0);
|
||||
NdisMIndicateStatusComplete(Adapter);
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
Status = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.ResetHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
AddressingReset);
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
Adapter->NdisMiniportBlock.ResetStatus = Status;
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
|
||||
KeLowerIrql(OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
if (Status != NDIS_STATUS_PENDING) {
|
||||
NdisMIndicateStatus(Adapter, NDIS_STATUS_RESET_END, NULL, 0);
|
||||
|
@ -854,11 +852,9 @@ MiniDoRequest(
|
|||
KIRQL OldIrql;
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
Adapter->NdisMiniportBlock.PendingRequest = NdisRequest;
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
|
||||
switch (NdisRequest->RequestType)
|
||||
{
|
||||
|
@ -887,12 +883,10 @@ MiniDoRequest(
|
|||
}
|
||||
|
||||
if (Status != NDIS_STATUS_PENDING) {
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
Adapter->NdisMiniportBlock.PendingRequest = NULL;
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
}
|
||||
|
||||
KeLowerIrql(OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -909,12 +903,10 @@ NdisMSetInformationComplete(
|
|||
{
|
||||
PLOGICAL_ADAPTER Adapter =
|
||||
(PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||
KIRQL OldIrql;
|
||||
ASSERT(Adapter);
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
/* This isn't a handler supplied by the miniport */
|
||||
if (Adapter->NdisMiniportBlock.SetCompleteHandler)
|
||||
(Adapter->NdisMiniportBlock.SetCompleteHandler)(MiniportAdapterHandle, Status);
|
||||
KeLowerIrql(OldIrql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -930,12 +922,10 @@ NdisMQueryInformationComplete(
|
|||
{
|
||||
PLOGICAL_ADAPTER Adapter =
|
||||
(PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||
KIRQL OldIrql;
|
||||
ASSERT(Adapter);
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
/* This isn't a handler supplied by the miniport */
|
||||
if( Adapter->NdisMiniportBlock.QueryCompleteHandler )
|
||||
(Adapter->NdisMiniportBlock.QueryCompleteHandler)(MiniportAdapterHandle, Status);
|
||||
KeLowerIrql(OldIrql);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -980,13 +970,11 @@ MiniportWorker(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
|
|||
else
|
||||
{
|
||||
/* SendPackets is called at DISPATCH_LEVEL for all serialized miniports */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
|
||||
{
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &RaiseOldIrql);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's SendPackets handler\n"));
|
||||
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, (PPNDIS_PACKET)&WorkItemContext, 1);
|
||||
}
|
||||
KeLowerIrql(RaiseOldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, RaiseOldIrql);
|
||||
|
||||
NdisStatus = NDIS_GET_PACKET_STATUS((PNDIS_PACKET)WorkItemContext);
|
||||
if( NdisStatus == NDIS_STATUS_RESOURCES ) {
|
||||
|
@ -1008,13 +996,13 @@ MiniportWorker(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
|
|||
else
|
||||
{
|
||||
/* Send is called at DISPATCH_LEVEL for all serialized miniports */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &RaiseOldIrql);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's Send handler\n"));
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, (PNDIS_PACKET)WorkItemContext,
|
||||
((PNDIS_PACKET)WorkItemContext)->Private.Flags);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
|
||||
KeLowerIrql(RaiseOldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, RaiseOldIrql);
|
||||
if( NdisStatus == NDIS_STATUS_RESOURCES ) {
|
||||
MiniQueueWorkItem(Adapter, WorkItemType, WorkItemContext, TRUE);
|
||||
break;
|
||||
|
@ -1046,19 +1034,14 @@ MiniportWorker(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
|
|||
NdisMIndicateStatus(Adapter, NDIS_STATUS_RESET_START, NULL, 0);
|
||||
NdisMIndicateStatusComplete(Adapter);
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.ResetHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
&AddressingReset);
|
||||
|
||||
if (NdisStatus == NDIS_STATUS_PENDING)
|
||||
{
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
Adapter->NdisMiniportBlock.ResetStatus = NDIS_STATUS_PENDING;
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
}
|
||||
Adapter->NdisMiniportBlock.ResetStatus = NdisStatus;
|
||||
|
||||
KeLowerIrql(OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
if (NdisStatus != NDIS_STATUS_PENDING)
|
||||
MiniResetComplete(Adapter, NdisStatus, AddressingReset);
|
||||
|
|
|
@ -204,13 +204,11 @@ proSendPacketToMiniport(PLOGICAL_ADAPTER Adapter, PNDIS_PACKET Packet)
|
|||
NdisStatus = NDIS_STATUS_PENDING;
|
||||
} else {
|
||||
/* SendPackets is called at DISPATCH_LEVEL for all serialized miniports */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
|
||||
{
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &RaiseOldIrql);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's SendPackets handler\n"));
|
||||
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, &Packet, 1);
|
||||
}
|
||||
KeLowerIrql(RaiseOldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, RaiseOldIrql);
|
||||
|
||||
NdisStatus = NDIS_GET_PACKET_STATUS(Packet);
|
||||
if (NdisStatus == NDIS_STATUS_RESOURCES) {
|
||||
|
@ -229,12 +227,12 @@ proSendPacketToMiniport(PLOGICAL_ADAPTER Adapter, PNDIS_PACKET Packet)
|
|||
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
|
||||
} else {
|
||||
/* Send is called at DISPATCH_LEVEL for all serialized miniports */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &RaiseOldIrql);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's Send handler\n"));
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, Packet, Packet->Private.Flags);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
|
||||
KeLowerIrql(RaiseOldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, RaiseOldIrql);
|
||||
|
||||
if (NdisStatus == NDIS_STATUS_RESOURCES) {
|
||||
MiniQueueWorkItem(Adapter, NdisWorkItemSend, Packet, TRUE);
|
||||
|
@ -274,8 +272,6 @@ ProSend(
|
|||
Adapter = AdapterBinding->Adapter;
|
||||
|
||||
ASSERT(Adapter);
|
||||
|
||||
/* if the following is not true, KeRaiseIrql() below will break */
|
||||
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
|
||||
|
||||
/* XXX what is this crazy black magic? */
|
||||
|
@ -326,10 +322,10 @@ ProSendPackets(
|
|||
else
|
||||
{
|
||||
/* SendPackets is called at DISPATCH_LEVEL for all serialized miniports */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &RaiseOldIrql);
|
||||
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, PacketArray, NumberOfPackets);
|
||||
KeLowerIrql(RaiseOldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, RaiseOldIrql);
|
||||
for (i = 0; i < NumberOfPackets; i++)
|
||||
{
|
||||
NdisStatus = NDIS_GET_PACKET_STATUS(PacketArray[i]);
|
||||
|
@ -353,7 +349,7 @@ ProSendPackets(
|
|||
else
|
||||
{
|
||||
/* Send is called at DISPATCH_LEVEL for all serialized miniports */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &RaiseOldIrql);
|
||||
for (i = 0; i < NumberOfPackets; i++)
|
||||
{
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
|
||||
|
@ -361,7 +357,7 @@ ProSendPackets(
|
|||
if (NdisStatus != NDIS_STATUS_PENDING)
|
||||
MiniSendComplete(Adapter, PacketArray[i], NdisStatus);
|
||||
}
|
||||
KeLowerIrql(RaiseOldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, RaiseOldIrql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -408,7 +404,7 @@ ProTransferData(
|
|||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
|
||||
Status = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.TransferDataHandler)(
|
||||
Packet,
|
||||
|
@ -418,7 +414,7 @@ ProTransferData(
|
|||
ByteOffset,
|
||||
BytesToTransfer);
|
||||
|
||||
KeLowerIrql(OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue