/** @file\r
-\r
-Copyright (c) 2005 - 2007, Intel Corporation\r
+ TCP timer related functions.\r
+ \r
+Copyright (c) 2005 - 2007, Intel Corporation<BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+http://opensource.org/licenses/bsd-license.php<BR>\r
\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- Tcp4Timer.c\r
-\r
-Abstract:\r
-\r
- TCP timer related functions.\r
-\r
-\r
**/\r
\r
#include "Tcp4Main.h"\r
\r
UINT32 mTcpTick = 1000;\r
\r
-STATIC\r
+/**\r
+ Connect timeout handler.\r
+\r
+ @param Tcb Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
VOID\r
TcpConnectTimeout (\r
IN TCP_CB *Tcb\r
);\r
\r
-STATIC\r
+/**\r
+ Timeout handler for TCP retransmission timer.\r
+\r
+ @param Tcb Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
VOID\r
TcpRexmitTimeout (\r
IN TCP_CB *Tcb\r
);\r
+ \r
+/**\r
+ Timeout handler for window probe timer.\r
+\r
+ @param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
-STATIC\r
+**/\r
VOID\r
TcpProbeTimeout (\r
IN TCP_CB *Tcb\r
);\r
\r
-STATIC\r
+/**\r
+ Timeout handler for keepalive timer.\r
+\r
+ @param Tcb Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
VOID\r
TcpKeepaliveTimeout (\r
IN TCP_CB *Tcb\r
);\r
\r
-STATIC\r
+/**\r
+ Timeout handler for FIN_WAIT_2 timer.\r
+\r
+ @param Tcb Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
VOID\r
TcpFinwait2Timeout (\r
IN TCP_CB *Tcb\r
);\r
\r
-STATIC\r
+/**\r
+ Timeout handler for 2MSL timer.\r
+\r
+ @param Tcb Pointer to the TCP_CB of this TCP instance.\r
+\r
+**/\r
VOID\r
Tcp2MSLTimeout (\r
IN TCP_CB *Tcb\r
Tcp2MSLTimeout,\r
};\r
\r
-\r
/**\r
Close the TCP connection.\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
TcpClose (\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
-STATIC\r
VOID\r
TcpConnectTimeout (\r
IN TCP_CB *Tcb\r
)\r
{\r
if (!TCP_CONNECTED (Tcb->State)) {\r
- TCP4_DEBUG_ERROR (("TcpConnectTimeout: connection closed "\r
- "because conenction timer timeout for TCB %x\n", Tcb));\r
+ DEBUG ((EFI_D_ERROR, "TcpConnectTimeout: connection closed "\r
+ "because conenction timer timeout for TCB %p\n", Tcb));\r
\r
if (EFI_ABORTED == Tcb->Sk->SockError) {\r
SOCK_ERROR (Tcb->Sk, EFI_TIMEOUT);\r
}\r
\r
if (TCP_SYN_RCVD == Tcb->State) {\r
- TCP4_DEBUG_WARN (("TcpConnectTimeout: send reset because "\r
- "connection timer timeout for TCB %x\n", Tcb));\r
+ DEBUG ((EFI_D_WARN, "TcpConnectTimeout: send reset because "\r
+ "connection timer timeout for TCB %p\n", Tcb));\r
\r
TcpResetConnection (Tcb);\r
\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
-STATIC\r
VOID\r
TcpRexmitTimeout (\r
IN TCP_CB *Tcb\r
{\r
UINT32 FlightSize;\r
\r
- TCP4_DEBUG_WARN (("TcpRexmitTimeout: transmission "\r
- "timeout for TCB %x\n", Tcb));\r
+ DEBUG ((EFI_D_WARN, "TcpRexmitTimeout: transmission "\r
+ "timeout for TCB %p\n", Tcb));\r
\r
//\r
// Set the congestion window. FlightSize is the\r
Tcb->LossRecover = Tcb->SndNxt;\r
\r
Tcb->LossTimes++;\r
- if (Tcb->LossTimes > Tcb->MaxRexmit &&\r
+ if ((Tcb->LossTimes > Tcb->MaxRexmit) &&\r
!TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_CONNECT)) {\r
\r
- TCP4_DEBUG_ERROR (("TcpRexmitTimeout: connection closed "\r
- "because too many timeouts for TCB %x\n", Tcb));\r
+ DEBUG ((EFI_D_ERROR, "TcpRexmitTimeout: connection closed "\r
+ "because too many timeouts for TCB %p\n", Tcb));\r
\r
if (EFI_ABORTED == Tcb->Sk->SockError) {\r
SOCK_ERROR (Tcb->Sk, EFI_TIMEOUT);\r
TcpSetTimer (Tcb, TCP_TIMER_REXMIT, Tcb->Rto);\r
\r
Tcb->CongestState = TCP_CONGEST_LOSS;\r
-\r
TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_RTT_ON);\r
}\r
\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
-STATIC\r
VOID\r
TcpProbeTimeout (\r
IN TCP_CB *Tcb\r
//\r
if ((TcpDataToSend (Tcb, 1) != 0) && (TcpToSendData (Tcb, 1) > 0)) {\r
\r
- ASSERT (TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT));\r
+ ASSERT (TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT) != 0);\r
return ;\r
}\r
\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
-STATIC\r
VOID\r
TcpKeepaliveTimeout (\r
IN TCP_CB *Tcb\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
-STATIC\r
VOID\r
TcpFinwait2Timeout (\r
IN TCP_CB *Tcb\r
)\r
{\r
- TCP4_DEBUG_WARN (("TcpFinwait2Timeout: connection closed "\r
- "because FIN_WAIT2 timer timeouts for TCB %x\n", Tcb));\r
+ DEBUG ((EFI_D_WARN, "TcpFinwait2Timeout: connection closed "\r
+ "because FIN_WAIT2 timer timeouts for TCB %p\n", Tcb));\r
\r
TcpClose (Tcb);\r
}\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
-STATIC\r
VOID\r
Tcp2MSLTimeout (\r
IN TCP_CB *Tcb\r
)\r
{\r
- TCP4_DEBUG_WARN (("Tcp2MSLTimeout: connection closed "\r
- "because TIME_WAIT timer timeouts for TCB %x\n", Tcb));\r
+ DEBUG ((EFI_D_WARN, "Tcp2MSLTimeout: connection closed "\r
+ "because TIME_WAIT timer timeouts for TCB %p\n", Tcb));\r
\r
TcpClose (Tcb);\r
}\r
\r
\r
/**\r
- Update the timer status and the next expire time\r
- according to the timers to expire in a specific\r
- future time slot.\r
+ Update the timer status and the next expire time according to the timers \r
+ to expire in a specific future time slot.\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
-STATIC\r
VOID\r
TcpUpdateTimer (\r
IN TCP_CB *Tcb\r
@param Timer The index of the timer to be enabled.\r
@param TimeOut The timeout value of this timer.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
TcpSetTimer (\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
@param Timer The index of the timer to be cleared.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
TcpClearTimer (\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
TcpClearAllTimer (\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
TcpSetProbeTimer (\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
TcpSetKeepaliveTimer (\r
\r
@param Tcb Pointer to the TCP_CB of this TCP instance.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
TcpBackoffRto (\r
// may be wrong, fold it. So the next time a valid\r
// measurement is sampled, we can start fresh.\r
//\r
- if ((Tcb->LossTimes >= TCP_FOLD_RTT) && Tcb->SRtt) {\r
+ if ((Tcb->LossTimes >= TCP_FOLD_RTT) && (Tcb->SRtt != 0)) {\r
Tcb->RttVar += Tcb->SRtt >> 2;\r
Tcb->SRtt = 0;\r
}\r
/**\r
Heart beat timer handler.\r
\r
- @param Context Context of the timer event, ignored.\r
-\r
- @return None.\r
+ @param Context Context of the timer event, ignored.\r
\r
**/\r
VOID\r
IN VOID *Context\r
)\r
{\r
- NET_LIST_ENTRY *Entry;\r
- NET_LIST_ENTRY *Next;\r
+ LIST_ENTRY *Entry;\r
+ LIST_ENTRY *Next;\r
TCP_CB *Tcb;\r
INT16 Index;\r
\r
\r
Tcb->Idle++;\r
\r
- if (Tcb->DelayedAck) {\r
+ if (Tcb->DelayedAck != 0) {\r
TcpSendAck (Tcb);\r
}\r
\r
@param Event Timer event signaled, ignored.\r
@param Context Context of the timer event, ignored.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
EFIAPI\r