diff options
| author | Yang You (UU) <[email protected]> | 2025-12-04 15:30:32 -0800 |
|---|---|---|
| committer | Yang You (UU) <[email protected]> | 2025-12-04 15:30:32 -0800 |
| commit | 10835ebc2bc4a774907fb47880ffc366b159622c (patch) | |
| tree | 7cfd1d9508a9a9c216706269a37cddb9db61299c /network/netadaptercx/netvadapterlibrary/code/enl.cpp | |
| parent | 977cb2461482a898f96ee08f9cb24eb7f421da03 (diff) | |
Cleanup the KSpinlock.h and replace with WDFSpinlock
Diffstat (limited to 'network/netadaptercx/netvadapterlibrary/code/enl.cpp')
| -rw-r--r-- | network/netadaptercx/netvadapterlibrary/code/enl.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/network/netadaptercx/netvadapterlibrary/code/enl.cpp b/network/netadaptercx/netvadapterlibrary/code/enl.cpp index 30822900..4087372d 100644 --- a/network/netadaptercx/netvadapterlibrary/code/enl.cpp +++ b/network/netadaptercx/netvadapterlibrary/code/enl.cpp @@ -241,13 +241,15 @@ enlpCheckAndArmQueue( // arm it. if (ringBuffer->BeginIndex == ringBuffer->EndIndex) { - KAcquireSpinLock lock(Q->Spinlock); + WdfSpinLockAcquire(Q->Spinlock); if (ringBuffer->BeginIndex == ringBuffer->EndIndex) { armed = TRUE; Q->Armed = TRUE; } + + WdfSpinLockRelease(Q->Spinlock); } return armed; @@ -543,6 +545,7 @@ EnlCreateQueue( ENLP_LINK* enlLink; ENLP_PORT* port; ENLP_QUEUE* enlQueue; + NTSTATUS status; if (Tx) // Tx { @@ -580,6 +583,15 @@ EnlCreateQueue( &netvRxQueue->m_adapter, reinterpret_cast<ULONG_PTR>(Queue), netvRxQueue); } + // Create WDF spinlock for the queue, parent to the queue's WDF handle + { + WDF_OBJECT_ATTRIBUTES attributes; + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.ParentObject = enlQueue->Queue->m_handle; + status = WdfSpinLockCreate(&attributes, &enlQueue->Spinlock); + NT_ASSERT(NT_SUCCESS(status)); + } + EnlpResumeThread(&enlLink->EnlThread); return enlQueue; @@ -615,15 +627,16 @@ EnlRingDoorBell( ) { InterlockedExchange((volatile LONG *)&Queue->QueueEnd, (LONG)EndIndex); - - KAcquireSpinLock lock{ Queue->Spinlock }; + WdfSpinLockAcquire(Queue->Spinlock); if (Queue->Armed) { NT_ASSERT(Queue->ArmWaitEvent != NULL); Queue->Armed = FALSE; - lock.Release(); + WdfSpinLockRelease(Queue->Spinlock); Queue->ArmWaitEvent->Set(); + return; } + WdfSpinLockRelease(Queue->Spinlock); } _IRQL_requires_max_(PASSIVE_LEVEL) |
