aboutsummaryrefslogtreecommitdiffstats
path: root/wintun.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-07-03 08:41:37 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2019-07-04 14:34:49 +0200
commit09dc9324d19e05116daf718def168dc366089476 (patch)
treeedcf5328eb40a173e709652f78d6c302d13c7ff1 /wintun.c
parentReorder ReturnNBL and DispatchWrite (diff)
downloadwintun-09dc9324d19e05116daf718def168dc366089476.tar.xz
wintun-09dc9324d19e05116daf718def168dc366089476.zip
Create copies of NBLs to complete them faster
It turns out that waiting for them to come back in the return function introduces extremely high latency. We need to eventually stop doing this and move to a proper ring buffer. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'wintun.c')
-rw-r--r--wintun.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/wintun.c b/wintun.c
index 3dadffb..3b878ab 100644
--- a/wintun.c
+++ b/wintun.c
@@ -909,7 +909,6 @@ TunDispatchWrite(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp)
InterlockedAdd64(&Ctx->ActiveNBLCount, NblCount);
InterlockedExchange(IRP_REFCOUNT(Irp), NblCount);
- IoMarkIrpPending(Irp);
for (EtherTypeIndex Index = EtherTypeIndexStart; Index < EtherTypeIndexEnd; Index++)
{
@@ -920,12 +919,13 @@ TunDispatchWrite(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp)
NblQueue[Index].Head,
NDIS_DEFAULT_PORT_NUMBER,
NblQueue[Index].Count,
- NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE | NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL);
+ NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE | NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL | NDIS_RECEIVE_FLAGS_RESOURCES);
+ TunReturnNetBufferLists((NDIS_HANDLE)Ctx, NblQueue[Index].Head, 0);
}
ExReleaseSpinLockShared(&Ctx->TransitionLock, Irql);
TunCompletePause(Ctx, TRUE);
- return STATUS_PENDING;
+ return STATUS_SUCCESS;
cleanup_nbl_queues:
for (EtherTypeIndex Index = EtherTypeIndexStart; Index < EtherTypeIndexEnd; Index++)