]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/ArpDxe/ArpImpl.c
NetworkPkg: Apply uncrustify changes
[mirror_edk2.git] / NetworkPkg / ArpDxe / ArpImpl.c
index 0e9ef103eff9c31d1f34fb5a1feae5bd97021bed..9d0d4dcd2a33350f1aec38f9366908d8843fb586 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation of the ARP protocol.\r
 \r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -21,7 +21,6 @@ EFI_ARP_PROTOCOL  mEfiArpProtocolTemplate = {
   ArpCancel\r
 };\r
 \r
-\r
 /**\r
   Initialize the instance context data.\r
 \r
@@ -51,11 +50,10 @@ ArpInitInstance (
   InitializeListHead (&Instance->List);\r
 }\r
 \r
-\r
 /**\r
   Process the Arp packets received from Mnp, the procedure conforms to RFC826.\r
 \r
-  @param[in]  Context            Pointer to the context data registerd to the\r
+  @param[in]  Context            Pointer to the context data registered to the\r
                                  Event.\r
 \r
   @return None.\r
@@ -64,7 +62,7 @@ ArpInitInstance (
 VOID\r
 EFIAPI\r
 ArpOnFrameRcvdDpc (\r
-  IN VOID       *Context\r
+  IN VOID  *Context\r
   )\r
 {\r
   EFI_STATUS                            Status;\r
@@ -113,24 +111,25 @@ ArpOnFrameRcvdDpc (
     //\r
     // Restart the receiving if packet size is not correct.\r
     //\r
-    goto RESTART_RECEIVE;\r
+    goto RECYCLE_RXDATA;\r
   }\r
 \r
   //\r
   // Convert the byte order of the multi-byte fields.\r
   //\r
-  Head   = (ARP_HEAD *) RxData->PacketData;\r
+  Head            = (ARP_HEAD *)RxData->PacketData;\r
   Head->HwType    = NTOHS (Head->HwType);\r
   Head->ProtoType = NTOHS (Head->ProtoType);\r
   Head->OpCode    = NTOHS (Head->OpCode);\r
 \r
   if (RxData->DataLength < (sizeof (ARP_HEAD) + 2 * Head->HwAddrLen + 2 * Head->ProtoAddrLen)) {\r
-    goto RESTART_RECEIVE;\r
+    goto RECYCLE_RXDATA;\r
   }\r
 \r
   if ((Head->HwType != ArpService->SnpMode.IfType) ||\r
-    (Head->HwAddrLen != ArpService->SnpMode.HwAddressSize) ||\r
-    (RxData->ProtocolType != ARP_ETHER_PROTO_TYPE)) {\r
+      (Head->HwAddrLen != ArpService->SnpMode.HwAddressSize) ||\r
+      (RxData->ProtocolType != ARP_ETHER_PROTO_TYPE))\r
+  {\r
     //\r
     // The hardware type or the hardware address length doesn't match.\r
     // There is a sanity check for the protocol type too.\r
@@ -182,8 +181,9 @@ ArpOnFrameRcvdDpc (
     ConfigData = &Instance->ConfigData;\r
 \r
     if ((Instance->Configured) &&\r
-      (Head->ProtoType == ConfigData->SwAddressType) &&\r
-      (Head->ProtoAddrLen == ConfigData->SwAddressLength)) {\r
+        (Head->ProtoType == ConfigData->SwAddressType) &&\r
+        (Head->ProtoAddrLen == ConfigData->SwAddressLength))\r
+    {\r
       //\r
       // The protocol type is matched for the received arp packet.\r
       //\r
@@ -192,7 +192,8 @@ ArpOnFrameRcvdDpc (
                  (VOID *)ArpAddress.TargetProtoAddr,\r
                  ConfigData->StationAddress,\r
                  ConfigData->SwAddressLength\r
-                 )) {\r
+                 ))\r
+      {\r
         //\r
         // The arp driver has the target address required by the received arp packet.\r
         //\r
@@ -226,7 +227,7 @@ ArpOnFrameRcvdDpc (
     //\r
     ArpFillAddressInCacheEntry (CacheEntry, &SenderAddress[Hardware], NULL);\r
     CacheEntry->DecayTime = CacheEntry->DefaultDecayTime;\r
-    MergeFlag = TRUE;\r
+    MergeFlag             = TRUE;\r
   }\r
 \r
   if (!IsTarget) {\r
@@ -304,19 +305,24 @@ RESTART_RECEIVE:
   //\r
   Status = ArpService->Mnp->Receive (ArpService->Mnp, RxToken);\r
 \r
-  DEBUG_CODE (\r
-    if (EFI_ERROR (Status)) {\r
-      DEBUG ((EFI_D_ERROR, "ArpOnFrameRcvd: ArpService->Mnp->Receive "\r
-        "failed, %r\n.", Status));\r
-    }\r
-  );\r
+  DEBUG_CODE_BEGIN ();\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((\r
+      DEBUG_ERROR,\r
+      "ArpOnFrameRcvd: ArpService->Mnp->Receive "\r
+      "failed, %r\n.",\r
+      Status\r
+      ));\r
+  }\r
+\r
+  DEBUG_CODE_END ();\r
 }\r
 \r
 /**\r
   Queue ArpOnFrameRcvdDpc as a DPC at TPL_CALLBACK.\r
 \r
   @param[in]  Event                  The Event this notify function registered to.\r
-  @param[in]  Context                Pointer to the context data registerd to the\r
+  @param[in]  Context                Pointer to the context data registered to the\r
                                      Event.\r
 \r
   @return None.\r
@@ -338,7 +344,7 @@ ArpOnFrameRcvd (
 /**\r
   Process the already sent arp packets.\r
 \r
-  @param[in]  Context                Pointer to the context data registerd to the\r
+  @param[in]  Context                Pointer to the context data registered to the\r
                                      Event.\r
 \r
   @return None.\r
@@ -347,7 +353,7 @@ ArpOnFrameRcvd (
 VOID\r
 EFIAPI\r
 ArpOnFrameSentDpc (\r
-  IN VOID       *Context\r
+  IN VOID  *Context\r
   )\r
 {\r
   EFI_MANAGED_NETWORK_COMPLETION_TOKEN  *TxToken;\r
@@ -358,11 +364,12 @@ ArpOnFrameSentDpc (
   TxToken = (EFI_MANAGED_NETWORK_COMPLETION_TOKEN *)Context;\r
   TxData  = TxToken->Packet.TxData;\r
 \r
-  DEBUG_CODE (\r
-    if (EFI_ERROR (TxToken->Status)) {\r
-      DEBUG ((EFI_D_ERROR, "ArpOnFrameSent: TxToken->Status, %r.\n", TxToken->Status));\r
-    }\r
-  );\r
+  DEBUG_CODE_BEGIN ();\r
+  if (EFI_ERROR (TxToken->Status)) {\r
+    DEBUG ((DEBUG_ERROR, "ArpOnFrameSent: TxToken->Status, %r.\n", TxToken->Status));\r
+  }\r
+\r
+  DEBUG_CODE_END ();\r
 \r
   //\r
   // Free the allocated memory and close the event.\r
@@ -377,7 +384,7 @@ ArpOnFrameSentDpc (
   Request ArpOnFrameSentDpc as a DPC at TPL_CALLBACK.\r
 \r
   @param[in]  Event                  The Event this notify function registered to.\r
-  @param[in]  Context                Pointer to the context data registerd to the\r
+  @param[in]  Context                Pointer to the context data registered to the\r
                                      Event.\r
 \r
   @return None.\r
@@ -396,12 +403,11 @@ ArpOnFrameSent (
   QueueDpc (TPL_CALLBACK, ArpOnFrameSentDpc, Context);\r
 }\r
 \r
-\r
 /**\r
   Process the arp cache olding and drive the retrying arp requests.\r
 \r
   @param[in]  Event                  The Event this notify function registered to.\r
-  @param[in]  Context                Pointer to the context data registerd to the\r
+  @param[in]  Context                Pointer to the context data registered to the\r
                                      Event.\r
 \r
   @return None.\r
@@ -449,7 +455,7 @@ ArpTimerHandler (
         //\r
         // resend the ARP request.\r
         //\r
-        ASSERT (!IsListEmpty(&CacheEntry->UserRequestList));\r
+        ASSERT (!IsListEmpty (&CacheEntry->UserRequestList));\r
 \r
         ContextEntry   = CacheEntry->UserRequestList.ForwardLink;\r
         RequestContext = NET_LIST_USER_STRUCT (ContextEntry, USER_REQUEST_CONTEXT, List);\r
@@ -524,7 +530,6 @@ ArpTimerHandler (
   }\r
 }\r
 \r
-\r
 /**\r
   Match the two NET_ARP_ADDRESSes.\r
 \r
@@ -543,7 +548,8 @@ ArpMatchAddress (
   ASSERT (AddressOne != NULL && AddressTwo != NULL);\r
 \r
   if ((AddressOne->Type != AddressTwo->Type) ||\r
-    (AddressOne->Length != AddressTwo->Length)) {\r
+      (AddressOne->Length != AddressTwo->Length))\r
+  {\r
     //\r
     // Either Type or Length doesn't match.\r
     //\r
@@ -551,11 +557,12 @@ ArpMatchAddress (
   }\r
 \r
   if ((AddressOne->AddressPtr != NULL) &&\r
-    (CompareMem (\r
-      AddressOne->AddressPtr,\r
-      AddressTwo->AddressPtr,\r
-      AddressOne->Length\r
-      ) != 0)) {\r
+      (CompareMem (\r
+         AddressOne->AddressPtr,\r
+         AddressTwo->AddressPtr,\r
+         AddressOne->Length\r
+         ) != 0))\r
+  {\r
     //\r
     // The address is not the same.\r
     //\r
@@ -565,7 +572,6 @@ ArpMatchAddress (
   return TRUE;\r
 }\r
 \r
-\r
 /**\r
   Find the CacheEntry which matches the requirements in the specified CacheTable.\r
 \r
@@ -581,11 +587,11 @@ ArpMatchAddress (
 **/\r
 ARP_CACHE_ENTRY *\r
 ArpFindNextCacheEntryInTable (\r
-  IN LIST_ENTRY        *CacheTable,\r
-  IN LIST_ENTRY        *StartEntry,\r
-  IN FIND_OPTYPE       FindOpType,\r
-  IN NET_ARP_ADDRESS   *ProtocolAddress OPTIONAL,\r
-  IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL\r
+  IN LIST_ENTRY       *CacheTable,\r
+  IN LIST_ENTRY       *StartEntry,\r
+  IN FIND_OPTYPE      FindOpType,\r
+  IN NET_ARP_ADDRESS  *ProtocolAddress OPTIONAL,\r
+  IN NET_ARP_ADDRESS  *HardwareAddress OPTIONAL\r
   )\r
 {\r
   LIST_ENTRY       *Entry;\r
@@ -637,7 +643,6 @@ ArpFindNextCacheEntryInTable (
   return NULL;\r
 }\r
 \r
-\r
 /**\r
   Find the CacheEntry, using ProtocolAddress or HardwareAddress or both, as the keyword,\r
   in the DeniedCacheTable.\r
@@ -698,7 +703,6 @@ ArpFindDeniedCacheEntry (
   return CacheEntry;\r
 }\r
 \r
-\r
 /**\r
   Allocate a cache entry and initialize it.\r
 \r
@@ -734,7 +738,7 @@ ArpAllocCacheEntry (
     //\r
     // Init the address pointers to point to the concrete buffer.\r
     //\r
-    Address = &CacheEntry->Addresses[Index];\r
+    Address             = &CacheEntry->Addresses[Index];\r
     Address->AddressPtr = Address->Buffer.ProtoAddress;\r
   }\r
 \r
@@ -765,7 +769,6 @@ ArpAllocCacheEntry (
   return CacheEntry;\r
 }\r
 \r
-\r
 /**\r
   Turn the CacheEntry into the resolved status.\r
 \r
@@ -797,7 +800,8 @@ ArpAddressResolved (
     Context = NET_LIST_USER_STRUCT (Entry, USER_REQUEST_CONTEXT, List);\r
 \r
     if (((Instance == NULL) || (Context->Instance == Instance)) &&\r
-      ((UserEvent == NULL) || (Context->UserRequestEvent == UserEvent))) {\r
+        ((UserEvent == NULL) || (Context->UserRequestEvent == UserEvent)))\r
+    {\r
       //\r
       // Copy the address to the user-provided buffer and notify the user.\r
       //\r
@@ -826,7 +830,6 @@ ArpAddressResolved (
   return Count;\r
 }\r
 \r
-\r
 /**\r
   Fill the addresses in the CacheEntry using the information passed in by\r
   HwAddr and SwAddr.\r
@@ -881,7 +884,6 @@ ArpFillAddressInCacheEntry (
   }\r
 }\r
 \r
-\r
 /**\r
   Configure the instance using the ConfigData. ConfigData is already validated.\r
 \r
@@ -912,18 +914,18 @@ ArpConfigureInstance (
   OldConfigData = &Instance->ConfigData;\r
 \r
   if (ConfigData != NULL) {\r
-\r
     if (Instance->Configured) {\r
       //\r
       // The instance is configured, check the unchangeable fields.\r
       //\r
       if ((OldConfigData->SwAddressType != ConfigData->SwAddressType) ||\r
-        (OldConfigData->SwAddressLength != ConfigData->SwAddressLength) ||\r
-        (CompareMem (\r
-           OldConfigData->StationAddress,\r
-           ConfigData->StationAddress,\r
-           OldConfigData->SwAddressLength\r
-           ) != 0)) {\r
+          (OldConfigData->SwAddressLength != ConfigData->SwAddressLength) ||\r
+          (CompareMem (\r
+             OldConfigData->StationAddress,\r
+             ConfigData->StationAddress,\r
+             OldConfigData->SwAddressLength\r
+             ) != 0))\r
+      {\r
         //\r
         // Deny the unallowed changes.\r
         //\r
@@ -952,8 +954,11 @@ ArpConfigureInstance (
 \r
       OldConfigData->StationAddress = AllocatePool (OldConfigData->SwAddressLength);\r
       if (OldConfigData->StationAddress == NULL) {\r
-        DEBUG ((EFI_D_ERROR, "ArpConfigInstance: AllocatePool for the StationAddress "\r
-          "failed.\n"));\r
+        DEBUG ((\r
+          DEBUG_ERROR,\r
+          "ArpConfigInstance: AllocatePool for the StationAddress "\r
+          "failed.\n"\r
+          ));\r
         return EFI_OUT_OF_RESOURCES;\r
       }\r
 \r
@@ -976,13 +981,13 @@ ArpConfigureInstance (
     // Use the implementation specific values if the following field is zero.\r
     //\r
     OldConfigData->EntryTimeOut = (ConfigData->EntryTimeOut == 0) ?\r
-      ARP_DEFAULT_TIMEOUT_VALUE : ConfigData->EntryTimeOut;\r
+                                  ARP_DEFAULT_TIMEOUT_VALUE : ConfigData->EntryTimeOut;\r
 \r
-    OldConfigData->RetryCount   = (ConfigData->RetryCount == 0) ?\r
-      ARP_DEFAULT_RETRY_COUNT : ConfigData->RetryCount;\r
+    OldConfigData->RetryCount = (ConfigData->RetryCount == 0) ?\r
+                                ARP_DEFAULT_RETRY_COUNT : ConfigData->RetryCount;\r
 \r
     OldConfigData->RetryTimeOut = (ConfigData->RetryTimeOut == 0) ?\r
-      ARP_DEFAULT_RETRY_INTERVAL : ConfigData->RetryTimeOut;\r
+                                  ARP_DEFAULT_RETRY_INTERVAL : ConfigData->RetryTimeOut;\r
   } else {\r
     //\r
     // Reset the configuration.\r
@@ -1006,9 +1011,8 @@ ArpConfigureInstance (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  Send out an arp frame using the CachEntry and the ArpOpCode.\r
+  Send out an arp frame using the CacheEntry and the ArpOpCode.\r
 \r
   @param[in]  Instance               Pointer to the instance context data.\r
   @param[in]  CacheEntry             Pointer to the configuration data used to\r
@@ -1042,9 +1046,9 @@ ArpSendFrame (
   //\r
   // Allocate memory for the TxToken.\r
   //\r
-  TxToken = AllocatePool (sizeof(EFI_MANAGED_NETWORK_COMPLETION_TOKEN));\r
+  TxToken = AllocatePool (sizeof (EFI_MANAGED_NETWORK_COMPLETION_TOKEN));\r
   if (TxToken == NULL) {\r
-    DEBUG ((EFI_D_ERROR, "ArpSendFrame: Allocate memory for TxToken failed.\n"));\r
+    DEBUG ((DEBUG_ERROR, "ArpSendFrame: Allocate memory for TxToken failed.\n"));\r
     return;\r
   }\r
 \r
@@ -1063,16 +1067,16 @@ ArpSendFrame (
                   &TxToken->Event\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((EFI_D_ERROR, "ArpSendFrame: CreateEvent failed for TxToken->Event.\n"));\r
+    DEBUG ((DEBUG_ERROR, "ArpSendFrame: CreateEvent failed for TxToken->Event.\n"));\r
     goto CLEAN_EXIT;\r
   }\r
 \r
   //\r
   // Allocate memory for the TxData used in the TxToken.\r
   //\r
-  TxData = AllocatePool (sizeof(EFI_MANAGED_NETWORK_TRANSMIT_DATA));\r
+  TxData = AllocatePool (sizeof (EFI_MANAGED_NETWORK_TRANSMIT_DATA));\r
   if (TxData == NULL) {\r
-    DEBUG ((EFI_D_ERROR, "ArpSendFrame: Allocate memory for TxData failed.\n"));\r
+    DEBUG ((DEBUG_ERROR, "ArpSendFrame: Allocate memory for TxData failed.\n"));\r
     goto CLEAN_EXIT;\r
   }\r
 \r
@@ -1091,7 +1095,7 @@ ArpSendFrame (
   //\r
   Packet = AllocatePool (TotalLength);\r
   if (Packet == NULL) {\r
-    DEBUG ((EFI_D_ERROR, "ArpSendFrame: Allocate memory for Packet failed.\n"));\r
+    DEBUG ((DEBUG_ERROR, "ArpSendFrame: Allocate memory for Packet failed.\n"));\r
     ASSERT (Packet != NULL);\r
   }\r
 \r
@@ -1109,6 +1113,7 @@ ArpSendFrame (
       SnpMode->HwAddressSize\r
       );\r
   }\r
+\r
   TmpPtr += SnpMode->HwAddressSize;\r
 \r
   //\r
@@ -1121,18 +1126,18 @@ ArpSendFrame (
   // The ethernet protocol type.\r
   //\r
   *(UINT16 *)TmpPtr = HTONS (ARP_ETHER_PROTO_TYPE);\r
-  TmpPtr            += 2;\r
+  TmpPtr           += 2;\r
 \r
   //\r
   // The ARP Head.\r
   //\r
-  ArpHead               = (ARP_HEAD *) TmpPtr;\r
+  ArpHead               = (ARP_HEAD *)TmpPtr;\r
   ArpHead->HwType       = HTONS ((UINT16)SnpMode->IfType);\r
   ArpHead->ProtoType    = HTONS (ConfigData->SwAddressType);\r
   ArpHead->HwAddrLen    = (UINT8)SnpMode->HwAddressSize;\r
   ArpHead->ProtoAddrLen = ConfigData->SwAddressLength;\r
   ArpHead->OpCode       = HTONS (ArpOpCode);\r
-  TmpPtr                += sizeof (ARP_HEAD);\r
+  TmpPtr               += sizeof (ARP_HEAD);\r
 \r
   //\r
   // The sender hardware address.\r
@@ -1172,7 +1177,7 @@ ArpSendFrame (
   TxData->SourceAddress      = NULL;\r
   TxData->ProtocolType       = 0;\r
   TxData->DataLength         = TotalLength - SnpMode->MediaHeaderSize;\r
-  TxData->HeaderLength       = (UINT16) SnpMode->MediaHeaderSize;\r
+  TxData->HeaderLength       = (UINT16)SnpMode->MediaHeaderSize;\r
   TxData->FragmentCount      = 1;\r
 \r
   TxData->FragmentTable[0].FragmentBuffer = Packet;\r
@@ -1189,7 +1194,7 @@ ArpSendFrame (
   //\r
   Status = ArpService->Mnp->Transmit (ArpService->Mnp, TxToken);\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((EFI_D_ERROR, "Mnp->Transmit failed, %r.\n", Status));\r
+    DEBUG ((DEBUG_ERROR, "Mnp->Transmit failed, %r.\n", Status));\r
     goto CLEAN_EXIT;\r
   }\r
 \r
@@ -1212,7 +1217,6 @@ CLEAN_EXIT:
   FreePool (TxToken);\r
 }\r
 \r
-\r
 /**\r
   Delete the cache entries in the specified CacheTable, using the BySwAddress,\r
   SwAddressType, AddressBuffer combination as the matching key, if Force is TRUE,\r
@@ -1231,11 +1235,11 @@ CLEAN_EXIT:
 **/\r
 UINTN\r
 ArpDeleteCacheEntryInTable (\r
-  IN LIST_ENTRY      *CacheTable,\r
-  IN BOOLEAN         BySwAddress,\r
-  IN UINT16          SwAddressType,\r
-  IN UINT8           *AddressBuffer OPTIONAL,\r
-  IN BOOLEAN         Force\r
+  IN LIST_ENTRY  *CacheTable,\r
+  IN BOOLEAN     BySwAddress,\r
+  IN UINT16      SwAddressType,\r
+  IN UINT8       *AddressBuffer OPTIONAL,\r
+  IN BOOLEAN     Force\r
   )\r
 {\r
   LIST_ENTRY       *Entry;\r
@@ -1261,11 +1265,12 @@ ArpDeleteCacheEntryInTable (
         // Protocol address type matched. Check the address.\r
         //\r
         if ((AddressBuffer == NULL) ||\r
-          (CompareMem (\r
-             AddressBuffer,\r
-             CacheEntry->Addresses[Protocol].AddressPtr,\r
-             CacheEntry->Addresses[Protocol].Length\r
-             ) == 0)) {\r
+            (CompareMem (\r
+               AddressBuffer,\r
+               CacheEntry->Addresses[Protocol].AddressPtr,\r
+               CacheEntry->Addresses[Protocol].Length\r
+               ) == 0))\r
+        {\r
           //\r
           // Address matched.\r
           //\r
@@ -1274,11 +1279,12 @@ ArpDeleteCacheEntryInTable (
       }\r
     } else {\r
       if ((AddressBuffer == NULL) ||\r
-        (CompareMem (\r
-           AddressBuffer,\r
-           CacheEntry->Addresses[Hardware].AddressPtr,\r
-           CacheEntry->Addresses[Hardware].Length\r
-           ) == 0)) {\r
+          (CompareMem (\r
+             AddressBuffer,\r
+             CacheEntry->Addresses[Hardware].AddressPtr,\r
+             CacheEntry->Addresses[Hardware].Length\r
+             ) == 0))\r
+      {\r
         //\r
         // Address matched.\r
         //\r
@@ -1303,7 +1309,6 @@ MATCHED:
   return Count;\r
 }\r
 \r
-\r
 /**\r
   Delete cache entries in all the cache tables.\r
 \r
@@ -1344,7 +1349,7 @@ ArpDeleteCacheEntry (
             );\r
 \r
   //\r
-  // Delete the cache entries inthe ResolvedCacheTable.\r
+  // Delete the cache entries in the ResolvedCacheTable.\r
   //\r
   Count += ArpDeleteCacheEntryInTable (\r
              &ArpService->ResolvedCacheTable,\r
@@ -1357,7 +1362,6 @@ ArpDeleteCacheEntry (
   return Count;\r
 }\r
 \r
-\r
 /**\r
   Cancel the arp request.\r
 \r
@@ -1392,11 +1396,12 @@ ArpCancelRequest (
     CacheEntry = NET_LIST_USER_STRUCT (Entry, ARP_CACHE_ENTRY, List);\r
 \r
     if ((TargetSwAddress == NULL) ||\r
-      (CompareMem (\r
-         TargetSwAddress,\r
-         CacheEntry->Addresses[Protocol].AddressPtr,\r
-         CacheEntry->Addresses[Protocol].Length\r
-         ) == 0)) {\r
+        (CompareMem (\r
+           TargetSwAddress,\r
+           CacheEntry->Addresses[Protocol].AddressPtr,\r
+           CacheEntry->Addresses[Protocol].Length\r
+           ) == 0))\r
+    {\r
       //\r
       // This request entry matches the TargetSwAddress or all requests are to be\r
       // cancelled as TargetSwAddress is NULL.\r
@@ -1416,7 +1421,6 @@ ArpCancelRequest (
   return Count;\r
 }\r
 \r
-\r
 /**\r
   Find the cache entry in the cache table.\r
 \r
@@ -1466,7 +1470,7 @@ ArpFindCacheEntry (
   ArpService = Instance->ArpService;\r
 \r
   //\r
-  // Init the FounEntries used to hold the found cache entries.\r
+  // Init the FoundEntries used to hold the found cache entries.\r
   //\r
   NetMapInit (&FoundEntries);\r
 \r
@@ -1572,7 +1576,7 @@ ArpFindCacheEntry (
 \r
   Status = EFI_SUCCESS;\r
 \r
-  FoundCount = (UINT32) NetMapGetCount (&FoundEntries);\r
+  FoundCount = (UINT32)NetMapGetCount (&FoundEntries);\r
   if (FoundCount == 0) {\r
     Status = EFI_NOT_FOUND;\r
     goto CLEAN_EXIT;\r
@@ -1582,7 +1586,7 @@ ArpFindCacheEntry (
   // Found the entry length, make sure its 8 bytes alignment.\r
   //\r
   FoundEntryLength = (((sizeof (EFI_ARP_FIND_DATA) + Instance->ConfigData.SwAddressLength +\r
-                       ArpService->SnpMode.HwAddressSize) + 3) & ~(0x3));\r
+                        ArpService->SnpMode.HwAddressSize) + 3) & ~(0x3));\r
 \r
   if (EntryLength != NULL) {\r
     *EntryLength = FoundEntryLength;\r
@@ -1604,7 +1608,7 @@ ArpFindCacheEntry (
   //\r
   FindData = AllocatePool (FoundCount * FoundEntryLength);\r
   if (FindData == NULL) {\r
-    DEBUG ((EFI_D_ERROR, "ArpFindCacheEntry: Failed to allocate memory.\n"));\r
+    DEBUG ((DEBUG_ERROR, "ArpFindCacheEntry: Failed to allocate memory.\n"));\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto CLEAN_EXIT;\r
   }\r
@@ -1664,4 +1668,3 @@ CLEAN_EXIT:
 \r
   return Status;\r
 }\r
-\r