]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Remove #include <Protocol/LoadedImage.h>
authorywu21 <ywu21@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 23 Dec 2008 07:22:15 +0000 (07:22 +0000)
committerywu21 <ywu21@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 23 Dec 2008 07:22:15 +0000 (07:22 +0000)
Remove //#include <Protocol/Ip4.h>
Remove  #include <Library/UefiLib.h>
Fix one function header description error

Fix filer header
Fix function header
Fix return status issues
Fix  in out issues
Fix  no Boolean expression issues

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7096 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
MdeModulePkg/Library/DxeNetLib/NetBuffer.c

index 1bf7e1f198dc79079f128fb306a4b9695c8edcc1..bb0ac06851ffd81ab68b12d38eaf11e4cce42ab0 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
-\r
-Copyright (c) 2005 - 2007, Intel Corporation\r
+  Network library.\r
+  \r
+Copyright (c) 2005 - 2007, 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
@@ -8,26 +9,15 @@ http://opensource.org/licenses/bsd-license.php
 \r
 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
-  NetLib.c\r
-\r
-Abstract:\r
-\r
-\r
-\r
 **/\r
 \r
-#include <PiDxe.h>\r
+#include <Uefi.h>\r
 \r
 #include <Protocol/ServiceBinding.h>\r
 #include <Protocol/SimpleNetwork.h>\r
-#include <Protocol/LoadedImage.h>\r
 #include <Protocol/NicIp4Config.h>\r
 #include <Protocol/ComponentName.h>\r
 #include <Protocol/ComponentName2.h>\r
-#include <Protocol/Ip4.h>\r
 #include <Protocol/Dpc.h>\r
 \r
 #include <Library/NetLib.h>\r
@@ -36,7 +26,6 @@ Abstract:
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/UefiLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DevicePathLib.h>\r
 \r
@@ -93,11 +82,10 @@ EFI_IPv4_ADDRESS  mZeroIp4Addr = {{0, 0, 0, 0}};
   return the invalid length 33, which is IP4_MASK_NUM.\r
   NetMask is in the host byte order.\r
 \r
-  @param  NetMask               The netmask to get the length from\r
-\r
-  @return The length of the netmask, IP4_MASK_NUM if the mask isn't\r
-  @return supported.\r
+  @param[in]  NetMask              The netmask to get the length from.\r
 \r
+  @return The length of the netmask, IP4_MASK_NUM if the mask isn't.\r
+  \r
 **/\r
 INTN\r
 EFIAPI\r
