]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Dhcp4Dxe/Dhcp4Io.c
NetworkPkg: Apply uncrustify changes
[mirror_edk2.git] / NetworkPkg / Dhcp4Dxe / Dhcp4Io.c
index f073eed58a18f93722d29178c76ab1d860f1fcc8..238e186c5b917b1a39b18a936d1e6e15879aa57c 100644 (file)
@@ -6,12 +6,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 \r
 **/\r
 \r
-\r
 #include "Dhcp4Impl.h"\r
 \r
 UINT32  mDhcp4DefaultTimeout[4] = { 4, 8, 16, 32 };\r
 \r
-\r
 /**\r
   Send an initial DISCOVER or REQUEST message according to the\r
   DHCP service's current state.\r
@@ -24,17 +22,17 @@ UINT32  mDhcp4DefaultTimeout[4] = { 4, 8, 16, 32 };
 **/\r
 EFI_STATUS\r
 DhcpInitRequest (\r
-  IN DHCP_SERVICE           *DhcpSb\r
+  IN DHCP_SERVICE  *DhcpSb\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
+  EFI_STATUS  Status;\r
 \r
   ASSERT ((DhcpSb->DhcpState == Dhcp4Init) || (DhcpSb->DhcpState == Dhcp4InitReboot));\r
 \r
   //\r
   // Clear initial time to make sure that elapsed-time is set to 0 for first Discover or REQUEST message.\r
   //\r
-  DhcpSb->ActiveChild->ElaspedTime= 0;\r
+  DhcpSb->ActiveChild->ElaspedTime = 0;\r
 \r
   if (DhcpSb->DhcpState == Dhcp4Init) {\r
     DhcpSetState (DhcpSb, Dhcp4Selecting, FALSE);\r
@@ -57,7 +55,6 @@ DhcpInitRequest (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Call user provided callback function, and return the value the\r
   function returns. If the user doesn't provide a callback, a\r
@@ -76,14 +73,14 @@ DhcpInitRequest (
 **/\r
 EFI_STATUS\r
 DhcpCallUser (\r
-  IN  DHCP_SERVICE          *DhcpSb,\r
-  IN  EFI_DHCP4_EVENT       Event,\r
-  IN  EFI_DHCP4_PACKET      *Packet       OPTIONAL,\r
-  OUT EFI_DHCP4_PACKET      **NewPacket   OPTIONAL\r
+  IN  DHCP_SERVICE      *DhcpSb,\r
+  IN  EFI_DHCP4_EVENT   Event,\r
+  IN  EFI_DHCP4_PACKET  *Packet       OPTIONAL,\r
+  OUT EFI_DHCP4_PACKET  **NewPacket   OPTIONAL\r
   )\r
 {\r
-  EFI_DHCP4_CONFIG_DATA     *Config;\r
-  EFI_STATUS                Status;\r
+  EFI_DHCP4_CONFIG_DATA  *Config;\r
+  EFI_STATUS             Status;\r
 \r
   if (NewPacket != NULL) {\r
     *NewPacket = NULL;\r
@@ -109,7 +106,7 @@ DhcpCallUser (
   Status = Config->Dhcp4Callback (\r
                      &DhcpSb->ActiveChild->Dhcp4Protocol,\r
                      Config->CallbackContext,\r
-                     (EFI_DHCP4_STATE) DhcpSb->DhcpState,\r
+                     (EFI_DHCP4_STATE)DhcpSb->DhcpState,\r
                      Event,\r
                      Packet,\r
                      NewPacket\r
@@ -127,7 +124,6 @@ DhcpCallUser (
   return EFI_ABORTED;\r
 }\r
 \r
-\r
 /**\r
   Notify the user about the operation result.\r
 \r
@@ -137,35 +133,33 @@ DhcpCallUser (
 **/\r
 VOID\r
 DhcpNotifyUser (\r
-  IN DHCP_SERVICE           *DhcpSb,\r
-  IN INTN                   Which\r
+  IN DHCP_SERVICE  *DhcpSb,\r
+  IN INTN          Which\r
   )\r
 {\r
-  DHCP_PROTOCOL             *Child;\r
+  DHCP_PROTOCOL  *Child;\r
 \r
   if ((Child = DhcpSb->ActiveChild) == NULL) {\r
-    return ;\r
+    return;\r
   }\r
 \r
   if ((Child->CompletionEvent != NULL) &&\r
       ((Which == DHCP_NOTIFY_COMPLETION) || (Which == DHCP_NOTIFY_ALL))\r
-      ) {\r
-\r
+      )\r
+  {\r
     gBS->SignalEvent (Child->CompletionEvent);\r
     Child->CompletionEvent = NULL;\r
   }\r
 \r
   if ((Child->RenewRebindEvent != NULL) &&\r
       ((Which == DHCP_NOTIFY_RENEWREBIND) || (Which == DHCP_NOTIFY_ALL))\r
-      ) {\r
-\r
+      )\r
+  {\r
     gBS->SignalEvent (Child->RenewRebindEvent);\r
     Child->RenewRebindEvent = NULL;\r
   }\r
 }\r
 \r
-\r
-\r
 /**\r
   Set the DHCP state. If CallUser is true, it will try to notify\r
   the user before change the state by DhcpNotifyUser. It returns\r
@@ -183,25 +177,22 @@ DhcpNotifyUser (
 **/\r
 EFI_STATUS\r
 DhcpSetState (\r
-  IN OUT DHCP_SERVICE           *DhcpSb,\r
-  IN     INTN                   State,\r
-  IN     BOOLEAN                CallUser\r
+  IN OUT DHCP_SERVICE  *DhcpSb,\r
+  IN     INTN          State,\r
+  IN     BOOLEAN       CallUser\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
+  EFI_STATUS  Status;\r
 \r
   if (CallUser) {\r
     Status = EFI_SUCCESS;\r
 \r
     if (State == Dhcp4Renewing) {\r
       Status = DhcpCallUser (DhcpSb, Dhcp4EnterRenewing, NULL, NULL);\r
-\r
     } else if (State == Dhcp4Rebinding) {\r
       Status = DhcpCallUser (DhcpSb, Dhcp4EnterRebinding, NULL, NULL);\r
-\r
     } else if (State == Dhcp4Bound) {\r
       Status = DhcpCallUser (DhcpSb, Dhcp4BoundCompleted, NULL, NULL);\r
-\r
     }\r
 \r
     if (EFI_ERROR (Status)) {\r
@@ -224,14 +215,13 @@ DhcpSetState (
     DhcpSb->MaxRetries = 4;\r
   }\r
 \r
-  DhcpSb->CurRetry      = 0;\r
-  DhcpSb->PacketToLive  = 0;\r
-  DhcpSb->LastTimeout   = 0;\r
-  DhcpSb->DhcpState     = State;\r
+  DhcpSb->CurRetry     = 0;\r
+  DhcpSb->PacketToLive = 0;\r
+  DhcpSb->LastTimeout  = 0;\r
+  DhcpSb->DhcpState    = State;\r
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Set the retransmit timer for the packet. It will select from either\r
   the discover timeouts/request timeouts or the default timeout values.\r
@@ -241,10 +231,10 @@ DhcpSetState (
 **/\r
 VOID\r
 DhcpSetTransmitTimer (\r
-  IN OUT DHCP_SERVICE           *DhcpSb\r
+  IN OUT DHCP_SERVICE  *DhcpSb\r
   )\r
 {\r
-  UINT32                    *Times;\r
+  UINT32  *Times;\r
 \r
   ASSERT (DhcpSb->MaxRetries > DhcpSb->CurRetry);\r
 \r
@@ -275,8 +265,8 @@ DhcpSetTransmitTimer (
 **/\r
 VOID\r
 DhcpComputeLease (\r
-  IN OUT DHCP_SERVICE           *DhcpSb,\r
-  IN     DHCP_PARAMETER         *Para\r
+  IN OUT DHCP_SERVICE    *DhcpSb,\r
+  IN     DHCP_PARAMETER  *Para\r
   )\r
 {\r
   ASSERT (Para != NULL);\r
@@ -298,7 +288,6 @@ DhcpComputeLease (
   }\r
 }\r
 \r
-\r
 /**\r
   Configure a UDP IO port to use the acquired lease address.\r
   DHCP driver needs this port to unicast packet to the server\r
@@ -314,32 +303,32 @@ DhcpComputeLease (
 EFI_STATUS\r
 EFIAPI\r
 DhcpConfigLeaseIoPort (\r
-  IN UDP_IO                 *UdpIo,\r
-  IN VOID                   *Context\r
+  IN UDP_IO  *UdpIo,\r
+  IN VOID    *Context\r
   )\r
 {\r
-  EFI_UDP4_CONFIG_DATA      UdpConfigData;\r
-  EFI_IPv4_ADDRESS          Subnet;\r
-  EFI_IPv4_ADDRESS          Gateway;\r
-  DHCP_SERVICE              *DhcpSb;\r
-  EFI_STATUS                Status;\r
-  IP4_ADDR                  Ip;\r
-\r
-  DhcpSb = (DHCP_SERVICE *) Context;\r
-\r
-  UdpConfigData.AcceptBroadcast     = FALSE;\r
-  UdpConfigData.AcceptPromiscuous   = FALSE;\r
-  UdpConfigData.AcceptAnyPort       = FALSE;\r
-  UdpConfigData.AllowDuplicatePort  = TRUE;\r
-  UdpConfigData.TypeOfService       = 0;\r
-  UdpConfigData.TimeToLive          = 64;\r
-  UdpConfigData.DoNotFragment       = FALSE;\r
-  UdpConfigData.ReceiveTimeout      = 1;\r
-  UdpConfigData.TransmitTimeout     = 0;\r
-\r
-  UdpConfigData.UseDefaultAddress   = FALSE;\r
-  UdpConfigData.StationPort         = DHCP_CLIENT_PORT;\r
-  UdpConfigData.RemotePort          = DHCP_SERVER_PORT;\r
+  EFI_UDP4_CONFIG_DATA  UdpConfigData;\r
+  EFI_IPv4_ADDRESS      Subnet;\r
+  EFI_IPv4_ADDRESS      Gateway;\r
+  DHCP_SERVICE          *DhcpSb;\r
+  EFI_STATUS            Status;\r
+  IP4_ADDR              Ip;\r
+\r
+  DhcpSb = (DHCP_SERVICE *)Context;\r
+\r
+  UdpConfigData.AcceptBroadcast    = FALSE;\r
+  UdpConfigData.AcceptPromiscuous  = FALSE;\r
+  UdpConfigData.AcceptAnyPort      = FALSE;\r
+  UdpConfigData.AllowDuplicatePort = TRUE;\r
+  UdpConfigData.TypeOfService      = 0;\r
+  UdpConfigData.TimeToLive         = 64;\r
+  UdpConfigData.DoNotFragment      = FALSE;\r
+  UdpConfigData.ReceiveTimeout     = 1;\r
+  UdpConfigData.TransmitTimeout    = 0;\r
+\r
+  UdpConfigData.UseDefaultAddress = FALSE;\r
+  UdpConfigData.StationPort       = DHCP_CLIENT_PORT;\r
+  UdpConfigData.RemotePort        = DHCP_SERVER_PORT;\r
 \r
   Ip = HTONL (DhcpSb->ClientAddr);\r
   CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
@@ -370,7 +359,6 @@ DhcpConfigLeaseIoPort (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Update the lease states when a new lease is acquired. It will not only\r
   save the acquired the address and lease time, it will also create a UDP\r
@@ -384,14 +372,14 @@ DhcpConfigLeaseIoPort (
 **/\r
 EFI_STATUS\r
 DhcpLeaseAcquired (\r
-  IN OUT DHCP_SERVICE           *DhcpSb\r
+  IN OUT DHCP_SERVICE  *DhcpSb\r
   )\r
 {\r
   DhcpSb->ClientAddr = EFI_NTOHL (DhcpSb->Selected->Dhcp4.Header.YourAddr);\r
 \r
   if (DhcpSb->Para != NULL) {\r
-    DhcpSb->Netmask     = DhcpSb->Para->NetMask;\r
-    DhcpSb->ServerAddr  = DhcpSb->Para->ServerId;\r
+    DhcpSb->Netmask    = DhcpSb->Para->NetMask;\r
+    DhcpSb->ServerAddr = DhcpSb->Para->ServerId;\r
   }\r
 \r
   if (DhcpSb->Netmask == 0) {\r
@@ -426,7 +414,6 @@ DhcpLeaseAcquired (
   return DhcpSetState (DhcpSb, Dhcp4Bound, TRUE);\r
 }\r
 \r
-\r
 /**\r
   Clean up the DHCP related states, IoStatus isn't reset.\r
 \r
@@ -435,14 +422,14 @@ DhcpLeaseAcquired (
 **/\r
 VOID\r
 DhcpCleanLease (\r
-  IN DHCP_SERVICE           *DhcpSb\r
+  IN DHCP_SERVICE  *DhcpSb\r
   )\r
 {\r
-  DhcpSb->DhcpState   = Dhcp4Init;\r
-  DhcpSb->Xid         = DhcpSb->Xid + 1;\r
-  DhcpSb->ClientAddr  = 0;\r
-  DhcpSb->Netmask     = 0;\r
-  DhcpSb->ServerAddr  = 0;\r
+  DhcpSb->DhcpState  = Dhcp4Init;\r
+  DhcpSb->Xid        = DhcpSb->Xid + 1;\r
+  DhcpSb->ClientAddr = 0;\r
+  DhcpSb->Netmask    = 0;\r
+  DhcpSb->ServerAddr = 0;\r
 \r
   if (DhcpSb->LastOffer != NULL) {\r
     FreePool (DhcpSb->LastOffer);\r
@@ -459,10 +446,10 @@ DhcpCleanLease (
     DhcpSb->Para = NULL;\r
   }\r
 \r
-  DhcpSb->Lease         = 0;\r
-  DhcpSb->T1            = 0;\r
-  DhcpSb->T2            = 0;\r
-  DhcpSb->ExtraRefresh  = FALSE;\r
+  DhcpSb->Lease        = 0;\r
+  DhcpSb->T1           = 0;\r
+  DhcpSb->T2           = 0;\r
+  DhcpSb->ExtraRefresh = FALSE;\r
 \r
   if (DhcpSb->LeaseIoPort != NULL) {\r
     UdpIoFreeIo (DhcpSb->LeaseIoPort);\r
@@ -474,11 +461,11 @@ DhcpCleanLease (
     DhcpSb->LastPacket = NULL;\r
   }\r
 \r
-  DhcpSb->PacketToLive  = 0;\r
-  DhcpSb->LastTimeout   = 0;\r
-  DhcpSb->CurRetry      = 0;\r
-  DhcpSb->MaxRetries    = 0;\r
-  DhcpSb->LeaseLife     = 0;\r
+  DhcpSb->PacketToLive = 0;\r
+  DhcpSb->LastTimeout  = 0;\r
+  DhcpSb->CurRetry     = 0;\r
+  DhcpSb->MaxRetries   = 0;\r
+  DhcpSb->LeaseLife    = 0;\r
 \r
   //\r
   // Clean active config data.\r
@@ -486,7 +473,6 @@ DhcpCleanLease (
   DhcpCleanConfigure (&DhcpSb->ActiveConfig);\r
 }\r
 \r
-\r
 /**\r
   Select a offer among all the offers collected. If the offer selected is\r
   of BOOTP, the lease is recorded and user notified. If the offer is of\r
@@ -499,13 +485,13 @@ DhcpCleanLease (
 **/\r
 EFI_STATUS\r
 DhcpChooseOffer (\r
-  IN DHCP_SERVICE           *DhcpSb\r
+  IN DHCP_SERVICE  *DhcpSb\r
   )\r
 {\r
-  EFI_DHCP4_PACKET          *Selected;\r
-  EFI_DHCP4_PACKET          *NewPacket;\r
-  EFI_DHCP4_PACKET          *TempPacket;\r
-  EFI_STATUS                Status;\r
+  EFI_DHCP4_PACKET  *Selected;\r
+  EFI_DHCP4_PACKET  *NewPacket;\r
+  EFI_DHCP4_PACKET  *TempPacket;\r
+  EFI_STATUS        Status;\r
 \r
   ASSERT (DhcpSb->LastOffer != NULL);\r
 \r
@@ -524,7 +510,7 @@ DhcpChooseOffer (
   Selected = DhcpSb->LastOffer;\r
 \r
   if ((NewPacket != NULL) && !EFI_ERROR (DhcpValidateOptions (NewPacket, NULL))) {\r
-    TempPacket = (EFI_DHCP4_PACKET *) AllocatePool (NewPacket->Size);\r
+    TempPacket = (EFI_DHCP4_PACKET *)AllocatePool (NewPacket->Size);\r
     if (TempPacket != NULL) {\r
       CopyMem (TempPacket, NewPacket, NewPacket->Size);\r
       FreePool (Selected);\r
@@ -565,7 +551,6 @@ DhcpChooseOffer (
   return DhcpSendMessage (DhcpSb, Selected, DhcpSb->Para, DHCP_MSG_REQUEST, NULL);\r
 }\r
 \r
-\r
 /**\r
   Terminate the current address acquire. All the allocated resources\r
   are released. Be careful when calling this function. A rule related\r
@@ -578,8 +563,8 @@ DhcpChooseOffer (
 **/\r
 VOID\r
 DhcpEndSession (\r
-  IN DHCP_SERVICE           *DhcpSb,\r
-  IN EFI_STATUS             Status\r
+  IN DHCP_SERVICE  *DhcpSb,\r
+  IN EFI_STATUS    Status\r
   )\r
 {\r
   if (DHCP_CONNECTED (DhcpSb->DhcpState)) {\r
@@ -594,7 +579,6 @@ DhcpEndSession (
   DhcpNotifyUser (DhcpSb, DHCP_NOTIFY_ALL);\r
 }\r
 \r
-\r
 /**\r
   Handle packets in DHCP select state.\r
 \r
@@ -609,12 +593,12 @@ DhcpEndSession (
 **/\r
 EFI_STATUS\r
 DhcpHandleSelect (\r
-  IN DHCP_SERVICE           *DhcpSb,\r
-  IN EFI_DHCP4_PACKET       *Packet,\r
-  IN DHCP_PARAMETER         *Para\r
+  IN DHCP_SERVICE      *DhcpSb,\r
+  IN EFI_DHCP4_PACKET  *Packet,\r
+  IN DHCP_PARAMETER    *Para\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
+  EFI_STATUS  Status;\r
 \r
   Status = EFI_SUCCESS;\r
 \r
@@ -626,7 +610,8 @@ DhcpHandleSelect (
   //\r
   if (!DHCP_IS_BOOTP (Para) &&\r
       ((Para->DhcpType != DHCP_MSG_OFFER) || (Para->ServerId == 0))\r
-      ) {\r
+      )\r
+  {\r
     goto ON_EXIT;\r
   }\r
 \r
@@ -646,14 +631,12 @@ DhcpHandleSelect (
     DhcpSb->LastOffer = Packet;\r
 \r
     return DhcpChooseOffer (DhcpSb);\r
-\r
   } else if (Status == EFI_NOT_READY) {\r
     if (DhcpSb->LastOffer != NULL) {\r
       FreePool (DhcpSb->LastOffer);\r
     }\r
 \r
     DhcpSb->LastOffer = Packet;\r
-\r
   } else if (Status == EFI_ABORTED) {\r
     //\r
     // DhcpInput will end the session upon error return. Remember\r
@@ -669,7 +652,6 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Handle packets in DHCP request state.\r
 \r
@@ -684,20 +666,20 @@ ON_EXIT:
 **/\r
 EFI_STATUS\r
 DhcpHandleRequest (\r
-  IN DHCP_SERVICE           *DhcpSb,\r
-  IN EFI_DHCP4_PACKET       *Packet,\r
-  IN DHCP_PARAMETER         *Para\r
+  IN DHCP_SERVICE      *DhcpSb,\r
+  IN EFI_DHCP4_PACKET  *Packet,\r
+  IN DHCP_PARAMETER    *Para\r
   )\r
 {\r
-  EFI_DHCP4_HEADER          *Head;\r
-  EFI_DHCP4_HEADER          *Selected;\r
-  EFI_STATUS                Status;\r
-  UINT8                     *Message;\r
+  EFI_DHCP4_HEADER  *Head;\r
+  EFI_DHCP4_HEADER  *Selected;\r
+  EFI_STATUS        Status;\r
+  UINT8             *Message;\r
 \r
   ASSERT (!DHCP_IS_BOOTP (DhcpSb->Para));\r
 \r
-  Head      = &Packet->Dhcp4.Header;\r
-  Selected  = &DhcpSb->Selected->Dhcp4.Header;\r
+  Head     = &Packet->Dhcp4.Header;\r
+  Selected = &DhcpSb->Selected->Dhcp4.Header;\r
 \r
   //\r
   // Ignore the BOOTP message and DHCP messages other than DHCP ACK/NACK.\r
@@ -705,8 +687,8 @@ DhcpHandleRequest (
   if (DHCP_IS_BOOTP (Para) ||\r
       (Para->ServerId != DhcpSb->Para->ServerId) ||\r
       ((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))\r
-      ) {\r
-\r
+      )\r
+  {\r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
   }\r
@@ -727,14 +709,14 @@ DhcpHandleRequest (
   Message = NULL;\r
 \r
   if (!EFI_IP4_EQUAL (&Head->YourAddr, &Selected->YourAddr)) {\r
-    Message = (UINT8 *) "Lease confirmed isn't the same as that in the offer";\r
+    Message = (UINT8 *)"Lease confirmed isn't the same as that in the offer";\r
     goto REJECT;\r
   }\r
 \r
   Status = DhcpCallUser (DhcpSb, Dhcp4RcvdAck, Packet, NULL);\r
 \r
   if (EFI_ERROR (Status)) {\r
-    Message = (UINT8 *) "Lease is denied upon received ACK";\r
+    Message = (UINT8 *)"Lease is denied upon received ACK";\r
     goto REJECT;\r
   }\r
 \r
@@ -744,7 +726,7 @@ DhcpHandleRequest (
   Status = DhcpLeaseAcquired (DhcpSb);\r
 \r
   if (EFI_ERROR (Status)) {\r
-    Message = (UINT8 *) "Lease is denied upon entering bound";\r
+    Message = (UINT8 *)"Lease is denied upon entering bound";\r
     goto REJECT;\r
   }\r
 \r
@@ -762,7 +744,6 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Handle packets in DHCP renew/rebound state.\r
 \r
@@ -777,19 +758,19 @@ ON_EXIT:
 **/\r
 EFI_STATUS\r
 DhcpHandleRenewRebind (\r
-  IN DHCP_SERVICE           *DhcpSb,\r
-  IN EFI_DHCP4_PACKET       *Packet,\r
-  IN DHCP_PARAMETER         *Para\r
+  IN DHCP_SERVICE      *DhcpSb,\r
+  IN EFI_DHCP4_PACKET  *Packet,\r
+  IN DHCP_PARAMETER    *Para\r
   )\r
 {\r
-  EFI_DHCP4_HEADER          *Head;\r
-  EFI_DHCP4_HEADER          *Selected;\r
-  EFI_STATUS                Status;\r
+  EFI_DHCP4_HEADER  *Head;\r
+  EFI_DHCP4_HEADER  *Selected;\r
+  EFI_STATUS        Status;\r
 \r
   ASSERT (!DHCP_IS_BOOTP (DhcpSb->Para));\r
 \r
-  Head      = &Packet->Dhcp4.Header;\r
-  Selected  = &DhcpSb->Selected->Dhcp4.Header;\r
+  Head     = &Packet->Dhcp4.Header;\r
+  Selected = &DhcpSb->Selected->Dhcp4.Header;\r
 \r
   //\r
   // Ignore the BOOTP message and DHCP messages other than DHCP ACK/NACK\r
@@ -797,8 +778,8 @@ DhcpHandleRenewRebind (
   if (DHCP_IS_BOOTP (Para) ||\r
       (Para->ServerId != DhcpSb->Para->ServerId) ||\r
       ((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))\r
-      ) {\r
-\r
+      )\r
+  {\r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
   }\r
@@ -835,9 +816,9 @@ DhcpHandleRenewRebind (
   DhcpSetState (DhcpSb, Dhcp4Bound, TRUE);\r
 \r
   if (DhcpSb->ExtraRefresh != 0) {\r
-    DhcpSb->ExtraRefresh  = FALSE;\r
+    DhcpSb->ExtraRefresh = FALSE;\r
 \r
-    DhcpSb->IoStatus      = EFI_SUCCESS;\r
+    DhcpSb->IoStatus = EFI_SUCCESS;\r
     DhcpNotifyUser (DhcpSb, DHCP_NOTIFY_RENEWREBIND);\r
   }\r
 \r
@@ -846,7 +827,6 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Handle packets in DHCP reboot state.\r
 \r
@@ -861,13 +841,13 @@ ON_EXIT:
 **/\r
 EFI_STATUS\r
 DhcpHandleReboot (\r
-  IN DHCP_SERVICE           *DhcpSb,\r
-  IN EFI_DHCP4_PACKET       *Packet,\r
-  IN DHCP_PARAMETER         *Para\r
+  IN DHCP_SERVICE      *DhcpSb,\r
+  IN EFI_DHCP4_PACKET  *Packet,\r
+  IN DHCP_PARAMETER    *Para\r
   )\r
 {\r
-  EFI_DHCP4_HEADER          *Head;\r
-  EFI_STATUS                Status;\r
+  EFI_DHCP4_HEADER  *Head;\r
+  EFI_STATUS        Status;\r
 \r
   Head = &Packet->Dhcp4.Header;\r
 \r
@@ -876,8 +856,8 @@ DhcpHandleReboot (
   //\r
   if (DHCP_IS_BOOTP (Para) ||\r
       ((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))\r
-      ) {\r
-\r
+      )\r
+  {\r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
   }\r
@@ -888,10 +868,10 @@ DhcpHandleReboot (
   if (Para->DhcpType == DHCP_MSG_NAK) {\r
     DhcpCallUser (DhcpSb, Dhcp4RcvdNak, Packet, NULL);\r
 \r
-    DhcpSb->ClientAddr  = 0;\r
-    DhcpSb->DhcpState   = Dhcp4Init;\r
+    DhcpSb->ClientAddr = 0;\r
+    DhcpSb->DhcpState  = Dhcp4Init;\r
 \r
-    Status              = DhcpInitRequest (DhcpSb);\r
+    Status = DhcpInitRequest (DhcpSb);\r
     goto ON_EXIT;\r
   }\r
 \r
@@ -917,8 +897,8 @@ DhcpHandleReboot (
     goto ON_EXIT;\r
   }\r
 \r
-  DhcpSb->Selected  = Packet;\r
-  Status            = DhcpLeaseAcquired (DhcpSb);\r
+  DhcpSb->Selected = Packet;\r
+  Status           = DhcpLeaseAcquired (DhcpSb);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -932,7 +912,6 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Handle the received DHCP packets. This function drives the DHCP\r
   state machine.\r
@@ -946,30 +925,30 @@ ON_EXIT:
 VOID\r
 EFIAPI\r
 DhcpInput (\r
-  NET_BUF                   *UdpPacket,\r
-  UDP_END_POINT             *EndPoint,\r
-  EFI_STATUS                IoStatus,\r
-  VOID                      *Context\r
+  NET_BUF        *UdpPacket,\r
+  UDP_END_POINT  *EndPoint,\r
+  EFI_STATUS     IoStatus,\r
+  VOID           *Context\r
   )\r
 {\r
-  DHCP_SERVICE              *DhcpSb;\r
-  EFI_DHCP4_HEADER          *Head;\r
-  EFI_DHCP4_PACKET          *Packet;\r
-  DHCP_PARAMETER            *Para;\r
-  EFI_STATUS                Status;\r
-  UINT32                    Len;\r
+  DHCP_SERVICE      *DhcpSb;\r
+  EFI_DHCP4_HEADER  *Head;\r
+  EFI_DHCP4_PACKET  *Packet;\r
+  DHCP_PARAMETER    *Para;\r
+  EFI_STATUS        Status;\r
+  UINT32            Len;\r
 \r
-  Packet  = NULL;\r
-  DhcpSb  = (DHCP_SERVICE *) Context;\r
+  Packet = NULL;\r
+  DhcpSb = (DHCP_SERVICE *)Context;\r
 \r
   //\r
   // Don't restart receive if error occurs or DHCP is destroyed.\r
   //\r
   if (EFI_ERROR (IoStatus)) {\r
-    return ;\r
+    return;\r
   } else if (DhcpSb->ServiceState == DHCP_DESTROY) {\r
     NetbufFree (UdpPacket);\r
-    return ;\r
+    return;\r
   }\r
 \r
   ASSERT (UdpPacket != NULL);\r
@@ -988,16 +967,16 @@ DhcpInput (
   //\r
   // Copy the DHCP message to a continuous memory block\r
   //\r
-  Len     = sizeof (EFI_DHCP4_PACKET) + UdpPacket->TotalSize - sizeof (EFI_DHCP4_HEADER);\r
-  Packet  = (EFI_DHCP4_PACKET *) AllocatePool (Len);\r
+  Len    = sizeof (EFI_DHCP4_PACKET) + UdpPacket->TotalSize - sizeof (EFI_DHCP4_HEADER);\r
+  Packet = (EFI_DHCP4_PACKET *)AllocatePool (Len);\r
 \r
   if (Packet == NULL) {\r
     goto RESTART;\r
   }\r
 \r
-  Packet->Size    = Len;\r
-  Head            = &Packet->Dhcp4.Header;\r
-  Packet->Length  = NetbufCopy (UdpPacket, 0, UdpPacket->TotalSize, (UINT8 *) Head);\r
+  Packet->Size   = Len;\r
+  Head           = &Packet->Dhcp4.Header;\r
+  Packet->Length = NetbufCopy (UdpPacket, 0, UdpPacket->TotalSize, (UINT8 *)Head);\r
 \r
   if (Packet->Length != UdpPacket->TotalSize) {\r
     goto RESTART;\r
@@ -1008,7 +987,8 @@ DhcpInput (
   //\r
   if ((Head->OpCode != BOOTP_REPLY) ||\r
       (NTOHL (Head->Xid) != DhcpSb->Xid) ||\r
-      (CompareMem (DhcpSb->ClientAddressSendOut, Head->ClientHwAddr, Head->HwAddrLen) != 0)) {\r
+      (CompareMem (DhcpSb->ClientAddressSendOut, Head->ClientHwAddr, Head->HwAddrLen) != 0))\r
+  {\r
     goto RESTART;\r
   }\r
 \r
@@ -1018,8 +998,8 @@ DhcpInput (
   Para = NULL;\r
   if ((Packet->Length > sizeof (EFI_DHCP4_HEADER) + sizeof (UINT32)) &&\r
       (Packet->Dhcp4.Magik == DHCP_OPTION_MAGIC) &&\r
-      EFI_ERROR (DhcpValidateOptions (Packet, &Para))) {\r
-\r
+      EFI_ERROR (DhcpValidateOptions (Packet, &Para)))\r
+  {\r
     goto RESTART;\r
   }\r
 \r
@@ -1035,32 +1015,32 @@ DhcpInput (
   Status = EFI_SUCCESS;\r
 \r
   switch (DhcpSb->DhcpState) {\r
-  case Dhcp4Selecting:\r
-    Status = DhcpHandleSelect (DhcpSb, Packet, Para);\r
-    break;\r
+    case Dhcp4Selecting:\r
+      Status = DhcpHandleSelect (DhcpSb, Packet, Para);\r
+      break;\r
 \r
-  case Dhcp4Requesting:\r
-    Status = DhcpHandleRequest (DhcpSb, Packet, Para);\r
-    break;\r
+    case Dhcp4Requesting:\r
+      Status = DhcpHandleRequest (DhcpSb, Packet, Para);\r
+      break;\r
 \r
-  case Dhcp4InitReboot:\r
-  case Dhcp4Init:\r
-  case Dhcp4Bound:\r
-    //\r
-    // Ignore the packet in INITREBOOT, INIT and BOUND states\r
-    //\r
-    FreePool (Packet);\r
-    Status = EFI_SUCCESS;\r
-    break;\r
+    case Dhcp4InitReboot:\r
+    case Dhcp4Init:\r
+    case Dhcp4Bound:\r
+      //\r
+      // Ignore the packet in INITREBOOT, INIT and BOUND states\r
+      //\r
+      FreePool (Packet);\r
+      Status = EFI_SUCCESS;\r
+      break;\r
 \r
-  case Dhcp4Renewing:\r
-  case Dhcp4Rebinding:\r
-    Status = DhcpHandleRenewRebind (DhcpSb, Packet, Para);\r
-    break;\r
+    case Dhcp4Renewing:\r
+    case Dhcp4Rebinding:\r
+      Status = DhcpHandleRenewRebind (DhcpSb, Packet, Para);\r
+      break;\r
 \r
-  case Dhcp4Rebooting:\r
-    Status = DhcpHandleReboot (DhcpSb, Packet, Para);\r
-    break;\r
+    case Dhcp4Rebooting:\r
+      Status = DhcpHandleReboot (DhcpSb, Packet, Para);\r
+      break;\r
   }\r
 \r
   if (Para != NULL) {\r
@@ -1073,7 +1053,7 @@ DhcpInput (
     NetbufFree (UdpPacket);\r
     UdpIoRecvDatagram (DhcpSb->UdpIo, DhcpInput, DhcpSb, 0);\r
     DhcpEndSession (DhcpSb, Status);\r
-    return ;\r
+    return;\r
   }\r
 \r
 RESTART:\r
@@ -1102,17 +1082,15 @@ RESTART:
 VOID\r
 EFIAPI\r
 DhcpOnPacketSent (\r
-  NET_BUF                   *Packet,\r
-  UDP_END_POINT             *EndPoint,\r
-  EFI_STATUS                IoStatus,\r
-  VOID                      *Context\r
+  NET_BUF        *Packet,\r
+  UDP_END_POINT  *EndPoint,\r
+  EFI_STATUS     IoStatus,\r
+  VOID           *Context\r
   )\r
 {\r
   NetbufFree (Packet);\r
 }\r
 \r
-\r
-\r
 /**\r
   Build and transmit a DHCP message according to the current states.\r
   This function implement the Table 5. of RFC 2131. Always transits\r
@@ -1134,28 +1112,28 @@ DhcpOnPacketSent (
 **/\r
 EFI_STATUS\r
 DhcpSendMessage (\r
-  IN DHCP_SERVICE           *DhcpSb,\r
-  IN EFI_DHCP4_PACKET       *Seed,\r
-  IN DHCP_PARAMETER         *Para,\r
-  IN UINT8                  Type,\r
-  IN UINT8                  *Msg\r
+  IN DHCP_SERVICE      *DhcpSb,\r
+  IN EFI_DHCP4_PACKET  *Seed,\r
+  IN DHCP_PARAMETER    *Para,\r
+  IN UINT8             Type,\r
+  IN UINT8             *Msg\r
   )\r
 {\r
-  EFI_DHCP4_CONFIG_DATA     *Config;\r
-  EFI_DHCP4_PACKET          *Packet;\r
-  EFI_DHCP4_PACKET          *NewPacket;\r
-  EFI_DHCP4_HEADER          *Head;\r
-  EFI_DHCP4_HEADER          *SeedHead;\r
-  UDP_IO                    *UdpIo;\r
-  UDP_END_POINT             EndPoint;\r
-  NET_BUF                   *Wrap;\r
-  NET_FRAGMENT              Frag;\r
-  EFI_STATUS                Status;\r
-  IP4_ADDR                  IpAddr;\r
-  UINT8                     *Buf;\r
-  UINT16                    MaxMsg;\r
-  UINT32                    Len;\r
-  UINT32                    Index;\r
+  EFI_DHCP4_CONFIG_DATA  *Config;\r
+  EFI_DHCP4_PACKET       *Packet;\r
+  EFI_DHCP4_PACKET       *NewPacket;\r
+  EFI_DHCP4_HEADER       *Head;\r
+  EFI_DHCP4_HEADER       *SeedHead;\r
+  UDP_IO                 *UdpIo;\r
+  UDP_END_POINT          EndPoint;\r
+  NET_BUF                *Wrap;\r
+  NET_FRAGMENT           Frag;\r
+  EFI_STATUS             Status;\r
+  IP4_ADDR               IpAddr;\r
+  UINT8                  *Buf;\r
+  UINT16                 MaxMsg;\r
+  UINT32                 Len;\r
+  UINT32                 Index;\r
 \r
   //\r
   // Allocate a big enough memory block to hold the DHCP packet\r
@@ -1163,7 +1141,7 @@ DhcpSendMessage (
   Len = sizeof (EFI_DHCP4_PACKET) + 128 + DhcpSb->UserOptionLen;\r
 \r
   if (Msg != NULL) {\r
-    Len += (UINT32)AsciiStrLen ((CHAR8 *) Msg);\r
+    Len += (UINT32)AsciiStrLen ((CHAR8 *)Msg);\r
   }\r
 \r
   Packet = AllocatePool (Len);\r
@@ -1172,14 +1150,14 @@ DhcpSendMessage (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  Packet->Size    = Len;\r
-  Packet->Length  = sizeof (EFI_DHCP4_HEADER) + sizeof (UINT32);\r
+  Packet->Size   = Len;\r
+  Packet->Length = sizeof (EFI_DHCP4_HEADER) + sizeof (UINT32);\r
 \r
   //\r
   // Fill in the DHCP header fields\r
   //\r
-  Config    = &DhcpSb->ActiveConfig;\r
-  SeedHead  = NULL;\r
+  Config   = &DhcpSb->ActiveConfig;\r
+  SeedHead = NULL;\r
 \r
   if (Seed != NULL) {\r
     SeedHead = &Seed->Dhcp4.Header;\r
@@ -1188,11 +1166,11 @@ DhcpSendMessage (
   Head = &Packet->Dhcp4.Header;\r
   ZeroMem (Head, sizeof (EFI_DHCP4_HEADER));\r
 \r
-  Head->OpCode       = BOOTP_REQUEST;\r
-  Head->HwType       = DhcpSb->HwType;\r
-  Head->HwAddrLen    = DhcpSb->HwLen;\r
-  Head->Xid          = HTONL (DhcpSb->Xid);\r
-  Head->Reserved     = HTONS (0x8000);  //Server, broadcast the message please.\r
+  Head->OpCode    = BOOTP_REQUEST;\r
+  Head->HwType    = DhcpSb->HwType;\r
+  Head->HwAddrLen = DhcpSb->HwLen;\r
+  Head->Xid       = HTONL (DhcpSb->Xid);\r
+  Head->Reserved  = HTONS (0x8000);     // Server, broadcast the message please.\r
 \r
   EFI_IP4 (Head->ClientAddr) = HTONL (DhcpSb->ClientAddr);\r
   CopyMem (Head->ClientHwAddr, DhcpSb->Mac.Addr, DhcpSb->HwLen);\r
@@ -1205,7 +1183,7 @@ DhcpSendMessage (
     //\r
     Head->Seconds = DhcpSb->LastPacket->Dhcp4.Header.Seconds;\r
   } else {\r
-    SetElapsedTime(&Head->Seconds, DhcpSb->ActiveChild);\r
+    SetElapsedTime (&Head->Seconds, DhcpSb->ActiveChild);\r
   }\r
 \r
   //\r
@@ -1223,12 +1201,12 @@ DhcpSendMessage (
   //\r
   if ((Type == DHCP_MSG_DECLINE) || (Type == DHCP_MSG_RELEASE) ||\r
       ((Type == DHCP_MSG_REQUEST) && (DhcpSb->DhcpState == Dhcp4Requesting))\r
-      ) {\r
-\r
+      )\r
+  {\r
     ASSERT ((Para != NULL) && (Para->ServerId != 0));\r
 \r
-    IpAddr  = HTONL (Para->ServerId);\r
-    Buf     = DhcpAppendOption (Buf, DHCP4_TAG_SERVER_ID, 4, (UINT8 *) &IpAddr);\r
+    IpAddr = HTONL (Para->ServerId);\r
+    Buf    = DhcpAppendOption (Buf, DHCP4_TAG_SERVER_ID, 4, (UINT8 *)&IpAddr);\r
   }\r
 \r
   //\r
@@ -1242,19 +1220,17 @@ DhcpSendMessage (
   if (Type == DHCP_MSG_REQUEST) {\r
     if (DhcpSb->DhcpState == Dhcp4Rebooting) {\r
       IpAddr = EFI_IP4 (Config->ClientAddress);\r
-\r
     } else if (DhcpSb->DhcpState == Dhcp4Requesting) {\r
       ASSERT (SeedHead != NULL);\r
       IpAddr = EFI_IP4 (SeedHead->YourAddr);\r
     }\r
-\r
   } else if (Type == DHCP_MSG_DECLINE) {\r
     ASSERT (SeedHead != NULL);\r
     IpAddr = EFI_IP4 (SeedHead->YourAddr);\r
   }\r
 \r
   if (IpAddr != 0) {\r
-    Buf = DhcpAppendOption (Buf, DHCP4_TAG_REQUEST_IP, 4, (UINT8 *) &IpAddr);\r
+    Buf = DhcpAppendOption (Buf, DHCP4_TAG_REQUEST_IP, 4, (UINT8 *)&IpAddr);\r
   }\r
 \r
   //\r
@@ -1263,16 +1239,16 @@ DhcpSendMessage (
   // override the BOOTFILE and SERVER fields in the message head.\r
   //\r
   if ((Type != DHCP_MSG_DECLINE) && (Type != DHCP_MSG_RELEASE)) {\r
-    MaxMsg  = HTONS (0xFF00);\r
-    Buf     = DhcpAppendOption (Buf, DHCP4_TAG_MAXMSG, 2, (UINT8 *) &MaxMsg);\r
+    MaxMsg = HTONS (0xFF00);\r
+    Buf    = DhcpAppendOption (Buf, DHCP4_TAG_MAXMSG, 2, (UINT8 *)&MaxMsg);\r
   }\r
 \r
   //\r
   // Append the user's message if it isn't NULL\r
   //\r
   if (Msg != NULL) {\r
-    Len     = MIN ((UINT32) AsciiStrLen ((CHAR8 *) Msg), 255);\r
-    Buf     = DhcpAppendOption (Buf, DHCP4_TAG_MESSAGE, (UINT16) Len, Msg);\r
+    Len = MIN ((UINT32)AsciiStrLen ((CHAR8 *)Msg), 255);\r
+    Buf = DhcpAppendOption (Buf, DHCP4_TAG_MESSAGE, (UINT16)Len, Msg);\r
   }\r
 \r
   //\r
@@ -1285,7 +1261,8 @@ DhcpSendMessage (
       // if it is a DHCP decline or DHCP release .\r
       //\r
       if (((Type == DHCP_MSG_DECLINE) || (Type == DHCP_MSG_RELEASE)) &&\r
-          (Config->OptionList[Index]->OpCode != DHCP4_TAG_CLIENT_ID)) {\r
+          (Config->OptionList[Index]->OpCode != DHCP4_TAG_CLIENT_ID))\r
+      {\r
         continue;\r
       }\r
 \r
@@ -1298,8 +1275,8 @@ DhcpSendMessage (
     }\r
   }\r
 \r
-  *(Buf++) = DHCP4_TAG_EOP;\r
-  Packet->Length += (UINT32) (Buf - Packet->Dhcp4.Option);\r
+  *(Buf++)        = DHCP4_TAG_EOP;\r
+  Packet->Length += (UINT32)(Buf - Packet->Dhcp4.Option);\r
 \r
   //\r
   // OK, the message is built, call the user to override it.\r
@@ -1309,10 +1286,8 @@ DhcpSendMessage (
 \r
   if (Type == DHCP_MSG_DISCOVER) {\r
     Status = DhcpCallUser (DhcpSb, Dhcp4SendDiscover, Packet, &NewPacket);\r
-\r
   } else if (Type == DHCP_MSG_REQUEST) {\r
     Status = DhcpCallUser (DhcpSb, Dhcp4SendRequest, Packet, &NewPacket);\r
-\r
   } else if (Type == DHCP_MSG_DECLINE) {\r
     Status = DhcpCallUser (DhcpSb, Dhcp4SendDecline, Packet, &NewPacket);\r
   }\r
@@ -1339,7 +1314,7 @@ DhcpSendMessage (
   //\r
   // Wrap it into a netbuf then send it.\r
   //\r
-  Frag.Bulk = (UINT8 *) &Packet->Dhcp4.Header;\r
+  Frag.Bulk = (UINT8 *)&Packet->Dhcp4.Header;\r
   Frag.Len  = Packet->Length;\r
   Wrap      = NetbufFromExt (&Frag, 1, 0, 0, DhcpDummyExtFree, NULL);\r
 \r
@@ -1393,7 +1368,6 @@ DhcpSendMessage (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Retransmit a saved packet. Only DISCOVER and REQUEST messages\r
   will be retransmitted.\r
@@ -1406,14 +1380,14 @@ DhcpSendMessage (
 **/\r
 EFI_STATUS\r
 DhcpRetransmit (\r
-  IN DHCP_SERVICE           *DhcpSb\r
+  IN DHCP_SERVICE  *DhcpSb\r
   )\r
 {\r
-  UDP_IO                    *UdpIo;\r
-  UDP_END_POINT             EndPoint;\r
-  NET_BUF                   *Wrap;\r
-  NET_FRAGMENT              Frag;\r
-  EFI_STATUS                Status;\r
+  UDP_IO         *UdpIo;\r
+  UDP_END_POINT  EndPoint;\r
+  NET_BUF        *Wrap;\r
+  NET_FRAGMENT   Frag;\r
+  EFI_STATUS     Status;\r
 \r
   ASSERT (DhcpSb->LastPacket != NULL);\r
 \r
@@ -1421,13 +1395,13 @@ DhcpRetransmit (
   // For REQUEST message in Dhcp4Requesting state, do not change the secs fields.\r
   //\r
   if (DhcpSb->DhcpState != Dhcp4Requesting) {\r
-    SetElapsedTime(&DhcpSb->LastPacket->Dhcp4.Header.Seconds, DhcpSb->ActiveChild);\r
+    SetElapsedTime (&DhcpSb->LastPacket->Dhcp4.Header.Seconds, DhcpSb->ActiveChild);\r
   }\r
 \r
   //\r
   // Wrap it into a netbuf then send it.\r
   //\r
-  Frag.Bulk = (UINT8 *) &DhcpSb->LastPacket->Dhcp4.Header;\r
+  Frag.Bulk = (UINT8 *)&DhcpSb->LastPacket->Dhcp4.Header;\r
   Frag.Len  = DhcpSb->LastPacket->Length;\r
   Wrap      = NetbufFromExt (&Frag, 1, 0, 0, DhcpDummyExtFree, NULL);\r
 \r
@@ -1469,7 +1443,6 @@ DhcpRetransmit (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Each DHCP service has three timer. Two of them are count down timer.\r
   One for the packet retransmission. The other is to collect the offers.\r
@@ -1484,23 +1457,23 @@ DhcpRetransmit (
 VOID\r
 EFIAPI\r
 DhcpOnTimerTick (\r
-  IN EFI_EVENT              Event,\r
-  IN VOID                   *Context\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
   )\r
 {\r
-  LIST_ENTRY                *Entry;\r
-  LIST_ENTRY                *Next;\r
-  DHCP_SERVICE              *DhcpSb;\r
-  DHCP_PROTOCOL             *Instance;\r
-  EFI_STATUS                Status;\r
+  LIST_ENTRY     *Entry;\r
+  LIST_ENTRY     *Next;\r
+  DHCP_SERVICE   *DhcpSb;\r
+  DHCP_PROTOCOL  *Instance;\r
+  EFI_STATUS     Status;\r
 \r
-  DhcpSb   = (DHCP_SERVICE *) Context;\r
+  DhcpSb   = (DHCP_SERVICE *)Context;\r
   Instance = DhcpSb->ActiveChild;\r
 \r
   //\r
   // 0xffff is the maximum supported value for elapsed time according to RFC.\r
   //\r
-  if (Instance != NULL && Instance->ElaspedTime < 0xffff) {\r
+  if ((Instance != NULL) && (Instance->ElaspedTime < 0xffff)) {\r
     Instance->ElaspedTime++;\r
   }\r
 \r
@@ -1508,15 +1481,13 @@ DhcpOnTimerTick (
   // Check the retransmit timer\r
   //\r
   if ((DhcpSb->PacketToLive > 0) && (--DhcpSb->PacketToLive == 0)) {\r
-\r
     //\r
     // Select offer at each timeout if any offer received.\r
     //\r
-    if (DhcpSb->DhcpState == Dhcp4Selecting && DhcpSb->LastOffer != NULL) {\r
-\r
+    if ((DhcpSb->DhcpState == Dhcp4Selecting) && (DhcpSb->LastOffer != NULL)) {\r
       Status = DhcpChooseOffer (DhcpSb);\r
 \r
-      if (EFI_ERROR(Status)) {\r
+      if (EFI_ERROR (Status)) {\r
         if (DhcpSb->LastOffer != NULL) {\r
           FreePool (DhcpSb->LastOffer);\r
           DhcpSb->LastOffer = NULL;\r
@@ -1532,9 +1503,7 @@ DhcpOnTimerTick (
       //\r
       DhcpRetransmit (DhcpSb);\r
       DhcpSetTransmitTimer (DhcpSb);\r
-\r
     } else if (DHCP_CONNECTED (DhcpSb->DhcpState)) {\r
-\r
       //\r
       // Retransmission failed, if the DHCP request is initiated by\r
       // user, adjust the current state according to the lease life.\r
@@ -1545,16 +1514,12 @@ DhcpOnTimerTick (
 \r
         if (DhcpSb->LeaseLife < DhcpSb->T1) {\r
           Status = DhcpSetState (DhcpSb, Dhcp4Bound, FALSE);\r
-\r
         } else if (DhcpSb->LeaseLife < DhcpSb->T2) {\r
           Status = DhcpSetState (DhcpSb, Dhcp4Renewing, FALSE);\r
-\r
         } else if (DhcpSb->LeaseLife < DhcpSb->Lease) {\r
           Status = DhcpSetState (DhcpSb, Dhcp4Rebinding, FALSE);\r
-\r
         } else {\r
           goto END_SESSION;\r
-\r
         }\r
 \r
         DhcpSb->IoStatus = EFI_TIMEOUT;\r
@@ -1577,7 +1542,7 @@ DhcpOnTimerTick (
     // requesting extra renew/rebind. Adjust the state after that.\r
     //\r
     if (DhcpSb->ExtraRefresh != 0) {\r
-      return ;\r
+      return;\r
     }\r
 \r
     if (DhcpSb->LeaseLife == DhcpSb->Lease) {\r
@@ -1585,7 +1550,6 @@ DhcpOnTimerTick (
       // Lease expires, end the session\r
       //\r
       goto END_SESSION;\r
-\r
     } else if (DhcpSb->LeaseLife == DhcpSb->T2) {\r
       //\r
       // T2 expires, transit to rebinding then send a REQUEST to any server\r
@@ -1595,7 +1559,7 @@ DhcpOnTimerTick (
       }\r
 \r
       if (Instance != NULL) {\r
-        Instance->ElaspedTime= 0;\r
+        Instance->ElaspedTime = 0;\r
       }\r
 \r
       Status = DhcpSendMessage (\r
@@ -1609,7 +1573,6 @@ DhcpOnTimerTick (
       if (EFI_ERROR (Status)) {\r
         goto END_SESSION;\r
       }\r
-\r
     } else if (DhcpSb->LeaseLife == DhcpSb->T1) {\r
       //\r
       // T1 expires, transit to renewing, then send a REQUEST to the server\r
@@ -1619,7 +1582,7 @@ DhcpOnTimerTick (
       }\r
 \r
       if (Instance != NULL) {\r
-        Instance->ElaspedTime= 0;\r
+        Instance->ElaspedTime = 0;\r
       }\r
 \r
       Status = DhcpSendMessage (\r
@@ -1643,15 +1606,15 @@ ON_EXIT:
   NET_LIST_FOR_EACH_SAFE (Entry, Next, &DhcpSb->Children) {\r
     Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);\r
     Instance->Timeout--;\r
-    if (Instance->Timeout == 0 && Instance->Token != NULL) {\r
+    if ((Instance->Timeout == 0) && (Instance->Token != NULL)) {\r
       PxeDhcpDone (Instance);\r
     }\r
   }\r
 \r
-  return ;\r
+  return;\r
 \r
 END_SESSION:\r
   DhcpEndSession (DhcpSb, EFI_TIMEOUT);\r
 \r
-  return ;\r
+  return;\r
 }\r