Filip and I have hopefully fixed the ndis completion problem on sends.

After calls to delayed miniport send routines, we check status and if not
pending, do NdisMSendComplete and set the miniport busy flag off.

svn path=/trunk/; revision=12196
This commit is contained in:
Art Yerkes 2004-12-18 19:32:40 +00:00
parent e0c43e5c83
commit e8861acfb2
4 changed files with 30 additions and 8 deletions

View file

@ -39,6 +39,7 @@ typedef struct _ATM_ADDRESS *PATM_ADDRESS;
#define EXPORT STDCALL #define EXPORT STDCALL
#endif #endif
#define NDIS_TAG 0x4e4d4953
#ifdef DBG #ifdef DBG

View file

@ -19,6 +19,7 @@
/* See debug.h for debug/trace constants */ /* See debug.h for debug/trace constants */
DWORD DebugTraceLevel = MIN_TRACE; DWORD DebugTraceLevel = MIN_TRACE;
//DWORD DebugTraceLevel = DEBUG_ULTRA;
#endif /* DBG */ #endif /* DBG */

View file

@ -18,6 +18,14 @@
#include <buffer.h> #include <buffer.h>
#endif /* DBG */ #endif /* DBG */
#undef NdisMSendComplete
VOID
EXPORT
NdisMSendComplete(
IN NDIS_HANDLE MiniportAdapterHandle,
IN PNDIS_PACKET Packet,
IN NDIS_STATUS Status);
/* Root of the scm database */ /* Root of the scm database */
#define SERVICES_ROOT L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\" #define SERVICES_ROOT L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"
@ -819,6 +827,8 @@ VOID STDCALL MiniportDpc(
*/ */
(*Adapter->Miniport->Chars.SendPacketsHandler)( (*Adapter->Miniport->Chars.SendPacketsHandler)(
Adapter->NdisMiniportBlock.MiniportAdapterContext, (PPNDIS_PACKET)&WorkItemContext, 1); Adapter->NdisMiniportBlock.MiniportAdapterContext, (PPNDIS_PACKET)&WorkItemContext, 1);
NdisStatus =
NDIS_GET_PACKET_STATUS((PNDIS_PACKET)WorkItemContext);
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's SendPackets handler\n")); NDIS_DbgPrint(MAX_TRACE, ("back from miniport's SendPackets handler\n"));
} }
@ -831,7 +841,9 @@ VOID STDCALL MiniportDpc(
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's Send handler\n")); NDIS_DbgPrint(MAX_TRACE, ("back from miniport's Send handler\n"));
} }
NdisMSendComplete
( Adapter, (PNDIS_PACKET)WorkItemContext, NdisStatus );
Adapter->MiniportBusy = FALSE;
break; break;
case NdisWorkItemSendLoopback: case NdisWorkItemSendLoopback:
@ -1831,8 +1843,6 @@ NdisMResetComplete(
MiniResetComplete(MiniportAdapterHandle, Status, AddressingReset); MiniResetComplete(MiniportAdapterHandle, Status, AddressingReset);
} }
#undef NdisMSendComplete
/* /*
* @implemented * @implemented

View file

@ -13,6 +13,13 @@
#include "ndissys.h" #include "ndissys.h"
#include <buffer.h> #include <buffer.h>
VOID
EXPORT
NdisMSendComplete(
IN NDIS_HANDLE MiniportAdapterHandle,
IN PNDIS_PACKET Packet,
IN NDIS_STATUS Status);
#define SERVICES_KEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\" #define SERVICES_KEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"
#define LINKAGE_KEY L"\\Linkage" #define LINKAGE_KEY L"\\Linkage"
#define PARAMETERS_KEY L"\\Parameters\\" #define PARAMETERS_KEY L"\\Parameters\\"
@ -359,11 +366,14 @@ ProSend(
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's Send handler\n")); NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's Send handler\n"));
NdisStatus = (*Adapter->Miniport->Chars.SendHandler)(Adapter->NdisMiniportBlock.MiniportAdapterContext, Packet, 0); NdisStatus = (*Adapter->Miniport->Chars.SendHandler)(Adapter->NdisMiniportBlock.MiniportAdapterContext, Packet, 0);
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n")); NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
if( NdisStatus != NDIS_STATUS_PENDING ) {
NdisMSendComplete( Adapter, Packet, NdisStatus );
Adapter->MiniportBusy = FALSE;
}
KeLowerIrql(RaiseOldIrql); KeLowerIrql(RaiseOldIrql);
} }
} }
/* XXX why the hell do we do this? */ /* XXX why the hell do we do this? */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n")); NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &SpinOldIrql); KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &SpinOldIrql);
@ -736,7 +746,7 @@ NdisRegisterProtocol(
UNICODE_STRING RegistryPath; UNICODE_STRING RegistryPath;
WCHAR *RegistryPathStr; WCHAR *RegistryPathStr;
RegistryPathStr = ExAllocatePool(PagedPool, sizeof(SERVICES_KEY) + ProtocolCharacteristics->Name.Length + sizeof(LINKAGE_KEY)); RegistryPathStr = ExAllocatePoolWithTag(PagedPool, sizeof(SERVICES_KEY) + ProtocolCharacteristics->Name.Length + sizeof(LINKAGE_KEY), NDIS_TAG + __LINE__);
if(!RegistryPathStr) if(!RegistryPathStr)
{ {
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
@ -785,7 +795,7 @@ NdisRegisterProtocol(
return; return;
} }
KeyInformation = ExAllocatePool(PagedPool, sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength); KeyInformation = ExAllocatePoolWithTag(PagedPool, sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength, NDIS_TAG + __LINE__);
if(!KeyInformation) if(!KeyInformation)
{ {
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
@ -856,7 +866,7 @@ NdisRegisterProtocol(
NDIS_DbgPrint(MAX_TRACE, ("Calling protocol's BindAdapter handler with DeviceName %wZ and RegistryPath %wZ\n", NDIS_DbgPrint(MAX_TRACE, ("Calling protocol's BindAdapter handler with DeviceName %wZ and RegistryPath %wZ\n",
&DeviceName, &RegistryPath)); &DeviceName, &RegistryPath));
/* XXX SD must do something with bind context */ /* XXX SD must do something with bind context */
*NdisProtocolHandle = Protocol; *NdisProtocolHandle = Protocol;