X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=MdeModulePkg%2FUniversal%2FNetwork%2FTcp4Dxe%2FTcp4Timer.c;h=a8e4a933cfd62452c5a1865bde03ca7ab872c7cd;hb=ac8cca2a4dd777970811fb727c396e2585c2bba1;hp=65c98de048fff4379efe92a91def6874dc4d3402;hpb=120db52c6db13e1726be90fddedd842190566a6e;p=mirror_edk2.git
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Timer.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Timer.c
index 65c98de048..a8e4a933cf 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Timer.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Timer.c
@@ -1,23 +1,15 @@
/** @file
-
-Copyright (c) 2005 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
+ TCP timer related functions.
+
+Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.
+This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
+http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-Module Name:
-
- Tcp4Timer.c
-
-Abstract:
-
- TCP timer related functions.
-
-
**/
#include "Tcp4Main.h"
@@ -32,7 +24,7 @@ UINT32 mTcpTick = 1000;
**/
VOID
TcpConnectTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
);
/**
@@ -43,7 +35,7 @@ TcpConnectTimeout (
**/
VOID
TcpRexmitTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
);
/**
@@ -54,7 +46,7 @@ TcpRexmitTimeout (
**/
VOID
TcpProbeTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
);
/**
@@ -65,7 +57,7 @@ TcpProbeTimeout (
**/
VOID
TcpKeepaliveTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
);
/**
@@ -76,7 +68,7 @@ TcpKeepaliveTimeout (
**/
VOID
TcpFinwait2Timeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
);
/**
@@ -87,7 +79,7 @@ TcpFinwait2Timeout (
**/
VOID
Tcp2MSLTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
);
TCP_TIMER_HANDLER mTcpTimerHandler[TCP_TIMER_NUMBER] = {
@@ -107,7 +99,7 @@ TCP_TIMER_HANDLER mTcpTimerHandler[TCP_TIMER_NUMBER] = {
**/
VOID
TcpClose (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
NetbufFreeList (&Tcb->SndQue);
@@ -125,7 +117,7 @@ TcpClose (
**/
VOID
TcpConnectTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
if (!TCP_CONNECTED (Tcb->State)) {
@@ -157,7 +149,7 @@ TcpConnectTimeout (
**/
VOID
TcpRexmitTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
UINT32 FlightSize;
@@ -208,7 +200,7 @@ TcpRexmitTimeout (
**/
VOID
TcpProbeTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
//
@@ -219,7 +211,8 @@ TcpProbeTimeout (
//
if ((TcpDataToSend (Tcb, 1) != 0) && (TcpToSendData (Tcb, 1) > 0)) {
- ASSERT (TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT));
+ ASSERT (TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT) != 0);
+ Tcb->ProbeTimerOn = FALSE;
return ;
}
@@ -236,7 +229,7 @@ TcpProbeTimeout (
**/
VOID
TcpKeepaliveTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
Tcb->KeepAliveProbes++;
@@ -267,7 +260,7 @@ TcpKeepaliveTimeout (
**/
VOID
TcpFinwait2Timeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
DEBUG ((EFI_D_WARN, "TcpFinwait2Timeout: connection closed "
@@ -285,7 +278,7 @@ TcpFinwait2Timeout (
**/
VOID
Tcp2MSLTimeout (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
DEBUG ((EFI_D_WARN, "Tcp2MSLTimeout: connection closed "
@@ -304,7 +297,7 @@ Tcp2MSLTimeout (
**/
VOID
TcpUpdateTimer (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
UINT16 Index;
@@ -338,9 +331,9 @@ TcpUpdateTimer (
**/
VOID
TcpSetTimer (
- IN TCP_CB *Tcb,
- IN UINT16 Timer,
- IN UINT32 TimeOut
+ IN OUT TCP_CB *Tcb,
+ IN UINT16 Timer,
+ IN UINT32 TimeOut
)
{
TCP_SET_TIMER (Tcb->EnabledTimer, Timer);
@@ -359,8 +352,8 @@ TcpSetTimer (
**/
VOID
TcpClearTimer (
- IN TCP_CB *Tcb,
- IN UINT16 Timer
+ IN OUT TCP_CB *Tcb,
+ IN UINT16 Timer
)
{
TCP_CLEAR_TIMER (Tcb->EnabledTimer, Timer);
@@ -376,7 +369,7 @@ TcpClearTimer (
**/
VOID
TcpClearAllTimer (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
Tcb->EnabledTimer = 0;
@@ -392,11 +385,12 @@ TcpClearAllTimer (
**/
VOID
TcpSetProbeTimer (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
- if (!TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_PROBE)) {
- Tcb->ProbeTime = Tcb->Rto;
+ if (!Tcb->ProbeTimerOn) {
+ Tcb->ProbeTime = Tcb->Rto;
+ Tcb->ProbeTimerOn = TRUE;
} else {
Tcb->ProbeTime <<= 1;
@@ -422,7 +416,7 @@ TcpSetProbeTimer (
**/
VOID
TcpSetKeepaliveTimer (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_KEEPALIVE)) {
@@ -458,7 +452,7 @@ TcpSetKeepaliveTimer (
**/
VOID
TcpBackoffRto (
- IN TCP_CB *Tcb
+ IN OUT TCP_CB *Tcb
)
{
//
@@ -557,15 +551,17 @@ TcpTickingDpc (
//
if ((Next->BackLink != Entry) ||
(Tcb->EnabledTimer == 0)) {
-
- goto NextConnection;
+ break;
}
}
}
-
- TcpUpdateTimer (Tcb);
-NextConnection:
- ;
+
+ //
+ // If the Tcb still exist or some timer is set, update the timer
+ //
+ if (Index == TCP_TIMER_NUMBER) {
+ TcpUpdateTimer (Tcb);
+ }
}
}
@@ -583,6 +579,6 @@ TcpTicking (
IN VOID *Context
)
{
- NetLibQueueDpc (TPL_CALLBACK, TcpTickingDpc, Context);
+ QueueDpc (TPL_CALLBACK, TcpTickingDpc, Context);
}