12UINT32 mTcpTick = 1000;
122 if ((Tcb->LossTimes >=
TCP_FOLD_RTT) && (Tcb->SRtt != 0)) {
123 Tcb->RttVar += Tcb->SRtt >> 2;
150 "TcpConnectTimeout: connection closed because connection timer timeout for TCB %p\n",
154 if (EFI_ABORTED == Tcb->Sk->SockError) {
158 if (TCP_SYN_RCVD == Tcb->State) {
161 "TcpConnectTimeout: send reset because connection timer timeout for TCB %p\n",
187 "TcpRexmitTimeout: transmission timeout for TCB %p\n",
196 FlightSize = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
197 Tcb->Ssthresh =
MAX ((UINT32)(2 * Tcb->SndMss), FlightSize / 2);
199 Tcb->CWnd = Tcb->SndMss;
200 Tcb->LossRecover = Tcb->SndNxt;
203 if ((Tcb->LossTimes > Tcb->MaxRexmit) && !TCP_TIMER_ON (Tcb->EnabledTimer,
TCP_TIMER_CONNECT)) {
206 "TcpRexmitTimeout: connection closed because too many timeouts for TCB %p\n",
210 if (EFI_ABORTED == Tcb->Sk->SockError) {
246 Tcb->ProbeTimerOn =
FALSE;
265 Tcb->KeepAliveProbes++;
270 if (Tcb->KeepAliveProbes > Tcb->MaxKeepAlive) {
271 if (EFI_ABORTED == Tcb->Sk->SockError) {
296 "TcpFinwait2Timeout: connection closed because FIN_WAIT2 timer timeouts for TCB %p\n",
316 "Tcp2MSLTimeout: connection closed because TIME_WAIT timer timeouts for TCB %p\n",
341 Tcb->NextExpire = TCP_EXPIRE_TIME;
345 if (TCP_TIMER_ON (Tcb->EnabledTimer, Index) &&
346 TCP_TIME_LT (Tcb->Timer[Index], mTcpTick + Tcb->NextExpire)
349 Tcb->NextExpire = TCP_SUB_TIME (Tcb->Timer[Index], mTcpTick);
370 TCP_SET_TIMER (Tcb->EnabledTimer, Timer);
371 Tcb->Timer[Timer] = mTcpTick + TimeOut;
389 TCP_CLEAR_TIMER (Tcb->EnabledTimer, Timer);
404 Tcb->EnabledTimer = 0;
419 if (!Tcb->ProbeTimerOn) {
420 Tcb->ProbeTime = Tcb->Rto;
421 Tcb->ProbeTimerOn =
TRUE;
423 Tcb->ProbeTime <<= 1;
458 (Tcb->Idle < Tcb->KeepAliveIdle)
462 Tcb->KeepAliveProbes = 0;
490 for (Entry = mTcpRunQue.ForwardLink; Entry != &mTcpRunQue; Entry = Next) {
491 Next = Entry->ForwardLink;
493 Tcb = NET_LIST_USER_STRUCT (Entry,
TCP_CB, List);
512 if ((Tcb->
IpInfo->IpVersion == IP_VERSION_6) && (Tcb->
Tick > 0)) {
527 if (TCP_TIMER_ON (Tcb->
EnabledTimer, Index) && TCP_TIME_LEQ (Tcb->
Timer[Index], mTcpTick)) {
533 mTcpTimerHandler[Index](Tcb);
539 if ((Next->BackLink != Entry) || (Tcb->
EnabledTimer == 0)) {
EFI_STATUS EFIAPI QueueDpc(IN EFI_TPL DpcTpl, IN EFI_DPC_PROCEDURE DpcProcedure, IN VOID *DpcContext OPTIONAL)
#define DEBUG(Expression)
VOID EFIAPI NetbufFreeList(IN OUT LIST_ENTRY *Head)
#define SOCK_ERROR(Sock, Error)
INTN TcpRetransmit(IN TCP_CB *Tcb, IN TCP_SEQNO Seq)
INTN TcpToSendData(IN OUT TCP_CB *Tcb, IN INTN Force)
VOID TcpSetState(IN TCP_CB *Tcb, IN UINT8 State)
VOID(* TCP_TIMER_HANDLER)(IN OUT TCP_CB *Tcb)
VOID TcpResetConnection(IN TCP_CB *Tcb)
INTN TcpSendZeroProbe(IN OUT TCP_CB *Tcb)
VOID TcpSendAck(IN OUT TCP_CB *Tcb)
UINT32 TcpDataToSend(IN TCP_CB *Tcb, IN INTN Force)
#define TCP_CTRL_NO_KEEPALIVE
Disable keepalive timer.
#define TCP_TIMER_PROBE
Window probe timer.
#define TCP_CTRL_TIMER_ON
At least one of the timer is on.
#define TCP_TIMER_CONNECT
Connection establishment timer.
#define TCP_CONNECTED(state)
#define TCP_RTO_MIN
The minimum value of RTO.
#define TCP_TIMER_KEEPALIVE
Keepalive timer.
#define TCP_RTO_MAX
The maximum value of RTO.
#define TCP_TIMER_REXMIT
Retransmit timer.
#define TCP_TIMER_NUMBER
The total number of the TCP timer.
#define TCP_CTRL_RTT_ON
The RTT measurement is on.
#define TCP_FOLD_RTT
Timeout threshold to fold RTT.
#define TCP_CONGEST_LOSS
Retxmit because of retxmit time out.
VOID EFIAPI TcpTickingDpc(IN VOID *Context)
VOID EFIAPI TcpTicking(IN EFI_EVENT Event, IN VOID *Context)
VOID TcpClose(IN OUT TCP_CB *Tcb)
VOID TcpProbeTimeout(IN OUT TCP_CB *Tcb)
VOID TcpBackoffRto(IN OUT TCP_CB *Tcb)
VOID TcpClearTimer(IN OUT TCP_CB *Tcb, IN UINT16 Timer)
VOID TcpSetProbeTimer(IN OUT TCP_CB *Tcb)
VOID TcpSetTimer(IN OUT TCP_CB *Tcb, IN UINT16 Timer, IN UINT32 TimeOut)
VOID TcpRexmitTimeout(IN OUT TCP_CB *Tcb)
VOID Tcp2MSLTimeout(IN OUT TCP_CB *Tcb)
VOID TcpConnectTimeout(IN OUT TCP_CB *Tcb)
VOID TcpUpdateTimer(IN OUT TCP_CB *Tcb)
VOID TcpKeepaliveTimeout(IN OUT TCP_CB *Tcb)
VOID TcpClearAllTimer(IN OUT TCP_CB *Tcb)
VOID TcpFinwait2Timeout(IN OUT TCP_CB *Tcb)
VOID TcpSetKeepaliveTimer(IN OUT TCP_CB *Tcb)
UINT32 Tick
1 tick = 200ms
UINT32 RttMeasure
Currently measured RTT in heartbeats.
UINT8 DelayedAck
Number of delayed ACKs.
INT32 NextExpire
Countdown offset for the nearest timer.
UINT32 Timer[TCP_TIMER_NUMBER]
When the timer will expire.
UINT16 EnabledTimer
Which timer is currently enabled.
UINT32 Idle
How long the connection is in idle.
UINT8 State
TCP state, such as SYN_SENT, LISTEN.
IP_IO_IP_INFO * IpInfo
Pointer reference to Ip used to send pkt.
UINT32 CtrlFlag
Control flags, such as NO_NAGLE.