Author: cgutman
Date: Mon Oct 20 16:57:06 2008
New Revision: 36864
URL:
http://svn.reactos.org/svn/reactos?rev=36864&view=rev
Log:
- Merge aicom-network-fixes up to r36861
Modified:
trunk/reactos/drivers/network/ndis/include/miniport.h
trunk/reactos/drivers/network/ndis/ndis/miniport.c
trunk/reactos/drivers/network/ndis/ndis/protocol.c
trunk/reactos/lib/drivers/ip/network/neighbor.c
trunk/reactos/lib/drivers/ip/network/ports.c
trunk/reactos/lib/drivers/ip/network/router.c
trunk/reactos/lib/drivers/ip/network/transmit.c
Modified: trunk/reactos/drivers/network/ndis/include/miniport.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/inclu…
==============================================================================
--- trunk/reactos/drivers/network/ndis/include/miniport.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/include/miniport.h [iso-8859-1] Mon Oct 20 16:57:06
2008
@@ -163,6 +163,12 @@
NTAPI
MiniportWorker(IN PVOID WorkItem);
+VOID NTAPI
+MiniSendComplete(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN PNDIS_PACKET Packet,
+ IN NDIS_STATUS Status);
+
#endif /* __MINIPORT_H */
/* EOF */
Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Mon Oct 20 16:57:06
2008
@@ -265,11 +265,29 @@
IN BOOLEAN AddressingReset)
{
PLOGICAL_ADAPTER Adapter = MiniportAdapterHandle;
+ PLIST_ENTRY CurrentEntry;
+ PADAPTER_BINDING AdapterBinding;
KIRQL OldIrql;
- NDIS_DbgPrint(MIN_TRACE, ("FIXME: MiniResetComplete is partially
implemented\n"));
+
NdisMIndicateStatus(Adapter, NDIS_STATUS_RESET_END, NULL, 0);
+
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
+
+ CurrentEntry = Adapter->ProtocolListHead.Flink;
+
+ while (CurrentEntry != &Adapter->ProtocolListHead)
+ {
+ AdapterBinding = CONTAINING_RECORD(CurrentEntry, ADAPTER_BINDING,
AdapterListEntry);
+
+ (*AdapterBinding->ProtocolBinding->Chars.ResetCompleteHandler)(
+ AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
+ Status);
+
+ CurrentEntry = CurrentEntry->Flink;
+ }
+
Adapter->MiniportBusy = FALSE;
+
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
}
Modified: trunk/reactos/drivers/network/ndis/ndis/protocol.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] Mon Oct 20 16:57:06
2008
@@ -296,7 +296,66 @@
IN PPNDIS_PACKET PacketArray,
IN UINT NumberOfPackets)
{
- UNIMPLEMENTED
+ PADAPTER_BINDING AdapterBinding = NdisBindingHandle;
+ PLOGICAL_ADAPTER Adapter = AdapterBinding->Adapter;
+ KIRQL RaiseOldIrql;
+ NDIS_STATUS NdisStatus;
+ UINT i;
+
+
if(Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)
+ {
+ if(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_DESERIALIZE)
+ {
+
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
+ Adapter->NdisMiniportBlock.MiniportAdapterContext, PacketArray,
NumberOfPackets);
+ for (i = 0; i < NumberOfPackets; i++)
+ {
+ NdisStatus = NDIS_GET_PACKET_STATUS(PacketArray[i]);
+ if (NdisStatus != NDIS_STATUS_PENDING)
+ MiniSendComplete(Adapter, PacketArray[i], NdisStatus);
+ }
+ }
+ else
+ {
+ /* SendPackets is called at DISPATCH_LEVEL for all serialized miniports */
+ KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
+
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
+ Adapter->NdisMiniportBlock.MiniportAdapterContext, PacketArray,
NumberOfPackets);
+ KeLowerIrql(RaiseOldIrql);
+ for (i = 0; i < NumberOfPackets; i++)
+ {
+ NdisStatus = NDIS_GET_PACKET_STATUS(PacketArray[i]);
+ if (NdisStatus != NDIS_STATUS_PENDING)
+ MiniSendComplete(Adapter, PacketArray[i], NdisStatus);
+ }
+ }
+ }
+ else
+ {
+ if(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_DESERIALIZE)
+ {
+ for (i = 0; i < NumberOfPackets; i++)
+ {
+ NdisStatus =
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
+ Adapter->NdisMiniportBlock.MiniportAdapterContext,
PacketArray[i], 0);
+ if (NdisStatus != NDIS_STATUS_PENDING)
+ MiniSendComplete(Adapter, PacketArray[i], NdisStatus);
+ }
+ }
+ else
+ {
+ /* Send is called at DISPATCH_LEVEL for all serialized miniports */
+ KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
+ for (i = 0; i < NumberOfPackets; i++)
+ {
+ NdisStatus =
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
+ Adapter->NdisMiniportBlock.MiniportAdapterContext,
PacketArray[i], 0);
+ if (NdisStatus != NDIS_STATUS_PENDING)
+ MiniSendComplete(Adapter, PacketArray[i], NdisStatus);
+ }
+ KeLowerIrql(RaiseOldIrql);
+ }
+ }
}
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 Oct 20 16:57:06 2008
@@ -76,7 +76,7 @@
ASSERT_KM_POINTER(Packet->Complete);
Packet->Complete( Packet->Context,
Packet->Packet,
- NDIS_STATUS_REQUEST_ABORTED );
+ ErrorCode );
}
PoolFreeBuffer( Packet );
Modified: trunk/reactos/lib/drivers/ip/network/ports.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/por…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/ports.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/ports.c [iso-8859-1] Mon Oct 20 16:57:06 2008
@@ -44,6 +44,7 @@
Port = htons(Port);
ASSERT(Port >= PortSet->StartingPort);
+ ASSERT(Port < PortSet->StartingPort + PortSet->PortsToOversee);
Port -= PortSet->StartingPort;
ExAcquireFastMutex( &PortSet->Mutex );
@@ -67,7 +68,7 @@
Next -= PortSet->StartingPort;
ExAcquireFastMutex( &PortSet->Mutex );
- AllocatedPort = RtlFindClearBits( &PortSet->ProtoBitmap, 1, 0 );
+ AllocatedPort = RtlFindClearBits( &PortSet->ProtoBitmap, 1, Next );
if( AllocatedPort != (ULONG)-1 ) {
RtlSetBit( &PortSet->ProtoBitmap, AllocatedPort );
AllocatedPort += PortSet->StartingPort;
@@ -76,6 +77,9 @@
ExReleaseFastMutex( &PortSet->Mutex );
AllocatedPort = htons(AllocatedPort);
+
+ ASSERT(AllocatedPort >= PortSet->StartingPort);
+ ASSERT(AllocatedPort < PortSet->StartingPort + PortSet->PortsToOversee);
return AllocatedPort;
}
@@ -109,5 +113,8 @@
AllocatedPort = htons(AllocatedPort);
+ ASSERT(AllocatedPort >= PortSet->StartingPort);
+ ASSERT(AllocatedPort < PortSet->StartingPort + PortSet->PortsToOversee);
+
return AllocatedPort;
}
Modified: trunk/reactos/lib/drivers/ip/network/router.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/rou…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/router.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/router.c [iso-8859-1] Mon Oct 20 16:57:06 2008
@@ -390,7 +390,7 @@
TI_DbgPrint(DEBUG_ROUTER, ("Leaving\n"));
- return Found ? STATUS_NO_SUCH_FILE : STATUS_SUCCESS;
+ return Found ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
}
Modified: trunk/reactos/lib/drivers/ip/network/transmit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/tra…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/transmit.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/transmit.c [iso-8859-1] Mon Oct 20 16:57:06 2008
@@ -28,6 +28,7 @@
*/
{
PIPFRAGMENT_CONTEXT IFC = (PIPFRAGMENT_CONTEXT)Context;
+ NTSTATUS Status;
TI_DbgPrint
(MAX_TRACE,
@@ -35,8 +36,14 @@
Context, NdisPacket, NdisStatus));
if (NT_SUCCESS(NdisStatus) && PrepareNextFragment(IFC)) {
- /* A fragment was prepared for transmission, so send it */
- IPSendFragment(IFC->NdisPacket, IFC->NCE, IFC);
+ /* A fragment was prepared for transmission, so send it */
+ Status = IPSendFragment(IFC->NdisPacket, IFC->NCE, IFC);
+ if (!NT_SUCCESS(Status))
+ {
+ FreeNdisPacket(IFC->NdisPacket);
+ IFC->Complete(IFC->Context, IFC->Datagram, Status);
+ exFreePool(IFC);
+ }
} else {
TI_DbgPrint(MAX_TRACE, ("Calling completion handler.\n"));
@@ -87,7 +94,7 @@
TI_DbgPrint(MAX_TRACE, ("Called. IFC (0x%X)\n", IFC));
- if (IFC->BytesLeft != 0) {
+ if (IFC->BytesLeft > 0) {
TI_DbgPrint(MAX_TRACE, ("Preparing 1 fragment.\n"));
@@ -203,7 +210,12 @@
/* Prepare next fragment for transmission and send it */
- PrepareNextFragment(IFC);
+ if (!PrepareNextFragment(IFC)) {
+ FreeNdisPacket(IFC->NdisPacket);
+ ExFreePool(IFC);
+ return NDIS_STATUS_FAILURE;
+ }
+
return IPSendFragment(IFC->NdisPacket, NCE, IFC);
}