Author: cgutman
Date: Mon Sep 20 19:08:40 2010
New Revision: 48833
URL:
http://svn.reactos.org/svn/reactos?rev=48833&view=rev
Log:
[TCPIP]
- Process the timer event directly from the DPC instead of queuing a work item then
raising to DISPATCH_LEVEL later when acquiring a spin lock
- Optimize the spin lock operations in NBTimeout and IPDatagramReassemblyTimeout for being
called at DISPATCH_LEVEL
Modified:
trunk/reactos/drivers/network/tcpip/include/ip.h
trunk/reactos/drivers/network/tcpip/tcpip/main.c
trunk/reactos/lib/drivers/ip/network/ip.c
trunk/reactos/lib/drivers/ip/network/neighbor.c
trunk/reactos/lib/drivers/ip/network/receive.c
Modified: trunk/reactos/drivers/network/tcpip/include/ip.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/include/ip.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/include/ip.h [iso-8859-1] Mon Sep 20 19:08:40
2010
@@ -205,7 +205,6 @@
extern KSPIN_LOCK InterfaceListLock;
extern LIST_ENTRY NetTableListHead;
extern KSPIN_LOCK NetTableListLock;
-extern BOOLEAN IpWorkItemQueued;
PIP_PACKET IPCreatePacket(
ULONG Type);
@@ -232,7 +231,10 @@
VOID IPUnregisterInterface(
PIP_INTERFACE IF);
-VOID NTAPI IPTimeout( PVOID Context );
+VOID NTAPI IPTimeoutDpcFn(PKDPC Dpc,
+ PVOID DeferredContext,
+ PVOID SystemArgument1,
+ PVOID SystemArgument2);
VOID IPDispatchProtocol(
PIP_INTERFACE Interface,
Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Mon Sep 20 19:08:40
2010
@@ -24,8 +24,6 @@
/* Network timers */
KTIMER IPTimer;
KDPC IPTimeoutDpc;
-KSPIN_LOCK IpWorkLock;
-WORK_QUEUE_ITEM IpWorkItem;
VOID TiWriteErrorLog(
PDRIVER_OBJECT DriverContext,
@@ -578,28 +576,6 @@
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
}
-VOID NTAPI IPTimeoutDpcFn(
- PKDPC Dpc,
- PVOID DeferredContext,
- PVOID SystemArgument1,
- PVOID SystemArgument2)
-/*
- * FUNCTION: Timeout DPC
- * ARGUMENTS:
- * Dpc = Pointer to our DPC object
- * DeferredContext = Pointer to context information (unused)
- * SystemArgument1 = Unused
- * SystemArgument2 = Unused
- * NOTES:
- * This routine is dispatched once in a while to do maintainance jobs
- */
-{
- if( !IpWorkItemQueued ) {
- ExQueueWorkItem( &IpWorkItem, DelayedWorkQueue );
- IpWorkItemQueued = TRUE;
- }
-}
-
NTSTATUS NTAPI
DriverEntry(
PDRIVER_OBJECT DriverObject,
@@ -630,7 +606,6 @@
/* Initialize our periodic timer and its associated DPC object. When the
timer expires, the IPTimeout deferred procedure call (DPC) is queued */
- ExInitializeWorkItem( &IpWorkItem, IPTimeout, NULL );
KeInitializeDpc(&IPTimeoutDpc, IPTimeoutDpcFn, NULL);
KeInitializeTimer(&IPTimer);
Modified: trunk/reactos/lib/drivers/ip/network/ip.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/ip.…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/ip.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/ip.c [iso-8859-1] Mon Sep 20 19:08:40 2010
@@ -63,9 +63,21 @@
}
-void NTAPI IPTimeout( PVOID Context ) {
- IpWorkItemQueued = FALSE;
-
+VOID NTAPI IPTimeoutDpcFn(PKDPC Dpc,
+ PVOID DeferredContext,
+ PVOID SystemArgument1,
+ PVOID SystemArgument2)
+/*
+ * FUNCTION: Timeout DPC
+ * ARGUMENTS:
+ * Dpc = Pointer to our DPC object
+ * DeferredContext = Pointer to context information (unused)
+ * SystemArgument1 = Unused
+ * SystemArgument2 = Unused
+ * NOTES:
+ * This routine is dispatched once in a while to do maintainance jobs
+ */
+{
/* Check if datagram fragments have taken too long to assemble */
IPDatagramReassemblyTimeout();
Modified: trunk/reactos/lib/drivers/ip/network/neighbor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/nei…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/neighbor.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/neighbor.c [iso-8859-1] Mon Sep 20 19:08:40 2010
@@ -97,12 +97,11 @@
*/
{
UINT i;
- KIRQL OldIrql;
PNEIGHBOR_CACHE_ENTRY *PrevNCE;
PNEIGHBOR_CACHE_ENTRY NCE;
for (i = 0; i <= NB_HASHMASK; i++) {
- TcpipAcquireSpinLock(&NeighborCache[i].Lock, &OldIrql);
+ TcpipAcquireSpinLockAtDpcLevel(&NeighborCache[i].Lock);
for (PrevNCE = &NeighborCache[i].Cache;
(NCE = *PrevNCE) != NULL;) {
@@ -136,7 +135,7 @@
PrevNCE = &NCE->Next;
}
- TcpipReleaseSpinLock(&NeighborCache[i].Lock, OldIrql);
+ TcpipReleaseSpinLockFromDpcLevel(&NeighborCache[i].Lock);
}
}
Modified: trunk/reactos/lib/drivers/ip/network/receive.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/rec…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/receive.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/receive.c [iso-8859-1] Mon Sep 20 19:08:40 2010
@@ -510,11 +510,10 @@
* to hold IP fragments that have taken too long to reassemble
*/
{
- KIRQL OldIrql;
PLIST_ENTRY CurrentEntry, NextEntry;
PIPDATAGRAM_REASSEMBLY CurrentIPDR;
- TcpipAcquireSpinLock(&ReassemblyListLock, &OldIrql);
+ TcpipAcquireSpinLockAtDpcLevel(&ReassemblyListLock);
CurrentEntry = ReassemblyListHead.Flink;
while (CurrentEntry != &ReassemblyListHead)
@@ -539,7 +538,7 @@
CurrentEntry = NextEntry;
}
- TcpipReleaseSpinLock(&ReassemblyListLock, OldIrql);
+ TcpipReleaseSpinLockFromDpcLevel(&ReassemblyListLock);
}
VOID IPv4Receive(PIP_INTERFACE IF, PIP_PACKET IPPacket)