]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/SnpDxe/Statistics.c
BaseTools:Change the path of the file that Binary Cache
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / Statistics.c
index 5261a8441ce74bec8bef737e6988837ba09ebd14..480e26178057a53cbb0b74590bf91574511c850a 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
     Implementation of collecting the statistics on a network interface.\r
\r
-Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
-All rights reserved. This program and the accompanying materials are licensed \r
-and made available under the terms and conditions of the BSD License which \r
-accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
 \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
+Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -18,15 +12,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 /**\r
   Resets or collects the statistics on a network interface.\r
-  \r
+\r
   This function resets or collects the statistics on a network interface. If the\r
   size of the statistics table specified by StatisticsSize is not big enough for\r
   all the statistics that are collected by the network interface, then a partial\r
-  buffer of statistics is returned in StatisticsTable, StatisticsSize is set to \r
-  the size required to collect all the available statistics, and \r
+  buffer of statistics is returned in StatisticsTable, StatisticsSize is set to\r
+  the size required to collect all the available statistics, and\r
   EFI_BUFFER_TOO_SMALL is returned.\r
-  If StatisticsSize is big enough for all the statistics, then StatisticsTable \r
-  will be filled, StatisticsSize will be set to the size of the returned \r
+  If StatisticsSize is big enough for all the statistics, then StatisticsTable\r
+  will be filled, StatisticsSize will be set to the size of the returned\r
   StatisticsTable structure, and EFI_SUCCESS is returned.\r
   If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
   If Reset is FALSE, and both StatisticsSize and StatisticsTable are NULL, then\r
@@ -36,30 +30,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
   @param This            A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
   @param Reset           Set to TRUE to reset the statistics for the network interface.\r
-  @param StatisticsSize  On input the size, in bytes, of StatisticsTable. On output \r
+  @param StatisticsSize  On input the size, in bytes, of StatisticsTable. On output\r
                          the size, in bytes, of the resulting table of statistics.\r
-  @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that \r
-                         contains the statistics. Type EFI_NETWORK_STATISTICS is \r
-                         defined in "Related Definitions" below. \r
-  \r
+  @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that\r
+                         contains the statistics. Type EFI_NETWORK_STATISTICS is\r
+                         defined in "Related Definitions" below.\r
+\r
   @retval EFI_SUCCESS           The requested operation succeeded.\r
   @retval EFI_NOT_STARTED       The Simple Network Protocol interface has not been\r
                                 started by calling Start().\r
-  @retval EFI_BUFFER_TOO_SMALL  StatisticsSize is not NULL and StatisticsTable is \r
-                                NULL. The current buffer size that is needed to \r
+  @retval EFI_BUFFER_TOO_SMALL  StatisticsSize is not NULL and StatisticsTable is\r
+                                NULL. The current buffer size that is needed to\r
                                 hold all the statistics is returned in StatisticsSize.\r
-  @retval EFI_BUFFER_TOO_SMALL  StatisticsSize is not NULL and StatisticsTable is \r
+  @retval EFI_BUFFER_TOO_SMALL  StatisticsSize is not NULL and StatisticsTable is\r
                                 not NULL. The current buffer size that is needed\r
-                                to hold all the statistics is returned in \r
-                                StatisticsSize. A partial set of statistics is \r
+                                to hold all the statistics is returned in\r
+                                StatisticsSize. A partial set of statistics is\r
                                 returned in StatisticsTable.\r
-  @retval EFI_INVALID_PARAMETER StatisticsSize is NULL and StatisticsTable is not \r
+  @retval EFI_INVALID_PARAMETER StatisticsSize is NULL and StatisticsTable is not\r
                                 NULL.\r
-  @retval EFI_DEVICE_ERROR      The Simple Network Protocol interface has not \r
+  @retval EFI_DEVICE_ERROR      The Simple Network Protocol interface has not\r
                                 been initialized by calling Initialize().\r
-  @retval EFI_DEVICE_ERROR      An error was encountered collecting statistics \r
+  @retval EFI_DEVICE_ERROR      An error was encountered collecting statistics\r
                                 from the NIC.\r
-  @retval EFI_UNSUPPORTED       The NIC does not support collecting statistics \r
+  @retval EFI_UNSUPPORTED       The NIC does not support collecting statistics\r
                                 from the network interface.\r
 \r
 **/\r
@@ -133,13 +127,13 @@ SnpUndi32Statistics (
     Db                = Snp->Db;\r
   } else {\r
     Snp->Cdb.OpFlags                = PXE_OPFLAGS_STATISTICS_READ;\r
-    Snp->Cdb.DBsize                 = sizeof (PXE_DB_STATISTICS);\r
+    Snp->Cdb.DBsize                 = (UINT16) sizeof (PXE_DB_STATISTICS);\r
     Snp->Cdb.DBaddr                 = (UINT64)(UINTN) (Db = Snp->Db);\r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
-  DEBUG ((EFI_D_INFO | EFI_D_NET, "\nsnp->undi.statistics()  "));\r
+  DEBUG ((EFI_D_NET, "\nsnp->undi.statistics()  "));\r
 \r
   (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
@@ -197,7 +191,7 @@ SnpUndi32Statistics (
       break;\r
     }\r
 \r
-    if (Db->Supported & Mask) {\r
+    if ((Db->Supported & Mask) != 0) {\r
       *Stp  = Db->Data[Index];\r
       Size  = Index + 1;\r
     } else {\r
@@ -208,7 +202,7 @@ SnpUndi32Statistics (
   // Compute size up to last supported statistic.\r
   //\r
   while (++Index < 64) {\r
-    if (Db->Supported & (Mask = LShiftU64 (Mask, 1))) {\r
+    if ((Db->Supported & (Mask = LShiftU64 (Mask, 1))) != 0) {\r
       Size = Index;\r
     }\r
   }\r