Author: cgutman
Date: Wed Mar 18 02:29:28 2015
New Revision: 66777
URL:
http://svn.reactos.org/svn/reactos?rev=66777&view=rev
Log:
[TCPIP]
- Read the link state from the LAN_ADAPTER context to avoid having to block at DPC level
in the send path
Modified:
trunk/reactos/drivers/network/tcpip/include/interface.h
trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c
trunk/reactos/lib/drivers/ip/network/interface.c
Modified: trunk/reactos/drivers/network/tcpip/include/interface.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/include/interface.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/include/interface.h [iso-8859-1] Wed Mar 18
02:29:28 2015
@@ -10,7 +10,6 @@
NTSTATUS GetInterfaceSpeed( PIP_INTERFACE Interface, PUINT Speed );
NTSTATUS GetInterfaceName( PIP_INTERFACE Interface, PCHAR NameBuffer,
UINT NameMaxLen );
-NTSTATUS GetInterfaceConnectionStatus( PIP_INTERFACE Interface,
- PULONG OperStatus );
+VOID GetInterfaceConnectionStatus( PIP_INTERFACE Interface, PULONG OperStatus );
PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address);
PIP_INTERFACE GetDefaultInterface(VOID);
Modified: trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] Wed Mar 18 02:29:28
2015
@@ -51,11 +51,7 @@
OutData->if_physaddrlen = Interface->AddressLength;
OutData->if_adminstatus = MIB_IF_ADMIN_STATUS_UP;
/* NDIS_HARDWARE_STATUS -> ROUTER_CONNECTION_STATE */
- Status = GetInterfaceConnectionStatus( Interface, &OutData->if_operstatus );
-
- /* Not sure what to do here, but not ready seems a safe bet on failure */
- if( !NT_SUCCESS(Status) )
- OutData->if_operstatus = NdisHardwareStatusNotReady;
+ GetInterfaceConnectionStatus( Interface, &OutData->if_operstatus );
IFDescr = (PCHAR)&OutData->if_descr[0];
Modified: trunk/reactos/lib/drivers/ip/network/interface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/int…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/interface.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/interface.c [iso-8859-1] Wed Mar 18 02:29:28
2015
@@ -166,10 +166,12 @@
ForEachInterface(CurrentIF) {
if (CurrentIF->Context && AddrIsUnspecified(&CurrentIF->Unicast))
{
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
- if (NT_SUCCESS(GetInterfaceConnectionStatus(CurrentIF, &IfStatus))
&&
- (IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL)) {
+
+ GetInterfaceConnectionStatus(CurrentIF, &IfStatus);
+ if (IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL) {
return CurrentIF;
}
+
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
}
} EndFor(CurrentIF);
@@ -178,11 +180,13 @@
ForEachInterface(CurrentIF) {
if (CurrentIF->Context && (Index++ == NextDefaultAdapter)) {
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
- if (NT_SUCCESS(GetInterfaceConnectionStatus(CurrentIF, &IfStatus))
&&
- (IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL)) {
+
+ GetInterfaceConnectionStatus(CurrentIF, &IfStatus);
+ if (IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL) {
NextDefaultAdapter++;
return CurrentIF;
}
+
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
}
} EndFor(CurrentIF);
@@ -193,11 +197,13 @@
if (CurrentIF->Context) {
Index++;
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
- if (NT_SUCCESS(GetInterfaceConnectionStatus(CurrentIF, &IfStatus))
&&
- (IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL)) {
+
+ GetInterfaceConnectionStatus(CurrentIF, &IfStatus);
+ if (IfStatus == MIB_IF_OPER_STATUS_OPERATIONAL) {
NextDefaultAdapter = Index;
return CurrentIF;
}
+
TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql);
}
} EndFor(CurrentIF);
@@ -245,26 +251,15 @@
return NULL;
}
-NTSTATUS GetInterfaceConnectionStatus(PIP_INTERFACE Interface, PULONG Result)
-{
- NTSTATUS Status;
-
- /* Query OID_GEN_MEDIA_CONNECT_STATUS for connection status information */
- Status = TcpipLanGetDwordOid(Interface, OID_GEN_MEDIA_CONNECT_STATUS, Result);
- if (!NT_SUCCESS(Status))
- return Status;
-
- /* Translate the result into MIB_IF_OPER_STATUS_XXX */
- if (*Result == NdisMediaStateConnected)
- {
- /* Up and running */
+VOID GetInterfaceConnectionStatus(PIP_INTERFACE Interface, PULONG Result)
+{
+ PLAN_ADAPTER Adapter = Interface->Context;
+
+ /* Loopback has no adapter context */
+ if (Adapter == NULL || Adapter->State == LAN_STATE_STARTED) {
*Result = MIB_IF_OPER_STATUS_OPERATIONAL;
}
- else
- {
- /* Down */
+ else {
*Result = MIB_IF_OPER_STATUS_DISCONNECTED;
}
-
- return STATUS_SUCCESS;
-}
+}