From 262dd175beeca4ffa797987c66c4fee97f541af9 Mon Sep 17 00:00:00 2001 From: CoolStar Date: Tue, 12 Mar 2024 02:07:11 -0700 Subject: [PATCH] Stop adapter on Rx cancel. Ensure working S3 sleep/wake --- rxqueue.cpp | 6 ++++++ txqueue.cpp | 13 ------------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/rxqueue.cpp b/rxqueue.cpp index b533c35..a94f1e6 100644 --- a/rxqueue.cpp +++ b/rxqueue.cpp @@ -507,6 +507,12 @@ EvtRxQueueCancel( RT_RXQUEUE* rx = RtGetRxQueueContext(rxQueue); + WdfSpinLockAcquire(rx->Adapter->Lock); + + re_stop(&rx->Adapter->bsdData); + + WdfSpinLockRelease(rx->Adapter->Lock); + // try (but not very hard) to grab anything that may have been // indicated during rx disable. advance will continue to be called // after cancel until all packets are returned to the framework. diff --git a/txqueue.cpp b/txqueue.cpp index 91f3a31..fed96ab 100644 --- a/txqueue.cpp +++ b/txqueue.cpp @@ -641,18 +641,5 @@ EvtTxQueueCancel( // the queue will continue to be drained like normal. // - NET_RING* pr = NetRingCollectionGetPacketRing(tx->Rings); - - while (pr->BeginIndex != pr->EndIndex) - { - NET_PACKET* packet = NetRingGetPacketAtIndex(pr, pr->BeginIndex); - packet->Ignore = 1; - - pr->BeginIndex = NetRingIncrementIndex(pr, pr->BeginIndex); - } - - NET_RING* fr = NetRingCollectionGetFragmentRing(tx->Rings); - fr->BeginIndex = fr->EndIndex; - TraceExit(); } \ No newline at end of file