reactos/drivers/lib/ip/network
diff -u -r1.5 -r1.6
--- interface.c 1 Dec 2004 08:14:15 -0000 1.5
+++ interface.c 14 Dec 2004 08:00:47 -0000 1.6
@@ -59,21 +59,10 @@
NTSTATUS GetInterfaceSpeed( PIP_INTERFACE Interface, PUINT Speed ) {
NDIS_STATUS NdisStatus;
PLAN_ADAPTER IF = (PLAN_ADAPTER)Interface->Context;
+
+ *Speed = IF->Speed;
-#ifdef __NTDRIVER__
- /* Get maximum link speed */
- NdisStatus = NDISCall(IF,
- NdisRequestQueryInformation,
- OID_GEN_LINK_SPEED,
- Speed,
- sizeof(UINT));
-#else
- (void)IF;
- NdisStatus = NDIS_STATUS_SUCCESS;
- *Speed = 10000;
-#endif
-
- return
+ return STATUS_SUCCESS;
NdisStatus != NDIS_STATUS_SUCCESS ?
STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
}
reactos/drivers/net/tcpip/include
diff -u -r1.20 -r1.21
--- ip.h 30 Nov 2004 00:10:41 -0000 1.20
+++ ip.h 14 Dec 2004 08:00:48 -0000 1.21
@@ -145,6 +145,7 @@
UINT HeaderSize; /* Size of link level header */
UINT MinFrameSize; /* Minimum frame size in bytes */
UINT MTU; /* Maximum transmission unit */
+ UINT Speed; /* Link speed */
IP_ADDRESS Unicast; /* Unicast address */
IP_ADDRESS PointToPoint; /* Point to point address */
IP_ADDRESS Netmask; /* Netmask */
@@ -180,7 +181,7 @@
/* Timeout timer constants */
#define IP_TICKS_SECOND 2 /* Two ticks per second */
#define IP_TIMEOUT (1000 / IP_TICKS_SECOND) /* Timeout in milliseconds */
-
+#define IP_DEFAULT_LINK_SPEED 10000
extern LIST_ENTRY InterfaceListHead;
extern KSPIN_LOCK InterfaceListLock;
reactos/drivers/net/tcpip/datalink
diff -u -r1.34 -r1.35
--- lan.c 13 Dec 2004 17:13:24 -0000 1.34
+++ lan.c 14 Dec 2004 08:00:48 -0000 1.35
@@ -279,9 +279,6 @@
ExInterlockedRemoveHeadList( &LanWorkList, &LanWorkLock )) ) {
WorkItem = CONTAINING_RECORD(ListEntry, LAN_WQ_ITEM, ListEntry);
- LanReceiveWorkerCalled++;
- ASSERT(LanReceiveWorkerCalled <= TransferDataCompleteCalled);
-
Packet = WorkItem->Packet;
Adapter = WorkItem->Adapter;
BytesTransferred = WorkItem->BytesTransferred;
@@ -330,37 +327,18 @@
}
}
-VOID STDCALL ProtocolTransferDataComplete(
+VOID LanSubmitReceiveWork(
NDIS_HANDLE BindingContext,
PNDIS_PACKET Packet,
NDIS_STATUS Status,
- UINT BytesTransferred)
-/*
- * FUNCTION: Called by NDIS to complete reception of data
- * ARGUMENTS:
- * BindingContext = Pointer to a device context (LAN_ADAPTER)
- * Packet = Pointer to a packet descriptor
- * Status = Status of the operation
- * BytesTransferred = Number of bytes transferred
- * NOTES:
- * If the packet was successfully received, determine the protocol
- * type and pass it to the correct receive handler
- */
-{
+ UINT BytesTransferred) {
BOOLEAN WorkStart;
PLAN_WQ_ITEM WQItem;
PLAN_ADAPTER Adapter = (PLAN_ADAPTER)BindingContext;
KIRQL OldIrql;
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
-
- if( Status != NDIS_STATUS_SUCCESS ) return;
TcpipAcquireSpinLock( &LanWorkLock, &OldIrql );
- TransferDataCompleteCalled++;
-
- ASSERT(TransferDataCompleteCalled <= TransferDataCalled);
-
WQItem = ExAllocatePool( NonPagedPool, sizeof(LAN_WQ_ITEM) );
if( !WQItem ) {
TcpipReleaseSpinLock( &LanWorkLock, OldIrql );
@@ -377,6 +355,33 @@
TcpipReleaseSpinLock( &LanWorkLock, OldIrql );
}
+VOID STDCALL ProtocolTransferDataComplete(
+ NDIS_HANDLE BindingContext,
+ PNDIS_PACKET Packet,
+ NDIS_STATUS Status,
+ UINT BytesTransferred)
+/*
+ * FUNCTION: Called by NDIS to complete reception of data
+ * ARGUMENTS:
+ * BindingContext = Pointer to a device context (LAN_ADAPTER)
+ * Packet = Pointer to a packet descriptor
+ * Status = Status of the operation
+ * BytesTransferred = Number of bytes transferred
+ * NOTES:
+ * If the packet was successfully received, determine the protocol
+ * type and pass it to the correct receive handler
+ */
+{
+ ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+
+ TransferDataCompleteCalled++;
+ ASSERT(TransferDataCompleteCalled <= TransferDataCalled);
+
+ if( Status != NDIS_STATUS_SUCCESS ) return;
+
+ LanSubmitReceiveWork( BindingContext, Packet, Status, BytesTransferred );
+}
+
NDIS_STATUS STDCALL ProtocolReceive(
NDIS_HANDLE BindingContext,
NDIS_HANDLE MacReceiveContext,
@@ -673,10 +678,14 @@
TI_DbgPrint(MID_TRACE, ("NdisSend Done\n"));
TcpipReleaseSpinLock( &Adapter->Lock, OldIrql );
+#if 0
if (NdisStatus != NDIS_STATUS_PENDING)
ProtocolSendComplete((NDIS_HANDLE)Context, NdisPacket, NdisStatus);
+#endif
} else {
+#if 0
ProtocolSendComplete((NDIS_HANDLE)Context, NdisPacket, NDIS_STATUS_CLOSED);
+#endif
}
}
@@ -935,6 +944,16 @@
1 );
}
+ /* Get maximum link speed */
+ NdisStatus = NDISCall(Adapter,
+ NdisRequestQueryInformation,
+ OID_GEN_LINK_SPEED,
+ &IF->Speed,
+ sizeof(UINT));
+
+ if( !NT_SUCCESS(NdisStatus) )
+ IF->Speed = IP_DEFAULT_LINK_SPEED;
+
/* Register interface with IP layer */
IPRegisterInterface(IF);
@@ -944,6 +963,7 @@
OID_GEN_CURRENT_PACKET_FILTER,
&Adapter->PacketFilter,
sizeof(UINT));
+
if (NdisStatus != NDIS_STATUS_SUCCESS) {
TI_DbgPrint(MID_TRACE, ("Could not set packet filter (0x%X).\n", NdisStatus));
IPDestroyInterface(IF);