Fix some grammar and converge formatting of the two versions of TcpInput.c

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17186 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
BALATON Zoltan 2015-04-17 02:25:05 +00:00 committed by sfu5
parent ed6fde4113
commit 49789216fa
2 changed files with 70 additions and 53 deletions

View File

@ -1,7 +1,7 @@
/** @file
TCP input process routines.
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
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
@ -61,7 +61,7 @@ TcpFastRecover (
//
// Step 1A: Invoking fast retransmission.
//
FlightSize = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
FlightSize = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
Tcb->Ssthresh = MAX (FlightSize >> 1, (UINT32) (2 * Tcb->SndMss));
Tcb->Recover = Tcb->SndNxt;
@ -109,7 +109,7 @@ TcpFastRecover (
// Step 5 - Full ACK:
// deflate the congestion window, and exit fast recovery
//
FlightSize = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
FlightSize = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
Tcb->CWnd = MIN (Tcb->Ssthresh, FlightSize + Tcb->SndMss);
@ -556,15 +556,15 @@ TcpQueueData (
if (IsListEmpty (Head)) {
InsertTailList (Head, &Nbuf->List);
return ;
return;
}
//
// Find the point to insert the buffer
//
for (Prev = Head, Cur = Head->ForwardLink;
Cur != Head;
Prev = Cur, Cur = Cur->ForwardLink) {
Cur != Head;
Prev = Cur, Cur = Cur->ForwardLink) {
Node = NET_LIST_USER_STRUCT (Cur, NET_BUF, List);
@ -585,7 +585,7 @@ TcpQueueData (
if (TCP_SEQ_LEQ (Seg->End, TCPSEG_NETBUF (Node)->End)) {
NetbufFree (Nbuf);
return ;
return;
}
TcpTrimSegment (Nbuf, TCPSEG_NETBUF (Node)->End, Seg->End);
@ -737,7 +737,7 @@ TcpInput (
);
if ((Tcb == NULL) || (Tcb->State == TCP_CLOSED)) {
DEBUG ((EFI_D_INFO, "TcpInput: send reset because no TCB find\n"));
DEBUG ((EFI_D_INFO, "TcpInput: send reset because no TCB found\n"));
Tcb = NULL;
goto SEND_RESET;
@ -751,7 +751,7 @@ TcpInput (
//
if (TcpParseOption (Nbuf->Tcp, &Option) == -1) {
DEBUG ((EFI_D_ERROR, "TcpInput: reset the peer because"
" of mal-format option for Tcb %p\n", Tcb));
" of malformed option for TCB %p\n", Tcb));
goto SEND_RESET;
}
@ -799,7 +799,7 @@ TcpInput (
Tcb = TcpCloneTcb (Parent);
if (Tcb == NULL) {
DEBUG ((EFI_D_ERROR, "TcpInput: discard a segment because"
" failed to clone a child for TCB%x\n", Tcb));
" failed to clone a child for TCB %p\n", Tcb));
goto DISCARD;
}
@ -865,7 +865,7 @@ TcpInput (
//
//
// Fourth step: Check SYN. Pay attention to sitimulatous open
// Fourth step: Check SYN. Pay attention to simultaneous open
//
if (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN)) {
@ -902,7 +902,7 @@ TcpInput (
goto StepSix;
} else {
//
// Received a SYN segment without ACK, simultanous open.
// Received a SYN segment without ACK, simultaneous open.
//
TcpSetState (Tcb, TCP_SYN_RCVD);
@ -911,7 +911,7 @@ TcpInput (
TcpTrimInWnd (Tcb, Nbuf);
DEBUG ((EFI_D_WARN, "TcpInput: simultanous open "
DEBUG ((EFI_D_WARN, "TcpInput: simultaneous open "
"for TCB %p in SYN_SENT\n", Tcb));
goto StepSix;
@ -1290,7 +1290,8 @@ StepSix:
TcpSetKeepaliveTimer (Tcb);
if (TCP_FLG_ON (Seg->Flag, TCP_FLG_URG) &&
!TCP_FIN_RCVD (Tcb->State)) {
!TCP_FIN_RCVD (Tcb->State))
{
DEBUG ((EFI_D_INFO, "TcpInput: received urgent data "
"from peer for connected TCB %p\n", Tcb));

View File

@ -1,7 +1,7 @@
/** @file
TCP input process routines.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@ -531,8 +531,8 @@ TcpDeliverData (
Urgent = 0;
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_URG) &&
TCP_SEQ_LEQ (Seg->Seq, Tcb->RcvUp)
) {
TCP_SEQ_LEQ (Seg->Seq, Tcb->RcvUp))
{
if (TCP_SEQ_LEQ (Seg->End, Tcb->RcvUp)) {
Urgent = Nbuf->TotalSize;
@ -596,8 +596,7 @@ TcpQueueData (
//
for (Prev = Head, Cur = Head->ForwardLink;
Cur != Head;
Prev = Cur, Cur = Cur->ForwardLink
) {
Prev = Cur, Cur = Cur->ForwardLink) {
Node = NET_LIST_USER_STRUCT (Cur, NET_BUF, List);
@ -753,7 +752,7 @@ TcpInput (
if ((Head->HeadLen < 5) || (Len < 0)) {
DEBUG ((EFI_D_INFO, "TcpInput: received an mal-formated packet\n"));
DEBUG ((EFI_D_INFO, "TcpInput: received a malformed packet\n"));
goto DISCARD;
}
@ -788,7 +787,7 @@ TcpInput (
);
if ((Tcb == NULL) || (Tcb->State == TCP_CLOSED)) {
DEBUG ((EFI_D_INFO, "TcpInput: send reset because no TCB find\n"));
DEBUG ((EFI_D_INFO, "TcpInput: send reset because no TCB found\n"));
Tcb = NULL;
goto SEND_RESET;
@ -803,7 +802,7 @@ TcpInput (
if (TcpParseOption (Nbuf->Tcp, &Option) == -1) {
DEBUG (
(EFI_D_ERROR,
"TcpInput: reset the peer because of mal-format option for Tcb %p\n",
"TcpInput: reset the peer because of malformed option for TCB %p\n",
Tcb)
);
@ -860,7 +859,7 @@ TcpInput (
if (Tcb == NULL) {
DEBUG (
(EFI_D_ERROR,
"TcpInput: discard a segment because failed to clone a child for TCB%p\n",
"TcpInput: discard a segment because failed to clone a child for TCB %p\n",
Tcb)
);
@ -940,7 +939,7 @@ TcpInput (
//
//
// Fourth step: Check SYN. Pay attention to sitimulatous open
// Fourth step: Check SYN. Pay attention to simultaneous open
//
if (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN)) {
@ -961,8 +960,8 @@ TcpInput (
TcpDeliverData (Tcb);
if ((Tcb->CongestState == TCP_CONGEST_OPEN) &&
TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RTT_ON)
) {
TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RTT_ON))
{
TcpComputeRtt (Tcb, Tcb->RttMeasure);
TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_RTT_ON);
@ -992,7 +991,7 @@ TcpInput (
DEBUG (
(EFI_D_WARN,
"TcpInput: simultanous open for TCB %p in SYN_SENT\n",
"TcpInput: simultaneous open for TCB %p in SYN_SENT\n",
Tcb)
);
@ -1034,8 +1033,8 @@ TcpInput (
if ((TCP_SEQ_LT (Seg->Seq, Tcb->RcvWl2)) &&
(Tcb->RcvWl2 == Seg->End) &&
!TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN | TCP_FLG_FIN)
) {
!TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN | TCP_FLG_FIN))
{
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW);
}
@ -1058,10 +1057,10 @@ TcpInput (
// if it comes from a LISTEN TCB.
//
} else if ((Tcb->State == TCP_ESTABLISHED) ||
(Tcb->State == TCP_FIN_WAIT_1) ||
(Tcb->State == TCP_FIN_WAIT_2) ||
(Tcb->State == TCP_CLOSE_WAIT)
) {
(Tcb->State == TCP_FIN_WAIT_1) ||
(Tcb->State == TCP_FIN_WAIT_2) ||
(Tcb->State == TCP_CLOSE_WAIT))
{
SOCK_ERROR (Tcb->Sk, EFI_CONNECTION_RESET);
@ -1114,7 +1113,9 @@ TcpInput (
if (Tcb->State == TCP_SYN_RCVD) {
if (TCP_SEQ_LT (Tcb->SndUna, Seg->Ack) && TCP_SEQ_LEQ (Seg->Ack, Tcb->SndNxt)) {
if (TCP_SEQ_LT (Tcb->SndUna, Seg->Ack) &&
TCP_SEQ_LEQ (Seg->Ack, Tcb->SndNxt))
{
Tcb->SndWnd = Seg->Wnd;
Tcb->SndWndMax = MAX (Tcb->SndWnd, Tcb->SndWndMax);
@ -1127,7 +1128,7 @@ TcpInput (
DEBUG (
(EFI_D_INFO,
"TcpInput: connection established for TCB %p in SYN_RCVD\n",
"TcpInput: connection established for TCB %p in SYN_RCVD\n",
Tcb)
);
@ -1176,7 +1177,9 @@ TcpInput (
// RcvWl2 equals to the variable "LastAckSent"
// defined there.
//
if (TCP_SEQ_LEQ (Seg->Seq, Tcb->RcvWl2) && TCP_SEQ_LT (Tcb->RcvWl2, Seg->End)) {
if (TCP_SEQ_LEQ (Seg->Seq, Tcb->RcvWl2) &&
TCP_SEQ_LT (Tcb->RcvWl2, Seg->End))
{
Tcb->TsRecent = Option.TSVal;
Tcb->TsRecentAge = mTcpTick;
@ -1206,8 +1209,8 @@ TcpInput (
if ((Seg->Ack == Tcb->SndUna) &&
(Tcb->SndUna != Tcb->SndNxt) &&
(Seg->Wnd == Tcb->SndWnd) &&
(0 == Len)
) {
(0 == Len))
{
Tcb->DupAck++;
} else {
@ -1219,8 +1222,8 @@ TcpInput (
// Congestion avoidance, fast recovery and fast retransmission.
//
if (((Tcb->CongestState == TCP_CONGEST_OPEN) && (Tcb->DupAck < 3)) ||
(Tcb->CongestState == TCP_CONGEST_LOSS)
) {
(Tcb->CongestState == TCP_CONGEST_LOSS))
{
if (TCP_SEQ_GT (Seg->Ack, Tcb->SndUna)) {
@ -1249,8 +1252,8 @@ TcpInput (
Tcb->SndUna = Seg->Ack;
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_SND_URG) &&
TCP_SEQ_LT (Tcb->SndUp, Seg->Ack)
) {
TCP_SEQ_LT (Tcb->SndUp, Seg->Ack))
{
TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_URG);
}
@ -1260,8 +1263,8 @@ TcpInput (
// Update window info
//
if (TCP_SEQ_LT (Tcb->SndWl1, Seg->Seq) ||
((Tcb->SndWl1 == Seg->Seq) && TCP_SEQ_LEQ (Tcb->SndWl2, Seg->Ack))
) {
((Tcb->SndWl1 == Seg->Seq) && TCP_SEQ_LEQ (Tcb->SndWl2, Seg->Ack)))
{
Right = Seg->Ack + Seg->Wnd;
@ -1269,8 +1272,8 @@ TcpInput (
if ((Tcb->SndWl1 == Seg->Seq) &&
(Tcb->SndWl2 == Seg->Ack) &&
(Len == 0)
) {
(Len == 0))
{
goto NO_UPDATE;
}
@ -1281,12 +1284,16 @@ TcpInput (
Tcb)
);
if ((Tcb->CongestState == TCP_CONGEST_RECOVER) && (TCP_SEQ_LT (Right, Tcb->Recover))) {
if ((Tcb->CongestState == TCP_CONGEST_RECOVER) &&
(TCP_SEQ_LT (Right, Tcb->Recover)))
{
Tcb->Recover = Right;
}
if ((Tcb->CongestState == TCP_CONGEST_LOSS) && (TCP_SEQ_LT (Right, Tcb->LossRecover))) {
if ((Tcb->CongestState == TCP_CONGEST_LOSS) &&
(TCP_SEQ_LT (Right, Tcb->LossRecover)))
{
Tcb->LossRecover = Right;
}
@ -1311,7 +1318,9 @@ TcpInput (
NO_UPDATE:
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT) && (Tcb->SndUna == Tcb->SndNxt)) {
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT) &&
(Tcb->SndUna == Tcb->SndNxt))
{
DEBUG (
(EFI_D_INFO,
@ -1417,7 +1426,9 @@ StepSix:
Urg = Seg->Seq + Seg->Urg;
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_URG) && TCP_SEQ_GT (Urg, Tcb->RcvUp)) {
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_URG) &&
TCP_SEQ_GT (Urg, Tcb->RcvUp))
{
Tcb->RcvUp = Urg;
} else {
@ -1480,8 +1491,8 @@ StepSix:
if ((Tcb->State != TCP_CLOSED) &&
(TcpToSendData (Tcb, 0) == 0) &&
(TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW) || (Nbuf->TotalSize != 0))
) {
(TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW) || (Nbuf->TotalSize != 0)))
{
TcpToSendAck (Tcb);
}
@ -1574,7 +1585,12 @@ TcpIcmpInput (
goto CLEAN_EXIT;
}
IcmpErrStatus = IpIoGetIcmpErrStatus (IcmpErr, Tcb->Sk->IpVersion, &IcmpErrIsHard, &IcmpErrNotify);
IcmpErrStatus = IpIoGetIcmpErrStatus (
IcmpErr,
Tcb->Sk->IpVersion,
&IcmpErrIsHard,
&IcmpErrNotify
);
if (IcmpErrNotify) {