Author: cgutman
Date: Sun Sep 21 07:41:26 2008
New Revision: 36372
URL:
http://svn.reactos.org/svn/reactos?rev=36372&view=rev
Log:
- Merge aicom-network-fixes up to r36371
Modified:
trunk/reactos/drivers/network/afd/include/afd.h
trunk/reactos/drivers/network/ndis/ndis/io.c
trunk/reactos/drivers/network/ndis/ndis/miniport.c
trunk/reactos/drivers/network/ndis/ndis/protocol.c
trunk/reactos/drivers/network/tcpip/tcpip/pool.c
Modified: trunk/reactos/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Sun Sep 21 07:41:26 2008
@@ -97,7 +97,7 @@
#define FUNCTION_CLOSE 5
#define MAX_FUNCTIONS 6
-#define IN_FLIGHT_REQUESTS 3
+#define IN_FLIGHT_REQUESTS 4
#define EXTRA_LOCK_BUFFERS 2 /* Number of extra buffers needed
* for ancillary data on packet
Modified: trunk/reactos/drivers/network/ndis/ndis/io.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/io.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/io.c [iso-8859-1] Sun Sep 21 07:41:26 2008
@@ -28,37 +28,15 @@
* SystemArgument2 = Unused
*/
{
- BOOLEAN WasBusy;
PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(DeferredContext);
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
-
- /* XXX try to grok WasBusy */
- KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
- {
- WasBusy = Adapter->MiniportBusy;
- Adapter->MiniportBusy = TRUE;
- }
- KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
/* Call the deferred interrupt service handler for this adapter */
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.HandleInterruptHandler)(
Adapter->NdisMiniportBlock.MiniportAdapterContext);
-
- KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
- {
- if ((!WasBusy) && (Adapter->WorkQueueHead))
- {
- KeInsertQueueDpc(&Adapter->NdisMiniportBlock.DeferredDpc, NULL, NULL);
- }
- else
- {
- Adapter->MiniportBusy = WasBusy;
- }
- }
- KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
/* re-enable the interrupt */
NDIS_DbgPrint(MAX_TRACE, ("re-enabling the interrupt\n"));
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] Sun Sep 21 07:41:26
2008
@@ -309,10 +309,11 @@
VOID NTAPI
MiniRequestComplete(
- IN PNDIS_MINIPORT_BLOCK Adapter,
+ IN PNDIS_HANDLE MiniportAdapterHandle,
IN PNDIS_REQUEST Request,
IN NDIS_STATUS Status)
{
+ PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
PNDIS_REQUEST_MAC_BLOCK MacBlock = (PNDIS_REQUEST_MAC_BLOCK)Request->MacReserved;
KIRQL OldIrql;
@@ -326,6 +327,7 @@
Status);
}
KeLowerIrql(OldIrql);
+ Adapter->MiniportBusy = FALSE;
}
VOID NTAPI
@@ -342,6 +344,7 @@
* Status = Status of send operation
*/
{
+ PLOGICAL_ADAPTER Adapter = MiniportAdapterHandle;
PADAPTER_BINDING AdapterBinding;
KIRQL OldIrql;
@@ -355,6 +358,7 @@
Packet,
Status);
KeLowerIrql(OldIrql);
+ Adapter->MiniportBusy = FALSE;
}
@@ -375,6 +379,7 @@
IN NDIS_STATUS Status,
IN UINT BytesTransferred)
{
+ PLOGICAL_ADAPTER Adapter = MiniportAdapterHandle;
PADAPTER_BINDING AdapterBinding;
KIRQL OldIrql;
@@ -388,6 +393,7 @@
Packet,
Status);
KeLowerIrql(OldIrql);
+ Adapter->MiniportBusy = FALSE;
}
@@ -655,6 +661,12 @@
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
+ if (Adapter->MiniportBusy) {
+ NDIS_DbgPrint(MID_TRACE, ("Waiting for miniport to become free.\n"));
+ KeInsertQueueDpc(&Adapter->NdisMiniportBlock.DeferredDpc, NULL, NULL);
+ return NDIS_STATUS_FAILURE;
+ }
+
Item = Adapter->WorkQueueHead;
if (Item)
@@ -669,6 +681,8 @@
*WorkItemContext = Item->WorkItemContext;
ExFreePool(Item);
+
+ Adapter->MiniportBusy = TRUE;
return NDIS_STATUS_SUCCESS;
}
@@ -738,14 +752,15 @@
IN NDIS_HANDLE MiniportAdapterHandle,
IN NDIS_STATUS Status)
{
- PNDIS_MINIPORT_BLOCK MiniportBlock =
- (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
+ PLOGICAL_ADAPTER Adapter =
+ (PLOGICAL_ADAPTER)MiniportAdapterHandle;
KIRQL OldIrql;
- ASSERT(MiniportBlock);
+ ASSERT(Adapter);
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
- if( MiniportBlock->QueryCompleteHandler )
- (MiniportBlock->QueryCompleteHandler)(MiniportAdapterHandle, Status);
+ if( Adapter->NdisMiniportBlock.QueryCompleteHandler )
+ (Adapter->NdisMiniportBlock.QueryCompleteHandler)(MiniportAdapterHandle, Status);
KeLowerIrql(OldIrql);
+ Adapter->MiniportBusy = FALSE;
}
VOID NTAPI MiniportWorker(IN PVOID WorkItem)
@@ -783,6 +798,7 @@
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's SendPackets
handler\n"));
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
Adapter->NdisMiniportBlock.MiniportAdapterContext,
(PPNDIS_PACKET)&WorkItemContext, 1);
+ NdisStatus = NDIS_GET_PACKET_STATUS((PNDIS_PACKET)WorkItemContext);
}
else
{
@@ -794,9 +810,15 @@
Adapter->NdisMiniportBlock.MiniportAdapterContext,
(PPNDIS_PACKET)&WorkItemContext, 1);
}
KeLowerIrql(RaiseOldIrql);
+
+ NdisStatus = NDIS_GET_PACKET_STATUS((PNDIS_PACKET)WorkItemContext);
+ if( NdisStatus == NDIS_STATUS_RESOURCES ) {
+ KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock,
&OldIrql);
+ MiniQueueWorkItem(Adapter, WorkItemType, WorkItemContext);
+ KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock,
OldIrql);
+ break;
+ }
}
-
- NdisStatus = NDIS_GET_PACKET_STATUS((PNDIS_PACKET)WorkItemContext);
}
else
{
@@ -816,15 +838,18 @@
Adapter->NdisMiniportBlock.MiniportAdapterContext,
(PNDIS_PACKET)WorkItemContext, 0);
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send
handler\n"));
KeLowerIrql(RaiseOldIrql);
+ if( NdisStatus == NDIS_STATUS_RESOURCES ) {
+ KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock,
&OldIrql);
+ MiniQueueWorkItem(Adapter, WorkItemType, WorkItemContext);
+ KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock,
OldIrql);
+ break;
+ }
}
}
- if( NdisStatus == NDIS_STATUS_RESOURCES )
- MiniQueueWorkItem(Adapter, WorkItemType, WorkItemContext);
- else if( NdisStatus != NDIS_STATUS_PENDING ) {
+ if( NdisStatus != NDIS_STATUS_PENDING ) {
NdisMSendComplete
( Adapter, (PNDIS_PACKET)WorkItemContext, NdisStatus );
- Adapter->MiniportBusy = FALSE;
}
break;
@@ -834,7 +859,9 @@
*/
/* XXX atm ProIndicatePacket sends a packet up via the loopback adapter only
*/
NdisStatus = ProIndicatePacket(Adapter, (PNDIS_PACKET)WorkItemContext);
- MiniSendComplete((NDIS_HANDLE)Adapter, (PNDIS_PACKET)WorkItemContext,
NdisStatus);
+
+ if( NdisStatus != NDIS_STATUS_PENDING )
+ MiniSendComplete((NDIS_HANDLE)Adapter, (PNDIS_PACKET)WorkItemContext,
NdisStatus);
break;
case NdisWorkItemReturnPackets:
@@ -859,12 +886,12 @@
{
case NdisRequestQueryInformation:
NdisMQueryInformationComplete((NDIS_HANDLE)Adapter, NdisStatus);
- MiniRequestComplete( &Adapter->NdisMiniportBlock,
(PNDIS_REQUEST)WorkItemContext, NdisStatus );
+ MiniRequestComplete( (NDIS_HANDLE)Adapter,
(PNDIS_REQUEST)WorkItemContext, NdisStatus );
break;
case NdisRequestSetInformation:
NdisMSetInformationComplete((NDIS_HANDLE)Adapter, NdisStatus);
- MiniRequestComplete( &Adapter->NdisMiniportBlock,
(PNDIS_REQUEST)WorkItemContext, NdisStatus );
+ MiniRequestComplete( (NDIS_HANDLE)Adapter,
(PNDIS_REQUEST)WorkItemContext, NdisStatus );
break;
default:
@@ -878,6 +905,9 @@
break;
}
}
+
+ if( NdisStatus != NDIS_STATUS_PENDING )
+ Adapter->MiniportBusy = FALSE;
ExFreePool(WorkItem);
}
@@ -1988,10 +2018,14 @@
IN NDIS_HANDLE MiniportAdapterHandle,
IN NDIS_STATUS Status)
{
+ PLOGICAL_ADAPTER Adapter =
+ (PLOGICAL_ADAPTER)MiniportAdapterHandle;
KIRQL OldIrql;
+ ASSERT(Adapter);
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
-
(*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SetCompleteHandler)(MiniportAdapterHandle,
Status);
+ (Adapter->NdisMiniportBlock.SetCompleteHandler)(MiniportAdapterHandle, Status);
KeLowerIrql(OldIrql);
+ Adapter->MiniportBusy = FALSE;
}
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] Sun Sep 21 07:41:26
2008
@@ -143,11 +143,6 @@
{
if(Adapter->MiniportBusy)
QueueWorkItem = TRUE;
- else
- {
- NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to busy\n"));
- Adapter->MiniportBusy = TRUE;
- }
}
/* MiniQueueWorkItem must be called at IRQL >= DISPATCH_LEVEL */
@@ -160,18 +155,10 @@
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
- NdisStatus = MiniDoRequest(&Adapter->NdisMiniportBlock, NdisRequest);
-
- NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
- KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
- {
- NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to free\n"));
- Adapter->MiniportBusy = FALSE;
-
- if (Adapter->WorkQueueHead)
- KeInsertQueueDpc(&Adapter->NdisMiniportBlock.DeferredDpc, NULL,
NULL);
- }
- KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
+ NdisStatus = MiniDoRequest(&Adapter->NdisMiniportBlock, NdisRequest);
+
+ if( NdisStatus == NDIS_STATUS_PENDING )
+ Adapter->MiniportBusy = TRUE;
return NdisStatus;
}
Modified: trunk/reactos/drivers/network/tcpip/tcpip/pool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/pool.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/pool.c [iso-8859-1] Sun Sep 21 07:41:26
2008
@@ -25,8 +25,6 @@
/* FIXME: Get buffer from a free buffer pool with enough room */
Buffer = ExAllocatePool(NonPagedPool, Size);
-
- RtlZeroMemory(Buffer, Size);
TI_DbgPrint(DEBUG_MEMORY, ("Allocated (%i) bytes at (0x%X).\n", Size,
Buffer));