@@ -122,9 +110,9 @@ NetGetMaskLength (
   Return the class of the address, such as class a, b, c.\r
   Addr is in host byte order.\r
 \r
-  @param  Addr                  The address to get the class from\r
+  @param[in]   Addr                  The address to get the class from.\r
 \r
-  @return IP address class, such as IP4_ADDR_CLASSA\r
+  @return IP address class, such as IP4_ADDR_CLASSA.\r
 \r
 **/\r
 INTN\r
@@ -161,10 +149,10 @@ NetGetIpClass (
   the netmask. If NetMask is zero, use the IP address's class to\r
   get the default mask.\r
 \r
-  @param  Ip                    The IP to check againist\r
-  @param  NetMask               The mask of the IP\r
+  @param[in]  Ip                    The IP to check against.\r
+  @param[in]  NetMask               The mask of the IP.\r
 \r
-  @return TRUE if IP is a valid unicast address on the network, otherwise FALSE\r
+  @return TRUE if IP is a valid unicast address on the network, otherwise FALSE.\r
 \r
 **/\r
 BOOLEAN\r
@@ -197,8 +185,6 @@ Ip4IsUnicast (
 /**\r
   Initialize a random seed using current time.\r
 \r
-  None\r
-\r
   @return The random seed initialized with current time.\r
 \r
 **/\r
@@ -224,7 +210,7 @@ NetRandomInitSeed (
   Extract a UINT32 from a byte stream, then convert it to host\r
   byte order. Use this function to avoid alignment error.\r
 \r
-  @param  Buf                   The buffer to extract the UINT32.\r
+  @param[in]  Buf                 The buffer to extract the UINT32.\r
 \r
   @return The UINT32 extracted.\r
 \r
@@ -246,17 +232,15 @@ NetGetUint32 (
   Put a UINT32 to the byte stream. Convert it from host byte order\r
   to network byte order before putting.\r
 \r
-  @param  Buf                   The buffer to put the UINT32\r
-  @param  Data                  The data to put\r
-\r
-  @return None\r
-\r
+  @param[in, out]  Buf          The buffer to put the UINT32.\r
+  @param[in]      Data          The data to put.\r
+  \r
 **/\r
 VOID\r
 EFIAPI\r
 NetPutUint32 (\r
-  IN UINT8                  *Buf,\r
-  IN UINT32                 Data\r
+  IN OUT UINT8                 *Buf,\r
+  IN     UINT32                Data\r
   )\r
 {\r
   Data = HTONL (Data);\r
@@ -265,9 +249,9 @@ NetPutUint32 (
 \r
 \r
 /**\r
-  Remove the first entry on the list\r
+  Remove the first entry on the list.\r
 \r
-  @param  Head                  The list header\r
+  @param[in, out]  Head                  The list header.\r
 \r
   @return The entry that is removed from the list, NULL if the list is empty.\r
 \r
@@ -275,7 +259,7 @@ NetPutUint32 (
 LIST_ENTRY *\r
 EFIAPI\r
 NetListRemoveHead (\r
-  LIST_ENTRY            *Head\r
+  IN OUT LIST_ENTRY            *Head\r
   )\r
 {\r
   LIST_ENTRY            *First;\r
@@ -300,9 +284,9 @@ NetListRemoveHead (
 \r
 \r
 /**\r
-  Remove the last entry on the list\r
+  Remove the last entry on the list.\r
 \r
-  @param  Head                  The list head\r
+  @param[in, out]  Head                  The list head.\r
 \r
   @return The entry that is removed from the list, NULL if the list is empty.\r
 \r
@@ -310,7 +294,7 @@ NetListRemoveHead (
 LIST_ENTRY *\r
 EFIAPI\r
 NetListRemoveTail (\r
-  LIST_ENTRY            *Head\r
+  IN OUT LIST_ENTRY            *Head\r
   )\r
 {\r
   LIST_ENTRY            *Last;\r
@@ -335,19 +319,17 @@ NetListRemoveTail (
 \r
 \r
 /**\r
-  Insert the NewEntry after the PrevEntry\r
-\r
-  @param  PrevEntry             The previous entry to insert after\r
-  @param  NewEntry              The new entry to insert\r
+  Insert the NewEntry after the PrevEntry.\r
 \r
-  @return None\r
+  @param[in, out]  PrevEntry             The previous entry to insert after.\r
+  @param[in, out]  NewEntry              The new entry to insert.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 NetListInsertAfter (\r
-  IN LIST_ENTRY         *PrevEntry,\r
-  IN LIST_ENTRY         *NewEntry\r
+  IN OUT LIST_ENTRY         *PrevEntry,\r
+  IN OUT LIST_ENTRY         *NewEntry\r
   )\r
 {\r
   NewEntry->BackLink                = PrevEntry;\r
@@ -358,19 +340,17 @@ NetListInsertAfter (
 \r
 \r
 /**\r
-  Insert the NewEntry before the PostEntry\r
-\r
-  @param  PostEntry             The entry to insert before\r
-  @param  NewEntry              The new entry to insert\r
+  Insert the NewEntry before the PostEntry.\r
 \r
-  @return None\r
+  @param[in, out]  PostEntry             The entry to insert before.\r
+  @param[in, out]  NewEntry              The new entry to insert.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 NetListInsertBefore (\r
-  IN LIST_ENTRY     *PostEntry,\r
-  IN LIST_ENTRY     *NewEntry\r
+  IN OUT LIST_ENTRY     *PostEntry,\r
+  IN OUT LIST_ENTRY     *NewEntry\r
   )\r
 {\r
   NewEntry->ForwardLink             = PostEntry;\r
@@ -383,15 +363,13 @@ NetListInsertBefore (
 /**\r
   Initialize the netmap. Netmap is a reposity to keep the <Key, Value> pairs.\r
 \r
-  @param  Map                   The netmap to initialize\r
-\r
-  @return None\r
+  @param[in, out]  Map                   The netmap to initialize.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 NetMapInit (\r
-  IN NET_MAP                *Map\r
+  IN OUT NET_MAP                *Map\r
   )\r
 {\r
   ASSERT (Map != NULL);\r
@@ -405,15 +383,13 @@ NetMapInit (
 /**\r
   To clean up the netmap, that is, release allocated memories.\r
 \r
-  @param  Map                   The netmap to clean up.\r
-\r
-  @return None\r
+  @param[in, out]  Map                   The netmap to clean up.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 NetMapClean (\r
-  IN NET_MAP                *Map\r
+  IN OUT NET_MAP            *Map\r
   )\r
 {\r
   NET_MAP_ITEM              *Item;\r
@@ -445,9 +421,9 @@ NetMapClean (
 \r
 \r
 /**\r
-  Test whether the netmap is empty\r
+  Test whether the netmap is empty.\r
 \r
-  @param  Map                   The net map to test\r
+  @param[in]  Map                   The net map to test.\r
 \r
   @return TRUE if the netmap is empty, otherwise FALSE.\r
 \r
@@ -466,7 +442,7 @@ NetMapIsEmpty (
 /**\r
   Return the number of the <Key, Value> pairs in the netmap.\r
 \r
-  @param  Map                   The netmap to get the entry number\r
+  @param[in]  Map                   The netmap to get the entry number.\r
 \r
   @return The entry number in the netmap.\r
 \r
@@ -482,17 +458,18 @@ NetMapGetCount (
 \r
 \r
 /**\r
-  Allocate an item for the netmap. It will try to allocate\r
+  Allocate an item for the netmap. It will try to allocate.\r
   a batch of items and return one.\r
 \r
-  @param  Map                   The netmap to allocate item for\r
+  @param[in, out]  Map          The netmap to allocate item for.\r
 \r
-  @return The allocated item or NULL\r
+  @return                       The allocated item. If NULL, the\r
+                                allocation failed due to resource limit.\r
 \r
 **/\r
 NET_MAP_ITEM *\r
 NetMapAllocItem (\r
-  IN NET_MAP                *Map\r
+  IN OUT NET_MAP            *Map\r
   )\r
 {\r
   NET_MAP_ITEM              *Item;\r
@@ -529,18 +506,18 @@ NetMapAllocItem (
 /**\r
   Allocate an item to save the <Key, Value> pair to the head of the netmap.\r
 \r
-  @param  Map                   The netmap to insert into\r
-  @param  Key                   The user's key\r
-  @param  Value                 The user's value for the key\r
+  @param[in, out]  Map                   The netmap to insert into.\r
+  @param[in]       Key                   The user's key.\r
+  @param[in]       Value                 The user's value for the key.\r
 \r
-  @retval EFI_OUT_OF_RESOURCES  Failed to allocate the memory for the item\r
-  @retval EFI_SUCCESS           The item is inserted to the head\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate the memory for the item.\r
+  @retval EFI_SUCCESS           The item is inserted to the head.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 NetMapInsertHead (\r
-  IN NET_MAP                *Map,\r
+  IN OUT NET_MAP            *Map,\r
   IN VOID                   *Key,\r
   IN VOID                   *Value    OPTIONAL\r
   )\r
@@ -567,18 +544,18 @@ NetMapInsertHead (
 /**\r
   Allocate an item to save the <Key, Value> pair to the tail of the netmap.\r
 \r
-  @param  Map                   The netmap to insert into\r
-  @param  Key                   The user's key\r
-  @param  Value                 The user's value for the key\r
+  @param[in, out]  Map                   The netmap to insert into.\r
+  @param[in]       Key                   The user's key.\r
+  @param[in]       Value                 The user's value for the key.\r
 \r
-  @retval EFI_OUT_OF_RESOURCES  Failed to allocate the memory for the item\r
-  @retval EFI_SUCCESS           The item is inserted to the tail\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate the memory for the item.\r
+  @retval EFI_SUCCESS           The item is inserted to the tail.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 NetMapInsertTail (\r
-  IN NET_MAP                *Map,\r
+  IN OUT NET_MAP            *Map,\r
   IN VOID                   *Key,\r
   IN VOID                   *Value    OPTIONAL\r
   )\r
@@ -604,10 +581,10 @@ NetMapInsertTail (
 \r
 \r
 /**\r
-  Check whther the item is in the Map\r
+  Check whther the item is in the Map.\r
 \r
-  @param  Map                   The netmap to search within\r
-  @param  Item                  The item to search\r
+  @param[in]  Map                   The netmap to search within.\r
+  @param[in]  Item                  The item to search.\r
 \r
   @return TRUE if the item is in the netmap, otherwise FALSE.\r
 \r
@@ -631,10 +608,10 @@ NetItemInMap (
 \r
 \r
 /**\r
-  Find the key in the netmap\r
+  Find the key in the netmap.\r
 \r
-  @param  Map                   The netmap to search within\r
-  @param  Key                   The key to search\r
+  @param[in]  Map                   The netmap to search within.\r
+  @param[in]  Key                   The key to search.\r
 \r
   @return The point to the item contains the Key, or NULL if Key isn't in the map.\r
 \r
@@ -664,21 +641,21 @@ NetMapFindKey (
 \r
 \r
 /**\r
-  Remove the item from the netmap\r
+  Remove the item from the netmap.\r
 \r
-  @param  Map                   The netmap to remove the item from\r
-  @param  Item                  The item to remove\r
-  @param  Value                 The variable to receive the value if not NULL\r
+  @param[in, out]  Map                   The netmap to remove the item from.\r
+  @param[in, out]  Item                  The item to remove.\r
+  @param[out]      Value                 The variable to receive the value if not NULL.\r
 \r
-  @return The key of the removed item.\r
+  @return                                The key of the removed item.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 NetMapRemoveItem (\r
-  IN  NET_MAP             *Map,\r
-  IN  NET_MAP_ITEM        *Item,\r
-  OUT VOID                **Value           OPTIONAL\r
+  IN  OUT NET_MAP             *Map,\r
+  IN  OUT NET_MAP_ITEM        *Item,\r
+  OUT VOID                    **Value           OPTIONAL\r
   )\r
 {\r
   ASSERT ((Map != NULL) && (Item != NULL));\r
@@ -697,18 +674,18 @@ NetMapRemoveItem (
 \r
 \r
 /**\r
-  Remove the first entry on the netmap\r
+  Remove the first entry on the netmap.\r
 \r
-  @param  Map                   The netmap to remove the head from\r
-  @param  Value                 The variable to receive the value if not NULL\r
+  @param[in, out]  Map                   The netmap to remove the head from.\r
+  @param[out]      Value                 The variable to receive the value if not NULL.\r
 \r
-  @return The key of the item removed\r
+  @return                                The key of the item removed.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 NetMapRemoveHead (\r
-  IN  NET_MAP               *Map,\r
+  IN OUT NET_MAP            *Map,\r
   OUT VOID                  **Value         OPTIONAL\r
   )\r
 {\r
@@ -734,18 +711,18 @@ NetMapRemoveHead (
 \r
 \r
 /**\r
-  Remove the last entry on the netmap\r
+  Remove the last entry on the netmap.\r
 \r
-  @param  Map                   The netmap to remove the tail from\r
-  @param  Value                 The variable to receive the value if not NULL\r
+  @param[in, out]  Map                   The netmap to remove the tail from.\r
+  @param[out]      Value                 The variable to receive the value if not NULL.\r
 \r
-  @return The key of the item removed\r
+  @return                                The key of the item removed.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 NetMapRemoveTail (\r
-  IN  NET_MAP               *Map,\r
+  IN OUT NET_MAP            *Map,\r
   OUT VOID                  **Value       OPTIONAL\r
   )\r
 {\r
@@ -776,11 +753,13 @@ NetMapRemoveTail (
   from the loop. It returns the CallBack's last return value. This\r
   function is delete safe for the current item.\r
 \r
-  @param  Map                   The Map to iterate through\r
-  @param  CallBack              The callback function to call for each item.\r
-  @param  Arg                   The opaque parameter to the callback\r
+  @param[in]  Map                   The Map to iterate through.\r
+  @param[in]  CallBack              The callback function to call for each item.\r
+  @param[in]  Arg                   The opaque parameter to the callback.\r
 \r
-  @return It returns the CallBack's last return value.\r
+  @retval EFI_SUCCESS            There is no item in the netmap or CallBack for each item\r
+                                 return EFI_SUCCESS.\r
+  @retval Others                 It returns the CallBack's last return value.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -822,7 +801,7 @@ NetMapIterate (
 /**\r
   This is the default unload handle for all the network drivers.\r
 \r
-  @param  ImageHandle           The drivers' driver image.\r
+  @param[in]  ImageHandle       The drivers' driver image.\r
 \r
   @retval EFI_SUCCESS           The image is unloaded.\r
   @retval Others                Failed to unload the image.\r
@@ -936,10 +915,10 @@ NetLibDefaultUnload (
 /**\r
   Create a child of the service that is identified by ServiceBindingGuid.\r
 \r
-  @param  Controller            The controller which has the service installed.\r
-  @param  Image                 The image handle used to open service.\r
-  @param  ServiceBindingGuid    The service's Guid.\r
-  @param  ChildHandle           The handle to receive the create child\r
+  @param[in]       Controller            The controller which has the service installed.\r
+  @param[in]       Image                 The image handle used to open service.\r
+  @param[in]       ServiceBindingGuid    The service's Guid.\r
+  @param[in, out]  ChildHandle           The handle to receive the create child\r
 \r
   @retval EFI_SUCCESS           The child is successfully created.\r
   @retval Others                Failed to create the child.\r
@@ -951,7 +930,7 @@ NetLibCreateServiceChild (
   IN  EFI_HANDLE            Controller,\r
   IN  EFI_HANDLE            Image,\r
   IN  EFI_GUID              *ServiceBindingGuid,\r
-  OUT EFI_HANDLE            *ChildHandle\r
+  IN  OUT EFI_HANDLE        *ChildHandle\r
   )\r
 {\r
   EFI_STATUS                    Status;\r
@@ -987,10 +966,10 @@ NetLibCreateServiceChild (
 /**\r
   Destory a child of the service that is identified by ServiceBindingGuid.\r
 \r
-  @param  Controller            The controller which has the service installed.\r
-  @param  Image                 The image handle used to open service.\r
-  @param  ServiceBindingGuid    The service's Guid.\r
-  @param  ChildHandle           The child to destory\r
+  @param[in]   Controller            The controller which has the service installed.\r
+  @param[in]   Image                 The image handle used to open service.\r
+  @param[in]   ServiceBindingGuid    The service's Guid.\r
+  @param[in]   ChildHandle           The child to destory\r
 \r
   @retval EFI_SUCCESS           The child is successfully destoried.\r
   @retval Others                Failed to destory the child.\r
@@ -1039,23 +1018,24 @@ NetLibDestroyServiceChild (
   SnpHandle to a unicode string. Callers are responsible for freeing the\r
   string storage.\r
 \r
-  @param  SnpHandle             The handle where the simple network protocol is\r
-                                installed on.\r
-  @param  ImageHandle           The image handle used to act as the agent handle to\r
-                                get the simple network protocol.\r
-  @param  MacString             The pointer to store the address of the string\r
-                                representation of  the mac address.\r
-\r
+  @param[in]   SnpHandle             The handle where the simple network protocol is\r
+                                     installed on.\r
+  @param[in]   ImageHandle           The image handle used to act as the agent handle to\r
+                                     get the simple network protocol.\r
+  @param[out]  MacString             The pointer to store the address of the string\r
+                                     representation of  the mac address.\r
+  \r
+  @retval EFI_SUCCESS           Convert the mac address a unicode string successfully.\r
   @retval EFI_OUT_OF_RESOURCES  There are not enough memory resource.\r
-  @retval other                 Failed to open the simple network protocol.\r
+  @retval Others                Failed to open the simple network protocol.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 NetLibGetMacString (\r
-  IN           EFI_HANDLE  SnpHandle,\r
-  IN           EFI_HANDLE  ImageHandle,\r
-  IN OUT       CHAR16      **MacString\r
+  IN  EFI_HANDLE            SnpHandle,\r
+  IN  EFI_HANDLE            ImageHandle,\r
+  OUT CHAR16                **MacString\r
   )\r
 {\r
   EFI_STATUS                   Status;\r
@@ -1111,8 +1091,8 @@ NetLibGetMacString (
   Check the default address used by the IPv4 driver is static or dynamic (acquired\r
   from DHCP).\r
 \r
-  @param  Controller     The controller handle which has the NIC Ip4 Config Protocol\r
-                         relative with the default address to judge.\r
+  @param[in]   Controller     The controller handle which has the NIC Ip4 Config Protocol\r
+                              relative with the default address to judge.\r
 \r
   @retval TRUE           If the default address is static.\r
   @retval FALSE          If the default address is acquired from DHCP.\r
@@ -1167,16 +1147,15 @@ ON_EXIT:
 /**\r
   Create an IPv4 device path node.\r
 \r
-  @param  Node                  Pointer to the IPv4 device path node.\r
-  @param  Controller            The handle where the NIC IP4 config protocol resides.\r
-  @param  LocalIp               The local IPv4 address.\r
-  @param  LocalPort             The local port.\r
-  @param  RemoteIp              The remote IPv4 address.\r
-  @param  RemotePort            The remote port.\r
-  @param  Protocol              The protocol type in the IP header.\r
-  @param  UseDefaultAddress     Whether this instance is using default address or not.\r
+  @param[in, out]  Node                  Pointer to the IPv4 device path node.\r
+  @param[in]       Controller            The handle where the NIC IP4 config protocol resides.\r
+  @param[in]       LocalIp               The local IPv4 address.\r
+  @param[in]       LocalPort             The local port.\r
+  @param[in]       RemoteIp              The remote IPv4 address.\r
+  @param[in]       RemotePort            The remote port.\r
+  @param[in]       Protocol              The protocol type in the IP header.\r
+  @param[in]       UseDefaultAddress     Whether this instance is using default address or not.\r
 \r
-  @retval None\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -1221,10 +1200,10 @@ NetLibCreateIPv4DPathNode (
   IP opens these handle BY_DRIVER, use that info, we can get the\r
   UNDI/SNP handle.\r
 \r
-  @param  Controller            Then protocol handle to check\r
-  @param  ProtocolGuid          The protocol that is related with the handle.\r
+  @param[in]  Controller            Then protocol handle to check.\r
+  @param[in]  ProtocolGuid          The protocol that is related with the handle.\r
 \r
-  @return The UNDI/SNP handle or NULL.\r
+  @return The UNDI/SNP handle or NULL for errors.\r
 \r
 **/\r
 EFI_HANDLE\r
@@ -1267,14 +1246,14 @@ NetLibGetNicHandle (
 /**\r
   Add a Deferred Procedure Call to the end of the DPC queue.\r
 \r
-  @DpcTpl           The EFI_TPL that the DPC should be invoked.\r
-  @DpcProcedure     Pointer to the DPC's function.\r
-  @DpcContext       Pointer to the DPC's context.  Passed to DpcProcedure\r
-                    when DpcProcedure is invoked.\r
+  @param[in]  DpcTpl           The EFI_TPL that the DPC should be invoked.\r
+  @param[in]  DpcProcedure     Pointer to the DPC's function.\r
+  @param[in]  DpcContext       Pointer to the DPC's context.  Passed to DpcProcedure\r
+                               when DpcProcedure is invoked.\r
 \r
   @retval  EFI_SUCCESS              The DPC was queued.\r
-  @retval  EFI_INVALID_PARAMETER    DpcTpl is not a valid EFI_TPL.\r
-                                    DpcProcedure is NULL.\r
+  @retval  EFI_INVALID_PARAMETER    DpcTpl is not a valid EFI_TPL, or DpcProcedure\r
+                                    is NULL.\r
   @retval  EFI_OUT_OF_RESOURCES     There are not enough resources available to\r
                                     add the DPC to the queue.\r
 \r
@@ -1291,7 +1270,10 @@ NetLibQueueDpc (
 }\r
 \r
 /**\r
-  Add a Deferred Procedure Call to the end of the DPC queue.\r
+  Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl\r
+  value greater than or equal to the current TPL are invoked in the order that\r
+  they were queued.  DPCs with higher DpcTpl values are invoked before DPCs with\r
+  lower DpcTpl values.\r
 \r
   @retval  EFI_SUCCESS              One or more DPCs were invoked.\r
   @retval  EFI_NOT_FOUND            No DPCs were invoked.\r
@@ -1306,15 +1288,14 @@ NetLibDispatchDpc (
   return mDpc->DispatchDpc(mDpc);\r
 }\r
 \r
-\r
 /**\r
   The constructor function caches the pointer to DPC protocol.\r
 \r
   The constructor function locates DPC protocol from protocol database.\r
   It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.\r
 \r
-  @param  ImageHandle   The firmware allocated handle for the EFI image.\r
-  @param  SystemTable   A pointer to the EFI System Table.\r
+  @param[in]  ImageHandle   The firmware allocated handle for the EFI image.\r
+  @param[in]  SystemTable   A pointer to the EFI System Table.\r
 \r
   @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.\r
 \r
index fcc55a170a66355ce8bbe5fe9bedff2149d4326d..897152946eeefb9d37f9c6762c5717b448bbd3dc 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
-\r
-Copyright (c) 2005 - 2006, Intel Corporation\r
+  Network library.\r
+  \r
+Copyright (c) 2005 - 2006, 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
@@ -8,18 +9,9 @@ http://opensource.org/licenses/bsd-license.php
 \r
 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
-  NetBuffer.c\r
-\r
-Abstract:\r
-\r
-\r
-\r
 **/\r
 \r
-#include <PiDxe.h>\r
+#include <Uefi.h>\r
 \r
 #include <Library/NetLib.h>\r
 #include <Library/BaseLib.h>\r
@@ -34,10 +26,10 @@ Abstract:
   has the BlockOpNum's NET_BLOCK_OP, and its associated NET_VECTOR has the\r
   BlockNum's NET_BLOCK.\r
 \r
-  @param  BlockNum              The number of NET_BLOCK in the Vector of net buffer\r
-  @param  BlockOpNum            The number of NET_BLOCK_OP in the net buffer\r
+  @param[in]  BlockNum              The number of NET_BLOCK in the Vector of net buffer\r
+  @param[in]  BlockOpNum            The number of NET_BLOCK_OP in the net buffer\r
 \r
-  @retval *                     Pointer to the allocated NET_BUF. If NULL  the\r
+  @return                       Pointer to the allocated NET_BUF. If NULL, the\r
                                 allocation failed due to resource limit.\r
 \r
 **/\r
@@ -92,9 +84,9 @@ FreeNbuf:
   Allocate a single block NET_BUF. Upon allocation, all the\r
   free space is in the tail room.\r
 \r
-  @param  Len                   The length of the block.\r
+  @param[in]  Len              The length of the block.\r
 \r
-  @retval *                     Pointer to the allocated NET_BUF. If NULL  the\r
+  @return                       Pointer to the allocated NET_BUF. If NULL  the\r
                                 allocation failed due to resource limit.\r
 \r
 **/\r
@@ -144,11 +136,9 @@ FreeNBuf:
 \r
 \r
 /**\r
-  Free the vector\r
-\r
-  @param  Vector                Pointer to the NET_VECTOR to be freed.\r
+  Free the vector.\r
 \r
-  @return None.\r
+  @param[in]  Vector                Pointer to the NET_VECTOR to be freed.\r
 \r
 **/\r
 VOID\r
@@ -195,9 +185,7 @@ NetbufFreeVector (
 /**\r
   Free the buffer and its associated NET_VECTOR.\r
 \r
-  @param  Nbuf                  Pointer to the NET_BUF to be freed.\r
-\r
-  @return None.\r
+  @param[in]  Nbuf                  Pointer to the NET_BUF to be freed.\r
 \r
 **/\r
 VOID\r
@@ -225,9 +213,10 @@ NetbufFree (
 /**\r
   Create a copy of NET_BUF that share the associated NET_DATA.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer to be cloned.\r
+  @param[in]  Nbuf              Pointer to the net buffer to be cloned.\r
 \r
-  @retval *                     Pointer to the cloned net buffer.\r
+  @return                       Pointer to the cloned net buffer.If NULL, the\r
+                                allocation failed due to resource limit.\r
 \r
 **/\r
 NET_BUF  *\r
@@ -270,19 +259,20 @@ NetbufClone (
   Create a duplicated copy of Nbuf, data is copied. Also leave some\r
   head space before the data.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer to be cloned.\r
-  @param  Duplicate             Pointer to the net buffer to duplicate to, if NULL\r
-                                a new net  buffer is allocated.\r
-  @param  HeadSpace             Length of the head space to reserve\r
+  @param[in]       Nbuf                  Pointer to the net buffer to be cloned.\r
+  @param[in, out]  Duplicate             Pointer to the net buffer to duplicate to, if NULL\r
+                                         a new net  buffer is allocated.\r
+  @param[in]      HeadSpace              Length of the head space to reserve.\r
 \r
-  @retval *                     Pointer to the duplicated net buffer.\r
+  @return                       Pointer to the duplicated net buffer.If NULL, the\r
+                                allocation failed due to resource limit.\r
 \r
 **/\r
 NET_BUF  *\r
 EFIAPI\r
 NetbufDuplicate (\r
   IN NET_BUF                *Nbuf,\r
-  IN NET_BUF                *Duplicate        OPTIONAL,\r
+  IN OUT NET_BUF            *Duplicate        OPTIONAL,\r
   IN UINT32                 HeadSpace\r
   )\r
 {\r
@@ -315,15 +305,13 @@ NetbufDuplicate (
 /**\r
   Free a list of net buffers.\r
 \r
-  @param  Head                  Pointer to the head of linked net buffers.\r
-\r
-  @return None.\r
+  @param[in, out]  Head              Pointer to the head of linked net buffers.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 NetbufFreeList (\r
-  IN LIST_ENTRY             *Head\r
+  IN OUT LIST_ENTRY         *Head\r
   )\r
 {\r
   LIST_ENTRY                *Entry;\r
@@ -350,11 +338,11 @@ NetbufFreeList (
   returns the fragment that contains the byte which is used mainly by\r
   the buffer implementation itself.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer.\r
-  @param  Offset                The index or offset of the byte\r
-  @param  Index                 Index of the fragment that contains the block\r
+  @param[in]   Nbuf                  Pointer to the net buffer.\r
+  @param[in]   Offset                The index or offset of the byte.\r
+  @param[out]  Index                 Index of the fragment that contains the block.\r
 \r
-  @retval *                     Pointer to the nth byte of data in the net buffer.\r
+  @return *                     Pointer to the nth byte of data in the net buffer.\r
                                 If NULL, there is no such data in the net buffer.\r
 \r
 **/\r
@@ -404,18 +392,16 @@ NetbufGetByte (
   are set to the bulk's head and tail respectively. So, this\r
   function alone can't be used by NetbufAlloc.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer.\r
-  @param  Bulk                  Pointer to the data.\r
-  @param  Len                   Length of the bulk data.\r
-  @param  Index                 The data block index in the net buffer the bulk\r
-                                data should belong to.\r
-\r
-  @return None.\r
-\r
+  @param[in, out]  Nbuf                  Pointer to the net buffer.\r
+  @param[in]       Bulk                  Pointer to the data.\r
+  @param[in]       Len                   Length of the bulk data.\r
+  @param[in]       Index                 The data block index in the net buffer the bulk\r
+                                         data should belong to.\r
+                                \r
 **/\r
 VOID\r
 NetbufSetBlock (\r
-  IN NET_BUF                *Nbuf,\r
+  IN OUT NET_BUF            *Nbuf,\r
   IN UINT8                  *Bulk,\r
   IN UINT32                 Len,\r
   IN UINT32                 Index\r
@@ -446,18 +432,16 @@ NetbufSetBlock (
   structure is left untouched. Some times, there is no 1:1 relationship\r
   between NET_BLOCK and NET_BLOCK_OP. For example, that in NetbufGetFragment.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer.\r
-  @param  Bulk                  Pointer to the data.\r
-  @param  Len                   Length of the bulk data.\r
-  @param  Index                 The data block index in the net buffer the bulk\r
-                                data should belong to.\r
-\r
-  @return None.\r
+  @param[in, out]  Nbuf                  Pointer to the net buffer.\r
+  @param[in]       Bulk                  Pointer to the data.\r
+  @param[in]       Len                   Length of the bulk data.\r
+  @param[in]       Index                 The data block index in the net buffer the bulk\r
+                                         data should belong to.\r
 \r
 **/\r
 VOID\r
 NetbufSetBlockOp (\r
-  IN NET_BUF                *Nbuf,\r
+  IN OUT NET_BUF            *Nbuf,\r
   IN UINT8                  *Bulk,\r
   IN UINT32                 Len,\r
   IN UINT32                 Index\r
@@ -483,9 +467,7 @@ NetbufSetBlockOp (
   need to create a new NET_VECTOR. But, we want to avoid data copy by sharing\r
   the old NET_VECTOR.\r
 \r
-  @param  Arg                   Point to the old NET_VECTOR\r
-\r
-  @return NONE\r
+  @param[in]  Arg                   Point to the old NET_VECTOR.\r
 \r
 **/\r
 VOID\r
@@ -507,14 +489,15 @@ NetbufGetFragmentFree (
   created but the associated data in NET_VECTOR is shared.\r
   This function exists to do IP packet fragmentation.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer to be cloned.\r
-  @param  Offset                Starting point of the data to be included in new\r
-                                buffer.\r
-  @param  Len                   How many data to include in new data\r
-  @param  HeadSpace             How many bytes of head space to reserve for\r
-                                protocol header\r
+  @param[in]  Nbuf                  Pointer to the net buffer to be cloned.\r
+  @param[in]  Offset                Starting point of the data to be included in new\r
+                                    buffer.\r
+  @param[in]  Len                   How many data to include in new data.\r
+  @param[in]  HeadSpace             How many bytes of head space to reserve for\r
+                                    protocol header.\r
 \r
-  @retval *                     Pointer to the cloned net buffer.\r
+  @return                       Pointer to the cloned net buffer.If NULL, the\r
+                                allocation failed due to resource limit.\r
 \r
 **/\r
 NET_BUF  *\r
@@ -687,17 +670,17 @@ FreeChild:
 /**\r
   Build a NET_BUF from external blocks.\r
 \r
-  @param  ExtFragment           Pointer to the data block.\r
-  @param  ExtNum                The number of the data block.\r
-  @param  HeadSpace             The head space to be reserved.\r
-  @param  HeadLen               The length of the protocol header, This function\r
-                                will pull that number of data into a linear block.\r
-  @param  ExtFree               Pointer to the caller provided free function.\r
-  @param  Arg                   The argument passed to ExtFree when ExtFree is\r
-                                called.\r
+  @param[in]  ExtFragment           Pointer to the data block.\r
+  @param[in]  ExtNum                The number of the data block.\r
+  @param[in]  HeadSpace             The head space to be reserved.\r
+  @param[in]  HeadLen               The length of the protocol header, This function\r
+                                    will pull that number of data into a linear block.\r
+  @param[in]  ExtFree               Pointer to the caller provided free function.\r
+  @param[in]  Arg                   The argument passed to ExtFree when ExtFree is\r
+                                    called.\r
 \r
-  @retval *                     Pointer to the net buffer built from the data\r
-                                blocks.\r
+  @return                    Pointer to the net buffer built from the data blocks.\r
+                             If NULL, the allocation failed due to resource limit.\r
 \r
 **/\r
 NET_BUF  *\r
@@ -822,7 +805,7 @@ NetbufFromExt (
   Vector       = Nbuf->Vector;\r
   Vector->Free = ExtFree;\r
   Vector->Arg  = Arg;\r
-  Vector->Flag = (FirstBlockLen ? NET_VECTOR_OWN_FIRST : 0);\r
+  Vector->Flag = ((FirstBlockLen != 0) ? NET_VECTOR_OWN_FIRST : 0);\r
 \r
   //\r
   // Set the first block up which may contain\r
@@ -847,7 +830,7 @@ NetbufFromExt (
   Vector->Len     = TotalLen + HeadSpace;\r
   Nbuf->TotalSize = TotalLen;\r
 \r
-  if (SavedIndex) {\r
+  if (SavedIndex != 0) {\r
     ExtFragment[SavedIndex] = SavedFragment;\r
   }\r
 \r
@@ -863,11 +846,11 @@ FreeFirstBlock:
   Build a fragment table to contain the fragments in the\r
   buffer. This is the opposite of the NetbufFromExt.\r
 \r
-  @param  Nbuf                  Point to the net buffer\r
-  @param  ExtFragment           Pointer to the data block.\r
-  @param  ExtNum                The number of the data block.\r
+  @param[in]       Nbuf                  Point to the net buffer.\r
+  @param[in, out]  ExtFragment           Pointer to the data block.\r
+  @param[in, out]  ExtNum                The number of the data block.\r
 \r
-  @retval EFI_BUFFER_TOO_SMALL  The number of non-empty block is bigger than ExtNum\r
+  @retval EFI_BUFFER_TOO_SMALL  The number of non-empty block is bigger than ExtNum.\r
   @retval EFI_SUCCESS           Fragment table built.\r
 \r
 **/\r
@@ -875,8 +858,8 @@ EFI_STATUS
 EFIAPI\r
 NetbufBuildExt (\r
   IN NET_BUF                *Nbuf,\r
-  IN NET_FRAGMENT           *ExtFragment,\r
-  IN UINT32                 *ExtNum\r
+  IN OUT NET_FRAGMENT       *ExtFragment,\r
+  IN OUT UINT32             *ExtNum\r
   )\r
 {\r
   UINT32                    Index;\r
@@ -906,15 +889,15 @@ NetbufBuildExt (
 /**\r
   Build a NET_BUF from a list of NET_BUF.\r
 \r
-  @param  BufList               A List of NET_BUF.\r
-  @param  HeadSpace             The head space to be reserved.\r
-  @param  HeaderLen             The length of the protocol header, This function\r
-                                will pull that number of data into a linear block.\r
-  @param  ExtFree               Pointer to the caller provided free function.\r
-  @param  Arg                   The argument passed to ExtFree when ExtFree is\r
-                                called.\r
+  @param[in]   BufList               A List of NET_BUF.\r
+  @param[in]   HeadSpace             The head space to be reserved.\r
+  @param[in]   HeaderLen             The length of the protocol header, This function\r
+                                     will pull that number of data into a linear block.\r
+  @param[in]   ExtFree               Pointer to the caller provided free function.\r
+  @param[in]   Arg                   The argument passed to ExtFree when ExtFree is\r
+                                     called.\r
 \r
-  @retval *                     Pointer to the net buffer built from the data\r
+  @return                       Pointer to the net buffer built from the data\r
                                 blocks.\r
 \r
 **/\r
@@ -986,16 +969,14 @@ NetbufFromBufList (
   of an empty NET_BUF not built from the external. But\r
   it should be enough for the network stack.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer.\r
-  @param  Len                   The length of buffer to be reserverd.\r
-\r
-  @return None.\r
+  @param[in, out]  Nbuf                  Pointer to the net buffer.\r
+  @param[in]       Len                   The length of buffer to be reserverd.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 NetbufReserve (\r
-  IN NET_BUF                *Nbuf,\r
+  IN OUT NET_BUF            *Nbuf,\r
   IN UINT32                 Len\r
   )\r
 {\r
@@ -1015,19 +996,19 @@ NetbufReserve (
 /**\r
   Allocate some space from the header or tail of the buffer.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer.\r
-  @param  Len                   The length of the buffer to be allocated.\r
-  @param  FromHead              The flag to indicate whether reserve the data from\r
-                                head or tail. TRUE for from head, and FALSE for\r
-                                from tail.\r
+  @param[in, out]  Nbuf                  Pointer to the net buffer.\r
+  @param[in]       Len                   The length of the buffer to be allocated.\r
+  @param [in]      FromHead              The flag to indicate whether reserve the data from\r
+                                         head or tail. TRUE for from head, and FALSE for\r
+                                         from tail.\r
 \r
-  @retval *                     Pointer to the first byte of the allocated buffer.\r
+  @return                       Pointer to the first byte of the allocated buffer.\r
 \r
 **/\r
 UINT8  *\r
 EFIAPI\r
 NetbufAllocSpace (\r
-  IN NET_BUF                *Nbuf,\r
+  IN OUT NET_BUF            *Nbuf,\r
   IN UINT32                 Len,\r
   IN BOOLEAN                FromHead\r
   )\r
@@ -1107,17 +1088,15 @@ NetbufAllocSpace (
 /**\r
   Trim a single NET_BLOCK.\r
 \r
-  @param  BlockOp               Pointer to the NET_BLOCK.\r
-  @param  Len                   The length of the data to be trimmed.\r
-  @param  FromHead              The flag to indicate whether trim data from head or\r
-                                tail. TRUE for from head, and FALSE for from tail.\r
-\r
-  @return None.\r
+  @param[in, out]  BlockOp               Pointer to the NET_BLOCK.\r
+  @param[in]       Len                   The length of the data to be trimmed.\r
+  @param[in]       FromHead              The flag to indicate whether trim data from head or\r
+                                         tail. TRUE for from head, and FALSE for from tail.\r
 \r
 **/\r
 VOID\r
 NetblockTrim (\r
-  IN NET_BLOCK_OP           *BlockOp,\r
+  IN OUT NET_BLOCK_OP       *BlockOp,\r
   IN UINT32                 Len,\r
   IN BOOLEAN                FromHead\r
   )\r
@@ -1137,18 +1116,18 @@ NetblockTrim (
 /**\r
   Trim some data from the header or tail of the buffer.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer.\r
-  @param  Len                   The length of the data to be trimmed.\r
-  @param  FromHead              The flag to indicate whether trim data from head or\r
-                                tail. TRUE for from head, and FALSE for from tail.\r
+  @param[in, out]  Nbuf                  Pointer to the net buffer.\r
+  @param[in]       Len                   The length of the data to be trimmed.\r
+  @param[in]      FromHead               The flag to indicate whether trim data from head or\r
+                                         tail. TRUE for from head, and FALSE for from tail.\r
 \r
-  @retval UINTN                 Length of the actually trimmed data.\r
+  @return    Length of the actually trimmed data.\r
 \r
 **/\r
 UINT32\r
 EFIAPI\r
 NetbufTrim (\r
-  IN NET_BUF                *Nbuf,\r
+  IN OUT NET_BUF            *Nbuf,\r
   IN UINT32                 Len,\r
   IN BOOLEAN                FromHead\r
   )\r
@@ -1202,10 +1181,10 @@ NetbufTrim (
 /**\r
   Copy the data from the specific offset to the destination.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer.\r
-  @param  Offset                The sequence number of the first byte to copy.\r
-  @param  Len                   Length of the data to copy.\r
-  @param  Dest                  The destination of the data to copy to.\r
+  @param[in]   Nbuf                  Pointer to the net buffer.\r
+  @param[in]   Offset                The sequence number of the first byte to copy.\r
+  @param[in]   Len                   Length of the data to copy.\r
+  @param[in]   Dest                  The destination of the data to copy to.\r
 \r
   @retval UINTN                 The length of the copied data.\r
 \r
@@ -1302,15 +1281,13 @@ NetbufCopy (
 /**\r
   Initiate the net buffer queue.\r
 \r
-  @param  NbufQue               Pointer to the net buffer queue to be initiated.\r
-\r
-  @return None.\r
+  @param[in, out]  NbufQue               Pointer to the net buffer queue to be initiated.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 NetbufQueInit (\r
-  IN NET_BUF_QUEUE          *NbufQue\r
+  IN OUT NET_BUF_QUEUE          *NbufQue\r
   )\r
 {\r
   NbufQue->Signature  = NET_QUE_SIGNATURE;\r
@@ -1326,9 +1303,8 @@ NetbufQueInit (
 /**\r
   Allocate an initialized net buffer queue.\r
 \r
-  None.\r
-\r
-  @retval *                     Pointer to the allocated net buffer queue.\r
+  @return                       Pointer to the allocated net buffer queue.If NULL, the\r
+                                allocation failed due to resource limit.\r
 \r
 **/\r
 NET_BUF_QUEUE  *\r
@@ -1353,9 +1329,7 @@ NetbufQueAlloc (
 /**\r
   Free a net buffer queue.\r
 \r
-  @param  NbufQue               Poitner to the net buffer queue to be freed.\r
-\r
-  @return None.\r
+  @param[in]  NbufQue               Poitner to the net buffer queue to be freed.\r
 \r
 **/\r
 VOID\r
@@ -1378,17 +1352,15 @@ NetbufQueFree (
 /**\r
   Append a buffer to the end of the queue.\r
 \r
-  @param  NbufQue               Pointer to the net buffer queue.\r
-  @param  Nbuf                  Pointer to the net buffer to be appended.\r
-\r
-  @return None.\r
+  @param[in, out]  NbufQue               Pointer to the net buffer queue.\r
+  @param[in, out]  Nbuf                  Pointer to the net buffer to be appended.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 NetbufQueAppend (\r
-  IN NET_BUF_QUEUE          *NbufQue,\r
-  IN NET_BUF                *Nbuf\r
+  IN OUT NET_BUF_QUEUE          *NbufQue,\r
+  IN OUT NET_BUF                *Nbuf\r
   )\r
 {\r
   NET_CHECK_SIGNATURE (NbufQue, NET_QUE_SIGNATURE);\r
@@ -1404,16 +1376,17 @@ NetbufQueAppend (
 /**\r
   Remove a net buffer from head in the specific queue.\r
 \r
-  @param  NbufQue               Pointer to the net buffer queue.\r
+  @param[in, out]  NbufQue               Pointer to the net buffer queue.\r
 \r
-  @retval *                     Pointer to the net buffer removed from the specific\r
+  @return                       Pointer to the net buffer removed from the specific\r
+                                queue. If NULL, there is no net buffer in the specific\r
                                 queue.\r
 \r
 **/\r
 NET_BUF  *\r
 EFIAPI\r
 NetbufQueRemove (\r
-  IN NET_BUF_QUEUE          *NbufQue\r
+  IN OUT NET_BUF_QUEUE          *NbufQue\r
   )\r
 {\r
   NET_BUF                   *First;\r
@@ -1437,20 +1410,22 @@ NetbufQueRemove (
 /**\r
   Copy some data from the buffer queue to the destination.\r
 \r
-  @param  NbufQue               Pointer to the net buffer queue.\r
-  @param  Offset                The sequence number of the first byte to copy.\r
-  @param  Len                   Length of the data to copy.\r
-  @param  Dest                  The destination of the data to copy to.\r
+  @param[in]   NbufQue               Pointer to the net buffer queue.\r
+  @param[in]   Offset                The sequence number of the first byte to copy.\r
+  @param[in]   Len                   Length of the data to copy.\r
+  @param[out]  Dest                  The destination of the data to copy to.\r
 \r
-  @retval UINTN                 The length of the copied data.\r
+  @return       The length of the copied data. If 0, then the length is zero or offset \r
+                suppress the total size of net buffer.\r
 \r
 **/\r
 UINT32\r
+EFIAPI\r
 NetbufQueCopy (\r
   IN NET_BUF_QUEUE          *NbufQue,\r
   IN UINT32                 Offset,\r
   IN UINT32                 Len,\r
-  IN UINT8                  *Dest\r
+  OUT UINT8                 *Dest\r
   )\r
 {\r
   LIST_ENTRY                *Entry;\r
@@ -1534,16 +1509,16 @@ NetbufQueCopy (
   Trim some data from the queue header, release the buffer if\r
   whole buffer is trimmed.\r
 \r
-  @param  NbufQue               Pointer to the net buffer queue.\r
-  @param  Len                   Length of the data to trim.\r
+  @param[in, out]  NbufQue               Pointer to the net buffer queue.\r
+  @param[in]       Len                   Length of the data to trim.\r
 \r
-  @retval UINTN                 The length of the data trimmed.\r
+  @return   The length of the data trimmed, or 0 if length of the data to trim is zero.\r
 \r
 **/\r
 UINT32\r
 EFIAPI\r
 NetbufQueTrim (\r
-  IN NET_BUF_QUEUE          *NbufQue,\r
+  IN OUT NET_BUF_QUEUE      *NbufQue,\r
   IN UINT32                 Len\r
   )\r
 {\r
@@ -1594,15 +1569,13 @@ NetbufQueTrim (
 /**\r
   Flush the net buffer queue.\r
 \r
-  @param  NbufQue               Pointer to the queue to be flushed.\r
-\r
-  @return None.\r
+  @param[in, out]  NbufQue               Pointer to the queue to be flushed.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 NetbufQueFlush (\r
-  IN NET_BUF_QUEUE          *NbufQue\r
+  IN OUT NET_BUF_QUEUE          *NbufQue\r
   )\r
 {\r
   NET_CHECK_SIGNATURE (NbufQue, NET_QUE_SIGNATURE);\r
@@ -1617,10 +1590,10 @@ NetbufQueFlush (
 /**\r
   Compute checksum for a bulk of data.\r
 \r
-  @param  Bulk                  Pointer to the data.\r
-  @param  Len                   Length of the data, in bytes.\r
+  @param[in]   Bulk                  Pointer to the data.\r
+  @param[in]   Len                   Length of the data, in bytes.\r
 \r
-  @retval UINT16                The computed checksum.\r
+  @return    The computed checksum.\r
 \r
 **/\r
 UINT16\r
@@ -1650,7 +1623,7 @@ NetblockChecksum (
   //\r
   // Fold 32-bit sum to 16 bits\r
   //\r
-  while (Sum >> 16) {\r
+  while ((Sum >> 16) != 0) {\r
     Sum = (Sum & 0xffff) + (Sum >> 16);\r
 \r
   }\r
@@ -1662,10 +1635,10 @@ NetblockChecksum (
 /**\r
   Add two checksums.\r
 \r
-  @param  Checksum1             The first checksum to be added.\r
-  @param  Checksum2             The second checksum to be added.\r
+  @param[in]   Checksum1             The first checksum to be added.\r
+  @param[in]   Checksum2             The second checksum to be added.\r
 \r
-  @retval UINT16                The new checksum.\r
+  @return         The new checksum.\r
 \r
 **/\r
 UINT16\r
@@ -1682,7 +1655,7 @@ NetAddChecksum (
   //\r
   // two UINT16 can only add up to a carry of 1.\r
   //\r
-  if (Sum >> 16) {\r
+  if ((Sum >> 16) != 0) {\r
     Sum = (Sum & 0xffff) + 1;\r
 \r
   }\r
@@ -1694,9 +1667,9 @@ NetAddChecksum (
 /**\r
   Compute the checksum for a NET_BUF.\r
 \r
-  @param  Nbuf                  Pointer to the net buffer.\r
+  @param[in]   Nbuf                  Pointer to the net buffer.\r
 \r
-  @retval UINT16                The computed checksum.\r
+  @return    The computed checksum.\r
 \r
 **/\r
 UINT16\r
@@ -1724,7 +1697,7 @@ NetbufChecksum (
 \r
     BlockSum = NetblockChecksum (BlockOp[Index].Head, BlockOp[Index].Size);\r
 \r
-    if (Offset & 0x01) {\r
+    if ((Offset & 0x01) != 0) {\r
       //\r
       // The checksum starts with an odd byte, swap\r
       // the checksum before added to total checksum\r
@@ -1745,12 +1718,12 @@ NetbufChecksum (
   Src, Dst are in network byte order. and Len is\r
   in host byte order.\r
 \r
-  @param  Src                   The source address of the packet.\r
-  @param  Dst                   The destination address of the packet.\r
-  @param  Proto                 The protocol type of the packet.\r
-  @param  Len                   The length of the packet.\r
+  @param[in]   Src                   The source address of the packet.\r
+  @param[in]   Dst                   The destination address of the packet.\r
+  @param[in]   Proto                 The protocol type of the packet.\r
+  @param[in]   Len                   The length of the packet.\r
 \r
-  @retval UINT16                The computed checksum.\r
+  @return   The computed checksum.\r
 \r
 **/\r
 UINT16\r