]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c
1. update timeout interval time from 10ms to 50ms
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Udp4Dxe / Udp4Impl.c
index 4c7a6fdc33aa961512c2061fef01a44f7d128e22..8d392eee1c4f16f869c9158b6c63c84fdd6d6126 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
+  The implementation of the Udp4 protocol.\r
+  \r
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>                                                         \r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -9,15 +10,6 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  Udp4Impl.c\r
-\r
-Abstract:\r
-\r
-  The implementation of the Udp4 protocol.\r
-\r
-\r
 **/\r
 \r
 \r
@@ -29,11 +21,9 @@ UINT16  mUdp4RandomPort;
   This function checks and timeouts the I/O datagrams holding by the corresponding\r
   service context.\r
 \r
-  @param  Event                  The event this function registered to.\r
-  @param  Context                The context data registered during the creation of\r
-                                 the Event.\r
-\r
-  @return None.\r
+  @param[in]  Event                  The event this function registered to.\r
+  @param[in]  Context                The context data registered during the creation of\r
+                                     the Event.\r
 \r
 **/\r
 VOID\r
@@ -46,10 +36,10 @@ Udp4CheckTimeout (
 /**\r
   This function finds the udp instance by the specified <Address, Port> pair.\r
 \r
-  @param  InstanceList           Pointer to the head of the list linking the udp\r
-                                 instances.\r
-  @param  Address                Pointer to the specified IPv4 address.\r
-  @param  Port                   The udp port number.\r
+  @param[in]  InstanceList           Pointer to the head of the list linking the udp\r
+                                     instances.\r
+  @param[in]  Address                Pointer to the specified IPv4 address.\r
+  @param[in]  Port                   The udp port number.\r
 \r
   @retval TRUE     The specified <Address, Port> pair is found.\r
   @retval FALSE    Otherwise.\r
@@ -67,12 +57,10 @@ Udp4FindInstanceByPort (
   interface. It's called to signal the udp TxToken when IpIo layer completes the\r
   transmitting of the udp datagram.\r
 \r
-  @param  Status                 The completion status of the output udp datagram.\r
-  @param  Context                Pointer to the context data.\r
-  @param  Sender                 Pointer to the Ip sender of the udp datagram.\r
-  @param  NotifyData             Pointer to the notify data.\r
-\r
-  @return None.\r
+  @param[in]  Status                 The completion status of the output udp datagram.\r
+  @param[in]  Context                Pointer to the context data.\r
+  @param[in]  Sender                 Pointer to the Ip sender of the udp datagram.\r
+  @param[in]  NotifyData             Pointer to the notify data.\r
 \r
 **/\r
 VOID\r
@@ -86,15 +74,13 @@ Udp4DgramSent (
 /**\r
   This function processes the received datagram passed up by the IpIo layer.\r
 \r
-  @param  Status                 The status of this udp datagram.\r
-  @param  IcmpError              The IcmpError code, only available when Status is\r
+  @param[in]  Status             The status of this udp datagram.\r
+  @param[in]  IcmpError          The IcmpError code, only available when Status is\r
                                  EFI_ICMP_ERROR.\r
-  @param  NetSession             Pointer to the EFI_NET_SESSION_DATA.\r
-  @param  Packet                 Pointer to the NET_BUF containing the received udp\r
+  @param[in]  NetSession         Pointer to the EFI_NET_SESSION_DATA.\r
+  @param[in]  Packet             Pointer to the NET_BUF containing the received udp\r
                                  datagram.\r
-  @param  Context                Pointer to the context data.\r
-\r
-  @return None.\r
+  @param[in]  Context            Pointer to the context data.\r
 \r
 **/\r
 VOID\r
@@ -110,9 +96,9 @@ Udp4DgramRcvd (
   This function cancels the token specified by Arg in the Map. This is a callback\r
   used by Udp4InstanceCancelToken().\r
 \r
-  @param  Map                    Pointer to the NET_MAP.\r
-  @param  Item                   Pointer to the NET_MAP_ITEM.\r
-  @param  Arg                    Pointer to the token to be cancelled, if NULL,\r
+  @param[in]  Map                Pointer to the NET_MAP.\r
+  @param[in]  Item               Pointer to the NET_MAP_ITEM.\r
+  @param[in]  Arg                Pointer to the token to be cancelled, if NULL,\r
                                  the token specified by Item is cancelled.\r
 \r
   @retval EFI_SUCCESS            The token is cancelled if Arg is NULL or the token\r
@@ -132,8 +118,8 @@ Udp4CancelTokens (
 /**\r
   This function matches the received udp datagram with the Instance.\r
 \r
-  @param  Instance               Pointer to the udp instance context data.\r
-  @param  Udp4Session            Pointer to the EFI_UDP4_SESSION_DATA abstracted\r
+  @param[in]  Instance           Pointer to the udp instance context data.\r
+  @param[in]  Udp4Session        Pointer to the EFI_UDP4_SESSION_DATA abstracted\r
                                  from the received udp datagram.\r
 \r
   @retval TRUE       The udp datagram matches the receiving requirments of the\r
@@ -150,10 +136,8 @@ Udp4MatchDgram (
 /**\r
   This function removes the Wrap specified by Context and release relevant resources.\r
 \r
-  @param  Event                  The Event this notify function registered to.\r
-  @param  Context                Pointer to the context data.\r
-\r
-  @return None.\r
+  @param[in]  Event              The Event this notify function registered to.\r
+  @param[in]  Context            Pointer to the context data.\r
 \r
 **/\r
 VOID\r
@@ -166,11 +150,11 @@ Udp4RecycleRxDataWrap (
 /**\r
   This function wraps the Packet and the RxData.\r
 \r
-  @param  Instance               Pointer to the instance context data.\r
-  @param  Packet                 Pointer to the buffer containing the received\r
-                                 datagram.\r
-  @param  RxData                 Pointer to the EFI_UDP4_RECEIVE_DATA of this\r
-                                 datagram.\r
+  @param[in]  Instance               Pointer to the instance context data.\r
+  @param[in]  Packet                 Pointer to the buffer containing the received\r
+                                     datagram.\r
+  @param[in]  RxData                 Pointer to the EFI_UDP4_RECEIVE_DATA of this\r
+                                     datagram.\r
 \r
   @return Pointer to the structure wrapping the RxData and the Packet.\r
 \r
@@ -185,11 +169,11 @@ Udp4WrapRxData (
 /**\r
   This function enqueues the received datagram into the instances' receiving queues.\r
 \r
-  @param  Udp4Service            Pointer to the udp service context data.\r
-  @param  Packet                 Pointer to the buffer containing the received\r
-                                 datagram.\r
-  @param  RxData                 Pointer to the EFI_UDP4_RECEIVE_DATA of this\r
-                                 datagram.\r
+  @param[in]  Udp4Service            Pointer to the udp service context data.\r
+  @param[in]  Packet                 Pointer to the buffer containing the received\r
+                                     datagram.\r
+  @param[in]  RxData                 Pointer to the EFI_UDP4_RECEIVE_DATA of this\r
+                                     datagram.\r
 \r
   @return The times this datagram is enqueued.\r
 \r
@@ -204,9 +188,7 @@ Udp4EnqueueDgram (
 /**\r
   This function delivers the datagrams enqueued in the instances.\r
 \r
-  @param  Udp4Service            Pointer to the udp service context data.\r
-\r
-  @return None.\r
+  @param[in]  Udp4Service            Pointer to the udp service context data.\r
 \r
 **/\r
 VOID\r
@@ -217,13 +199,11 @@ Udp4DeliverDgram (
 /**\r
   This function demultiplexes the received udp datagram to the apropriate instances.\r
 \r
-  @param  Udp4Service            Pointer to the udp service context data.\r
-  @param  NetSession             Pointer to the EFI_NET_SESSION_DATA abstrated from\r
-                                 the received datagram.\r
-  @param  Packet                 Pointer to the buffer containing the received udp\r
-                                 datagram.\r
-\r
-  @return None.\r
+  @param[in]  Udp4Service            Pointer to the udp service context data.\r
+  @param[in]  NetSession             Pointer to the EFI_NET_SESSION_DATA abstrated from\r
+                                     the received datagram.\r
+  @param[in]  Packet                 Pointer to the buffer containing the received udp\r
+                                     datagram.\r
 \r
 **/\r
 VOID\r
@@ -237,13 +217,11 @@ Udp4Demultiplex (
   This function handles the received Icmp Error message and demultiplexes it to the\r
   instance.\r
 \r
-  @param  Udp4Service            Pointer to the udp service context data.\r
-  @param  IcmpError              The icmp error code.\r
-  @param  NetSession             Pointer to the EFI_NET_SESSION_DATA abstracted\r
+  @param[in]  Udp4Service            Pointer to the udp service context data.\r
+  @param[in]  IcmpError              The icmp error code.\r
+  @param[in]  NetSession             Pointer to the EFI_NET_SESSION_DATA abstracted\r
                                  from the received Icmp Error packet.\r
-  @param  Packet                 Pointer to the Icmp Error packet.\r
-\r
-  @return None.\r
+  @param[in]  Packet                 Pointer to the Icmp Error packet.\r
 \r
 **/\r
 VOID\r
@@ -257,13 +235,11 @@ Udp4IcmpHandler (
 /**\r
   This function builds and sends out a icmp port unreachable message.\r
 \r
-  @param  IpIo                   Pointer to the IP_IO instance.\r
-  @param  NetSession             Pointer to the EFI_NET_SESSION_DATA of the packet\r
-                                 causes this icmp error message.\r
-  @param  Udp4Header             Pointer to the udp header of the datagram causes\r
-                                 this icmp error message.\r
-\r
-  @return None.\r
+  @param[in]  IpIo                   Pointer to the IP_IO instance.\r
+  @param[in]  NetSession             Pointer to the EFI_NET_SESSION_DATA of the packet\r
+                                     causes this icmp error message.\r
+  @param[in]  Udp4Header             Pointer to the udp header of the datagram causes\r
+                                     this icmp error message.\r
 \r
 **/\r
 VOID\r
@@ -376,9 +352,7 @@ ON_ERROR:
 /**\r
   Clean the Udp service context data.\r
 \r
-  @param  Udp4Service            Pointer to the UDP4_SERVICE_DATA.\r
-\r
-  @return None.\r
+  @param[in]  Udp4Service            Pointer to the UDP4_SERVICE_DATA.\r
 \r
 **/\r
 VOID\r
@@ -407,11 +381,9 @@ Udp4CleanService (
   This function checks and timeouts the I/O datagrams holding by the corresponding\r
   service context.\r
 \r
-  @param  Event                  The event this function registered to.\r
-  @param  Context                The context data registered during the creation of\r
-                                 the Event.\r
-\r
-  @return None.\r
+  @param[in]  Event                  The event this function registered to.\r
+  @param[in]  Context                The context data registered during the creation of\r
+                                     the Event.\r
 \r
 **/\r
 VOID\r
@@ -451,13 +423,16 @@ Udp4CheckTimeout (
       //\r
       Wrap = NET_LIST_USER_STRUCT (WrapEntry, UDP4_RXDATA_WRAP, Link);\r
 \r
-      if (Wrap->TimeoutTick <= UDP4_TIMEOUT_INTERVAL / 10) {\r
+      //\r
+      // TimeoutTick unit is microsecond, MNP_TIMEOUT_CHECK_INTERVAL unit is 100ns.\r
+      //\r
+      if (Wrap->TimeoutTick <= (UDP4_TIMEOUT_INTERVAL / 10)) {\r
         //\r
         // Remove this RxData if it timeouts.\r
         //\r
         Udp4RecycleRxDataWrap (NULL, (VOID *) Wrap);\r
       } else {\r
-        Wrap->TimeoutTick -= UDP4_TIMEOUT_INTERVAL / 10;\r
+        Wrap->TimeoutTick -= (UDP4_TIMEOUT_INTERVAL / 10);\r
       }\r
     }\r
   }\r
@@ -470,8 +445,6 @@ Udp4CheckTimeout (
   @param  Udp4Service            Pointer to the UDP4_SERVICE_DATA.\r
   @param  Instance               Pointer to the un-initialized UDP4_INSTANCE_DATA.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 Udp4InitInstance (\r
@@ -513,9 +486,7 @@ Udp4InitInstance (
 /**\r
   This function cleans the udp instance.\r
 \r
-  @param  Instance               Pointer to the UDP4_INSTANCE_DATA to clean.\r
-\r
-  @return None.\r
+  @param[in]  Instance               Pointer to the UDP4_INSTANCE_DATA to clean.\r
 \r
 **/\r
 VOID\r
@@ -532,10 +503,10 @@ Udp4CleanInstance (
 /**\r
   This function finds the udp instance by the specified <Address, Port> pair.\r
 \r
-  @param  InstanceList           Pointer to the head of the list linking the udp\r
-                                 instances.\r
-  @param  Address                Pointer to the specified IPv4 address.\r
-  @param  Port                   The udp port number.\r
+  @param[in]  InstanceList           Pointer to the head of the list linking the udp\r
+                                     instances.\r
+  @param[in]  Address                Pointer to the specified IPv4 address.\r
+  @param[in]  Port                   The udp port number.\r
 \r
   @retval TRUE     The specified <Address, Port> pair is found.\r
   @retval FALSE    Otherwise.\r
@@ -669,9 +640,9 @@ Udp4Bind (
   This function is used to check whether the NewConfigData has any un-reconfigurable\r
   parameters changed compared to the OldConfigData.\r
 \r
-  @param  OldConfigData          Pointer to the current ConfigData the udp instance\r
+  @param[in]  OldConfigData      Pointer to the current ConfigData the udp instance\r
                                  uses.\r
-  @param  NewConfigData          Pointer to the new ConfigData.\r
+  @param[in]  NewConfigData      Pointer to the new ConfigData.\r
 \r
   @retval TRUE     The instance is reconfigurable.\r
   @retval FALSE    Otherwise.\r
@@ -750,10 +721,8 @@ Udp4IsReconfigurable (
 /**\r
   This function builds the Ip4 configdata from the Udp4ConfigData.\r
 \r
-  @param  Udp4ConfigData         Pointer to the EFI_UDP4_CONFIG_DATA.\r
-  @param  Ip4ConfigData          Pointer to the EFI_IP4_CONFIG_DATA.\r
-\r
-  @return None.\r
+  @param[in]       Udp4ConfigData    Pointer to the EFI_UDP4_CONFIG_DATA.\r
+  @param[in, out]  Ip4ConfigData     Pointer to the EFI_IP4_CONFIG_DATA.\r
 \r
 **/\r
 VOID\r
@@ -781,8 +750,8 @@ Udp4BuildIp4ConfigData (
 /**\r
   This function validates the TxToken, it returns the error code according to the spec.\r
 \r
-  @param  Instance               Pointer to the udp instance context data.\r
-  @param  TxToken                Pointer to the token to be checked.\r
+  @param[in]  Instance           Pointer to the udp instance context data.\r
+  @param[in]  TxToken            Pointer to the token to be checked.\r
 \r
   @retval EFI_SUCCESS            The TxToken is valid.\r
   @retval EFI_INVALID_PARAMETER  One or more of the following are TRUE: This is\r
@@ -908,10 +877,10 @@ Udp4ValidateTxToken (
 /**\r
   This function checks whether the specified Token duplicates with the one in the Map.\r
 \r
-  @param  Map                    Pointer to the NET_MAP.\r
-  @param  Item                   Pointer to the NET_MAP_ITEM contain the pointer to\r
+  @param[in]  Map                Pointer to the NET_MAP.\r
+  @param[in]  Item               Pointer to the NET_MAP_ITEM contain the pointer to\r
                                  the Token.\r
-  @param  Context                Pointer to the Token to be checked.\r
+  @param[in]  Context            Pointer to the Token to be checked.\r
 \r
   @retval EFI_SUCCESS            The Token specified by Context differs from the\r
                                  one in the Item.\r
@@ -947,11 +916,11 @@ Udp4TokenExist (
   This function calculates the checksum for the Packet, utilizing the pre-calculated\r
   pseudo HeadSum to reduce some overhead.\r
 \r
-  @param  Packet                 Pointer to the NET_BUF contains the udp datagram.\r
-  @param  HeadSum                Checksum of the pseudo header execpt the length\r
+  @param[in]  Packet             Pointer to the NET_BUF contains the udp datagram.\r
+  @param[in]  HeadSum            Checksum of the pseudo header execpt the length\r
                                  field.\r
 \r
-  @return The 16-bit checksum of this udp datagram.\r
+  @retval The 16-bit checksum of this udp datagram.\r
 \r
 **/\r
 UINT16\r
@@ -974,8 +943,8 @@ Udp4Checksum (
 /**\r
   This function removes the specified Token from the TokenMap.\r
 \r
-  @param  TokenMap               Pointer to the NET_MAP containing the tokens.\r
-  @param  Token                  Pointer to the Token to be removed.\r
+  @param  TokenMap           Pointer to the NET_MAP containing the tokens.\r
+  @param  Token              Pointer to the Token to be removed.\r
 \r
   @retval EFI_SUCCESS            The specified Token is removed from the TokenMap.\r
   @retval EFI_NOT_FOUND          The specified Token is not found in the TokenMap.\r
@@ -1012,12 +981,10 @@ Udp4RemoveToken (
   interface. It's called to signal the udp TxToken when IpIo layer completes the\r
   transmitting of the udp datagram.\r
 \r
-  @param  Status                 The completion status of the output udp datagram.\r
-  @param  Context                Pointer to the context data.\r
-  @param  Sender                 Pointer to the Ip sender of the udp datagram.\r
-  @param  NotifyData             Pointer to the notify data.\r
-\r
-  @return None.\r
+  @param[in]  Status                 The completion status of the output udp datagram.\r
+  @param[in]  Context                Pointer to the context data.\r
+  @param[in]  Sender                 Pointer to the Ip sender of the udp datagram.\r
+  @param[in]  NotifyData             Pointer to the notify data.\r
 \r
 **/\r
 VOID\r
@@ -1040,7 +1007,7 @@ Udp4DgramSent (
     //\r
     Token->Status = Status;\r
     gBS->SignalEvent (Token->Event);\r
-    NetLibDispatchDpc ();\r
+    DispatchDpc ();\r
   }\r
 }\r
 \r
@@ -1048,15 +1015,13 @@ Udp4DgramSent (
 /**\r
   This function processes the received datagram passed up by the IpIo layer.\r
 \r
-  @param  Status                 The status of this udp datagram.\r
-  @param  IcmpError              The IcmpError code, only available when Status is\r
+  @param[in]  Status             The status of this udp datagram.\r
+  @param[in]  IcmpError          The IcmpError code, only available when Status is\r
                                  EFI_ICMP_ERROR.\r
-  @param  NetSession             Pointer to the EFI_NET_SESSION_DATA.\r
-  @param  Packet                 Pointer to the NET_BUF containing the received udp\r
+  @param[in]  NetSession         Pointer to the EFI_NET_SESSION_DATA.\r
+  @param[in]  Packet             Pointer to the NET_BUF containing the received udp\r
                                  datagram.\r
-  @param  Context                Pointer to the context data.\r
-\r
-  @return None.\r
+  @param[in]  Context            Pointer to the context data.\r
 \r
 **/\r
 VOID\r
@@ -1089,7 +1054,7 @@ Udp4DgramRcvd (
   // Dispatch the DPC queued by the NotifyFunction of the rx token's events\r
   // which are signaled with received data.\r
   //\r
-  NetLibDispatchDpc ();\r
+  DispatchDpc ();\r
 }\r
 \r
 \r
@@ -1145,9 +1110,9 @@ Udp4LeaveGroup (
   This function cancels the token specified by Arg in the Map. This is a callback\r
   used by Udp4InstanceCancelToken().\r
 \r
-  @param  Map                    Pointer to the NET_MAP.\r
-  @param  Item                   Pointer to the NET_MAP_ITEM.\r
-  @param  Arg                    Pointer to the token to be cancelled, if NULL,\r
+  @param[in]  Map                Pointer to the NET_MAP.\r
+  @param[in]  Item               Pointer to the NET_MAP_ITEM.\r
+  @param[in]  Arg                Pointer to the token to be cancelled, if NULL,\r
                                  the token specified by Item is cancelled.\r
 \r
   @retval EFI_SUCCESS            The token is cancelled if Arg is NULL or the token\r
@@ -1205,9 +1170,7 @@ Udp4CancelTokens (
 /**\r
   This function removes all the Wrap datas in the RcvdDgramQue.\r
 \r
-  @param  Instance           Pointer to the udp instance context data.\r
-\r
-  @return None.\r
+  @param[in]  Instance           Pointer to the udp instance context data.\r
 \r
 **/\r
 VOID\r
@@ -1235,8 +1198,8 @@ Udp4FlushRcvdDgram (
 /**\r
   Cancel Udp4 tokens from the Udp4 instance.\r
 \r
-  @param  Instance               Pointer to the udp instance context data.\r
-  @param  Token                  Pointer to the token to be canceled, if NULL, all\r
+  @param[in]  Instance           Pointer to the udp instance context data.\r
+  @param[in]  Token              Pointer to the token to be canceled, if NULL, all\r
                                  tokens in this instance will be cancelled.\r
 \r
   @retval EFI_SUCCESS            The Token is cancelled.\r
@@ -1288,8 +1251,8 @@ Udp4InstanceCancelToken (
 /**\r
   This function matches the received udp datagram with the Instance.\r
 \r
-  @param  Instance               Pointer to the udp instance context data.\r
-  @param  Udp4Session            Pointer to the EFI_UDP4_SESSION_DATA abstracted\r
+  @param[in]  Instance           Pointer to the udp instance context data.\r
+  @param[in]  Udp4Session        Pointer to the EFI_UDP4_SESSION_DATA abstracted\r
                                  from the received udp datagram.\r
 \r
   @retval TRUE       The udp datagram matches the receiving requirments of the\r
@@ -1368,10 +1331,8 @@ Udp4MatchDgram (
 /**\r
   This function removes the Wrap specified by Context and release relevant resources.\r
 \r
-  @param  Event                  The Event this notify function registered to.\r
-  @param  Context                Pointer to the context data.\r
-\r
-  @return None.\r
+  @param[in]  Event              The Event this notify function registered to.\r
+  @param[in]  Context            Pointer to the context data.\r
 \r
 **/\r
 VOID\r
@@ -1407,11 +1368,11 @@ Udp4RecycleRxDataWrap (
 /**\r
   This function wraps the Packet and the RxData.\r
 \r
-  @param  Instance               Pointer to the instance context data.\r
-  @param  Packet                 Pointer to the buffer containing the received\r
-                                 datagram.\r
-  @param  RxData                 Pointer to the EFI_UDP4_RECEIVE_DATA of this\r
-                                 datagram.\r
+  @param[in]  Instance               Pointer to the instance context data.\r
+  @param[in]  Packet                 Pointer to the buffer containing the received\r
+                                     datagram.\r
+  @param[in]  RxData                 Pointer to the EFI_UDP4_RECEIVE_DATA of this\r
+                                     datagram.\r
 \r
   @return Pointer to the structure wrapping the RxData and the Packet.\r
 \r
@@ -1464,11 +1425,11 @@ Udp4WrapRxData (
 /**\r
   This function enqueues the received datagram into the instances' receiving queues.\r
 \r
-  @param  Udp4Service            Pointer to the udp service context data.\r
-  @param  Packet                 Pointer to the buffer containing the received\r
-                                 datagram.\r
-  @param  RxData                 Pointer to the EFI_UDP4_RECEIVE_DATA of this\r
-                                 datagram.\r
+  @param[in]  Udp4Service            Pointer to the udp service context data.\r
+  @param[in]  Packet                 Pointer to the buffer containing the received\r
+                                     datagram.\r
+  @param[in]  RxData                 Pointer to the EFI_UDP4_RECEIVE_DATA of this\r
+                                     datagram.\r
 \r
   @return The times this datagram is enqueued.\r
 \r
@@ -1521,9 +1482,7 @@ Udp4EnqueueDgram (
 /**\r
   This function delivers the received datagrams for the specified instance.\r
 \r
-  @param  Instance               Pointer to the instance context data.\r
-\r
-  @return None.\r
+  @param[in]  Instance               Pointer to the instance context data.\r
 \r
 **/\r
 VOID\r
@@ -1587,9 +1546,7 @@ Udp4InstanceDeliverDgram (
 /**\r
   This function delivers the datagrams enqueued in the instances.\r
 \r
-  @param  Udp4Service            Pointer to the udp service context data.\r
-\r
-  @return None.\r
+  @param[in]  Udp4Service            Pointer to the udp service context data.\r
 \r
 **/\r
 VOID\r
@@ -1621,13 +1578,11 @@ Udp4DeliverDgram (
 /**\r
   This function demultiplexes the received udp datagram to the apropriate instances.\r
 \r
-  @param  Udp4Service            Pointer to the udp service context data.\r
-  @param  NetSession             Pointer to the EFI_NET_SESSION_DATA abstrated from\r
-                                 the received datagram.\r
-  @param  Packet                 Pointer to the buffer containing the received udp\r
-                                 datagram.\r
-\r
-  @return None.\r
+  @param[in]  Udp4Service            Pointer to the udp service context data.\r
+  @param[in]  NetSession             Pointer to the EFI_NET_SESSION_DATA abstrated from\r
+                                     the received datagram.\r
+  @param[in]  Packet                 Pointer to the buffer containing the received udp\r
+                                     datagram.\r
 \r
 **/\r
 VOID\r
@@ -1712,13 +1667,11 @@ Udp4Demultiplex (
 /**\r
   This function builds and sends out a icmp port unreachable message.\r
 \r
-  @param  IpIo                   Pointer to the IP_IO instance.\r
-  @param  NetSession             Pointer to the EFI_NET_SESSION_DATA of the packet\r
-                                 causes this icmp error message.\r
-  @param  Udp4Header             Pointer to the udp header of the datagram causes\r
-                                 this icmp error message.\r
-\r
-  @return None.\r
+  @param[in]  IpIo                   Pointer to the IP_IO instance.\r
+  @param[in]  NetSession             Pointer to the EFI_NET_SESSION_DATA of the packet\r
+                                     causes this icmp error message.\r
+  @param[in]  Udp4Header             Pointer to the udp header of the datagram causes\r
+                                     this icmp error message.\r
 \r
 **/\r
 VOID\r
@@ -1765,6 +1718,7 @@ Udp4SendPortUnreach (
   // Allocate space for the IP4_ICMP_ERROR_HEAD.\r
   //\r
   IcmpErrHdr = (IP4_ICMP_ERROR_HEAD *) NetbufAllocSpace (Packet, Len, FALSE);\r
+  ASSERT (IcmpErrHdr != NULL);\r
 \r
   //\r
   // Set the required fields for the icmp port unreachable message.\r
@@ -1814,13 +1768,11 @@ Udp4SendPortUnreach (
   This function handles the received Icmp Error message and demultiplexes it to the\r
   instance.\r
 \r
-  @param  Udp4Service            Pointer to the udp service context data.\r
-  @param  IcmpError              The icmp error code.\r
-  @param  NetSession             Pointer to the EFI_NET_SESSION_DATA abstracted\r
+  @param[in]  Udp4Service            Pointer to the udp service context data.\r
+  @param[in]  IcmpError              The icmp error code.\r
+  @param[in]  NetSession             Pointer to the EFI_NET_SESSION_DATA abstracted\r
                                  from the received Icmp Error packet.\r
-  @param  Packet                 Pointer to the Icmp Error packet.\r
-\r
-  @return None.\r
+  @param[in]  Packet                 Pointer to the Icmp Error packet.\r
 \r
 **/\r
 VOID\r
@@ -1889,9 +1841,7 @@ Udp4IcmpHandler (
 /**\r
   This function reports the received ICMP error.\r
 \r
-  @param  Instance               Pointer to the udp instance context data.\r
-\r
-  @return None.\r
+  @param[in]  Instance               Pointer to the udp instance context data.\r
 \r
 **/\r
 VOID\r
@@ -1934,9 +1884,7 @@ Udp4ReportIcmpError (
   This function is a dummy ext-free function for the NET_BUF created for the output\r
   udp datagram.\r
 \r
-  @param  Context                Pointer to the context data.\r
-\r
-  @return None.\r
+  @param[in]  Context                Pointer to the context data.\r
 \r
 **/\r
 VOID\r
@@ -2086,9 +2034,7 @@ ON_ERROR:
 /**\r
   Clear the variable and free the resource.\r
 \r
-  @param  Udp4Service            Udp4 service data.\r
-\r
-  @return None.\r
+  @param[[in]  Udp4Service            Udp4 service data.\r
 \r
 **/\r
 VOID\r