Author: cgutman
Date: Thu Dec 4 23:12:01 2008
New Revision: 37864
URL:
http://svn.reactos.org/svn/reactos?rev=37864&view=rev
Log:
- Remove some hacky double completion code
Modified:
branches/aicom-network-fixes/drivers/network/tcpip/datalink/lan.c
branches/aicom-network-fixes/drivers/network/tcpip/tcpip/main.c
Modified: branches/aicom-network-fixes/drivers/network/tcpip/datalink/lan.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/tcpip/datalink/lan.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/tcpip/datalink/lan.c [iso-8859-1] Thu Dec
4 23:12:01 2008
@@ -9,9 +9,6 @@
*/
#include "precomp.h"
-
-/* Define this to bugcheck on double complete */
-/* #define BREAK_ON_DOUBLE_COMPLETE */
UINT TransferDataCalled = 0;
UINT TransferDataCompleteCalled = 0;
@@ -51,54 +48,6 @@
LIST_ENTRY AdapterListHead;
KSPIN_LOCK AdapterListLock;
-/* Double complete protection */
-KSPIN_LOCK LanSendCompleteLock;
-LIST_ENTRY LanSendCompleteList;
-
-VOID LanChainCompletion( PLAN_ADAPTER Adapter, PNDIS_PACKET NdisPacket ) {
- PLAN_WQ_ITEM PendingCompletion =
- ExAllocatePool( NonPagedPool, sizeof(LAN_WQ_ITEM) );
-
- if( !PendingCompletion ) return;
-
- PendingCompletion->Packet = NdisPacket;
- PendingCompletion->Adapter = Adapter;
-
- ExInterlockedInsertTailList( &LanSendCompleteList,
- &PendingCompletion->ListEntry,
- &LanSendCompleteLock );
-}
-
-BOOLEAN LanShouldComplete( PLAN_ADAPTER Adapter, PNDIS_PACKET NdisPacket ) {
- PLIST_ENTRY ListEntry;
- PLAN_WQ_ITEM CompleteEntry;
- KIRQL OldIrql;
-
- KeAcquireSpinLock( &LanSendCompleteLock, &OldIrql );
- for( ListEntry = LanSendCompleteList.Flink;
- ListEntry != &LanSendCompleteList;
- ListEntry = ListEntry->Flink ) {
- CompleteEntry = CONTAINING_RECORD(ListEntry, LAN_WQ_ITEM, ListEntry);
-
- if( CompleteEntry->Adapter == Adapter &&
- CompleteEntry->Packet == NdisPacket ) {
- RemoveEntryList( ListEntry );
- KeReleaseSpinLock( &LanSendCompleteLock, OldIrql );
- ExFreePool( CompleteEntry );
- return TRUE;
- }
- }
- KeReleaseSpinLock( &LanSendCompleteLock, OldIrql );
-
- DbgPrint("NDIS completed the same send packet twice "
- "(Adapter %x Packet %x)!!\n", Adapter, NdisPacket);
-#ifdef BREAK_ON_DOUBLE_COMPLETE
- KeBugCheck(0);
-#endif
-
- return FALSE;
-}
-
NDIS_STATUS NDISCall(
PLAN_ADAPTER Adapter,
NDIS_REQUEST_TYPE Type,
@@ -283,13 +232,11 @@
*/
{
TI_DbgPrint(DEBUG_DATALINK, ("Calling completion routine\n"));
- if( LanShouldComplete( (PLAN_ADAPTER)BindingContext, Packet ) ) {
- ASSERT_KM_POINTER(Packet);
- ASSERT_KM_POINTER(PC(Packet));
- ASSERT_KM_POINTER(PC(Packet)->DLComplete);
- (*PC(Packet)->DLComplete)( PC(Packet)->Context, Packet, Status);
- TI_DbgPrint(DEBUG_DATALINK, ("Finished\n"));
- }
+ ASSERT_KM_POINTER(Packet);
+ ASSERT_KM_POINTER(PC(Packet));
+ ASSERT_KM_POINTER(PC(Packet)->DLComplete);
+ (*PC(Packet)->DLComplete)( PC(Packet)->Context, Packet, Status);
+ TI_DbgPrint(DEBUG_DATALINK, ("Finished\n"));
}
VOID LanReceiveWorker( PVOID Context ) {
@@ -645,8 +592,6 @@
/* XXX arty -- Handled adjustment in a saner way than before ...
* not needed immediately */
GetDataPtr( NdisPacket, 0, &Data, &Size );
-
- LanChainCompletion( Adapter, NdisPacket );
switch (Adapter->Media) {
case NdisMedium802_3:
@@ -1380,24 +1325,4 @@
}
}
-VOID LANStartup() {
- InitializeListHead( &LanSendCompleteList );
- KeInitializeSpinLock( &LanSendCompleteLock );
-}
-
-VOID LANShutdown() {
- KIRQL OldIrql;
- PLAN_WQ_ITEM WorkItem;
- PLIST_ENTRY ListEntry;
-
- KeAcquireSpinLock( &LanSendCompleteLock, &OldIrql );
- while( !IsListEmpty( &LanSendCompleteList ) ) {
- ListEntry = RemoveHeadList( &LanSendCompleteList );
- WorkItem = CONTAINING_RECORD(ListEntry, LAN_WQ_ITEM, ListEntry);
- FreeNdisPacket( WorkItem->Packet );
- ExFreePool( WorkItem );
- }
- KeReleaseSpinLock( &LanSendCompleteLock, OldIrql );
-}
-
/* EOF */
Modified: branches/aicom-network-fixes/drivers/network/tcpip/tcpip/main.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/tcpip/tcpip/main.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Thu Dec
4 23:12:01 2008
@@ -585,9 +585,6 @@
/* Shutdown network level protocol subsystem */
IPShutdown();
- /* Shutdown the lan worker */
- LANShutdown();
-
/* Free NDIS buffer descriptors */
if (GlobalBufferPool)
NdisFreeBufferPool(GlobalBufferPool);
@@ -827,9 +824,6 @@
return Status;
}
- /* Initialize the lan worker */
- LANStartup();
-
/* Register protocol with NDIS */
/* This used to be IP_DEVICE_NAME but the DDK says it has to match your entry in the
SCM */
Status = LANRegisterProtocol(&strNdisDeviceName);
@@ -843,7 +837,6 @@
NULL,
0,
NULL);
- LANShutdown();
TCPShutdown();
UDPShutdown();
RawIPShutdown();
@@ -863,7 +856,6 @@
Status = LoopRegisterAdapter(NULL, NULL);
if (!NT_SUCCESS(Status)) {
TI_DbgPrint(MIN_TRACE, ("Failed to create loopback adapter. Status
(0x%X).\n", Status));
- LANShutdown();
TCPShutdown();
UDPShutdown();
RawIPShutdown();