Author: cgutman
Date: Sat Oct 4 16:55:01 2008
New Revision: 36649
URL:
http://svn.reactos.org/svn/reactos?rev=36649&view=rev
Log:
- Only call the ProtocolReceivePacket handler if the protocol registered one
- Remove some unneeded code
- Immediately send the loopback packet if possible
Modified:
branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c
branches/aicom-network-fixes/drivers/network/ndis/ndis/protocol.c
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Sat Oct
4 16:55:01 2008
@@ -182,26 +182,6 @@
AdapterBinding = CONTAINING_RECORD(CurrentEntry, ADAPTER_BINDING,
AdapterListEntry);
NDIS_DbgPrint(DEBUG_MINIPORT, ("AdapterBinding = %x\n", AdapterBinding));
-#ifdef DBG
- if(!AdapterBinding)
- {
- NDIS_DbgPrint(MIN_TRACE, ("AdapterBinding was null\n"));
- break;
- }
-
- if(!AdapterBinding->ProtocolBinding)
- {
- NDIS_DbgPrint(MIN_TRACE, ("AdapterBinding->ProtocolBinding was
null\n"));
- break;
- }
-
- if(!AdapterBinding->ProtocolBinding->Chars.ReceiveHandler)
- {
- NDIS_DbgPrint(MIN_TRACE,
("AdapterBinding->ProtocolBinding->Chars.ReceiveHandler was null\n"));
- break;
- }
-#endif
-
NDIS_DbgPrint
(MID_TRACE,
("XXX (%x) %x %x %x %x %x %x %x XXX\n",
@@ -261,11 +241,14 @@
{
AdapterBinding = CONTAINING_RECORD(CurrentEntry, ADAPTER_BINDING,
AdapterListEntry);
- for (i = 0; i < NumberOfPackets; i++)
+ if (AdapterBinding->ProtocolBinding->Chars.ReceivePacketHandler)
{
- (*AdapterBinding->ProtocolBinding->Chars.ReceivePacketHandler)(
- AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
- PacketArray[i]);
+ for (i = 0; i < NumberOfPackets; i++)
+ {
+ (*AdapterBinding->ProtocolBinding->Chars.ReceivePacketHandler)(
+ AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
+ PacketArray[i]);
+ }
}
CurrentEntry = CurrentEntry->Flink;
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/protocol.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/protocol.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/protocol.c [iso-8859-1] Sat Oct
4 16:55:01 2008
@@ -215,14 +215,18 @@
if ((Adapter->NdisMiniportBlock.MacOptions & NDIS_MAC_OPTION_NO_LOOPBACK)
&&
MiniAdapterHasAddress(Adapter, Packet))
{
- NDIS_DbgPrint(MID_TRACE, ("Queuing packet.\n"));
-
- MiniQueueWorkItem(Adapter, NdisWorkItemSendLoopback, (PVOID)Packet);
- KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, SpinOldIrql);
- return NDIS_STATUS_PENDING;
+ if(Adapter->MiniportBusy) {
+ MiniQueueWorkItem(Adapter, NdisWorkItemSendLoopback, Packet);
+ KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, SpinOldIrql);
+ return NDIS_STATUS_PENDING;
+ }
+
+ KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, SpinOldIrql);
+
+ return ProIndicatePacket(Adapter, Packet);
} else {
if(Adapter->MiniportBusy) {
- MiniQueueWorkItem(Adapter, NdisWorkItemSend, (PVOID)Packet);
+ MiniQueueWorkItem(Adapter, NdisWorkItemSend, Packet);
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, SpinOldIrql);
return NDIS_STATUS_PENDING;
}