]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/SnpDxe/Statistics.c
NetworkPkg: Apply uncrustify changes
[mirror_edk2.git] / NetworkPkg / SnpDxe / Statistics.c
index faeec536fcf7ef6a4a99758fc7cce53b0b201a0a..34d1332523006a0ce06fa4c40ba2707b1dd5590e 100644 (file)
@@ -6,10 +6,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 \r
 **/\r
 \r
-\r
 #include "Snp.h"\r
 \r
-\r
 /**\r
   Resets or collects the statistics on a network interface.\r
 \r
@@ -60,20 +58,20 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 EFI_STATUS\r
 EFIAPI\r
 SnpUndi32Statistics (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
-  IN BOOLEAN                     Reset,\r
-  IN OUT UINTN                   *StatisticsSize  OPTIONAL,\r
-  IN OUT EFI_NETWORK_STATISTICS  *StatisticsTable OPTIONAL\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL  *This,\r
+  IN BOOLEAN                      Reset,\r
+  IN OUT UINTN                    *StatisticsSize  OPTIONAL,\r
+  IN OUT EFI_NETWORK_STATISTICS   *StatisticsTable OPTIONAL\r
   )\r
 {\r
-  SNP_DRIVER        *Snp;\r
-  PXE_DB_STATISTICS *Db;\r
-  UINT64            *Stp;\r
-  UINT64            Mask;\r
-  UINTN             Size;\r
-  UINTN             Index;\r
-  EFI_TPL           OldTpl;\r
-  EFI_STATUS        Status;\r
+  SNP_DRIVER         *Snp;\r
+  PXE_DB_STATISTICS  *Db;\r
+  UINT64             *Stp;\r
+  UINT64             Mask;\r
+  UINTN              Size;\r
+  UINTN              Index;\r
+  EFI_TPL            OldTpl;\r
+  EFI_STATUS         Status;\r
 \r
   //\r
   // Get pointer to SNP driver instance for *This.\r
@@ -90,78 +88,81 @@ SnpUndi32Statistics (
   // Return error if the SNP is not initialized.\r
   //\r
   switch (Snp->Mode.State) {\r
-  case EfiSimpleNetworkInitialized:\r
-    break;\r
+    case EfiSimpleNetworkInitialized:\r
+      break;\r
 \r
-  case EfiSimpleNetworkStopped:\r
-    Status = EFI_NOT_STARTED;\r
-    goto ON_EXIT;\r
+    case EfiSimpleNetworkStopped:\r
+      Status = EFI_NOT_STARTED;\r
+      goto ON_EXIT;\r
 \r
-  default:\r
-    Status = EFI_DEVICE_ERROR;\r
-    goto ON_EXIT;\r
+    default:\r
+      Status = EFI_DEVICE_ERROR;\r
+      goto ON_EXIT;\r
   }\r
+\r
   //\r
   // if we are not resetting the counters, we have to have a valid stat table\r
   // with >0 size. if no reset, no table and no size, return success.\r
   //\r
-  if (!Reset && StatisticsSize == NULL) {\r
+  if (!Reset && (StatisticsSize == NULL)) {\r
     Status = (StatisticsTable != NULL) ? EFI_INVALID_PARAMETER : EFI_SUCCESS;\r
     goto ON_EXIT;\r
   }\r
+\r
   //\r
   // Initialize UNDI Statistics CDB\r
   //\r
-  Snp->Cdb.OpCode     = PXE_OPCODE_STATISTICS;\r
-  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  Snp->Cdb.IFnum      = Snp->IfNum;\r
-  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.OpCode    = PXE_OPCODE_STATISTICS;\r
+  Snp->Cdb.CPBsize   = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr   = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.StatCode  = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum     = Snp->IfNum;\r
+  Snp->Cdb.Control   = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   if (Reset) {\r
-    Snp->Cdb.OpFlags  = PXE_OPFLAGS_STATISTICS_RESET;\r
-    Snp->Cdb.DBsize   = PXE_DBSIZE_NOT_USED;\r
-    Snp->Cdb.DBaddr   = PXE_DBADDR_NOT_USED;\r
-    Db                = Snp->Db;\r
+    Snp->Cdb.OpFlags = PXE_OPFLAGS_STATISTICS_RESET;\r
+    Snp->Cdb.DBsize  = PXE_DBSIZE_NOT_USED;\r
+    Snp->Cdb.DBaddr  = PXE_DBADDR_NOT_USED;\r
+    Db               = Snp->Db;\r
   } else {\r
-    Snp->Cdb.OpFlags                = PXE_OPFLAGS_STATISTICS_READ;\r
-    Snp->Cdb.DBsize                 = (UINT16) sizeof (PXE_DB_STATISTICS);\r
-    Snp->Cdb.DBaddr                 = (UINT64)(UINTN) (Db = Snp->Db);\r
+    Snp->Cdb.OpFlags = PXE_OPFLAGS_STATISTICS_READ;\r
+    Snp->Cdb.DBsize  = (UINT16)sizeof (PXE_DB_STATISTICS);\r
+    Snp->Cdb.DBaddr  = (UINT64)(UINTN)(Db = Snp->Db);\r
   }\r
+\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((DEBUG_NET, "\nsnp->undi.statistics()  "));\r
 \r
-  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
+  (*Snp->IssueUndi32Command)((UINT64)(UINTN)&Snp->Cdb);\r
 \r
   switch (Snp->Cdb.StatCode) {\r
-  case PXE_STATCODE_SUCCESS:\r
-    break;\r
-\r
-  case PXE_STATCODE_UNSUPPORTED:\r
-    DEBUG (\r
-      (DEBUG_ERROR,\r
-      "\nsnp->undi.statistics()  %xh:%xh\n",\r
-      Snp->Cdb.StatFlags,\r
-      Snp->Cdb.StatCode)\r
-      );\r
-\r
-    Status = EFI_UNSUPPORTED;\r
-    goto ON_EXIT;\r
-\r
-  default:\r
-    DEBUG (\r
-      (DEBUG_ERROR,\r
-      "\nsnp->undi.statistics()  %xh:%xh\n",\r
-      Snp->Cdb.StatFlags,\r
-      Snp->Cdb.StatCode)\r
-      );\r
+    case PXE_STATCODE_SUCCESS:\r
+      break;\r
 \r
-    Status = EFI_DEVICE_ERROR;\r
-    goto ON_EXIT;\r
+    case PXE_STATCODE_UNSUPPORTED:\r
+      DEBUG (\r
+        (DEBUG_ERROR,\r
+         "\nsnp->undi.statistics()  %xh:%xh\n",\r
+         Snp->Cdb.StatFlags,\r
+         Snp->Cdb.StatCode)\r
+        );\r
+\r
+      Status = EFI_UNSUPPORTED;\r
+      goto ON_EXIT;\r
+\r
+    default:\r
+      DEBUG (\r
+        (DEBUG_ERROR,\r
+         "\nsnp->undi.statistics()  %xh:%xh\n",\r
+         Snp->Cdb.StatFlags,\r
+         Snp->Cdb.StatCode)\r
+        );\r
+\r
+      Status = EFI_DEVICE_ERROR;\r
+      goto ON_EXIT;\r
   }\r
 \r
   if (Reset) {\r
@@ -171,16 +172,17 @@ SnpUndi32Statistics (
 \r
   if (StatisticsTable == NULL) {\r
     *StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);\r
-    Status = EFI_BUFFER_TOO_SMALL;\r
+    Status          = EFI_BUFFER_TOO_SMALL;\r
     goto ON_EXIT;\r
   }\r
+\r
   //\r
   // Convert the UNDI statistics information to SNP statistics\r
   // information.\r
   //\r
   ZeroMem (StatisticsTable, *StatisticsSize);\r
-  Stp   = (UINT64 *) StatisticsTable;\r
-  Size  = 0;\r
+  Stp  = (UINT64 *)StatisticsTable;\r
+  Size = 0;\r
 \r
   for (Index = 0, Mask = 1; Index < 64; Index++, Mask = LShiftU64 (Mask, 1), Stp++) {\r
     //\r
@@ -192,12 +194,13 @@ SnpUndi32Statistics (
     }\r
 \r
     if ((Db->Supported & Mask) != 0) {\r
-      *Stp  = Db->Data[Index];\r
-      Size  = Index + 1;\r
+      *Stp = Db->Data[Index];\r
+      Size = Index + 1;\r
     } else {\r
       SetMem (Stp, sizeof (UINT64), 0xFF);\r
     }\r
   }\r
+\r
   //\r
   // Compute size up to last supported statistic.\r
   //\r
@@ -211,10 +214,10 @@ SnpUndi32Statistics (
 \r
   if (*StatisticsSize >= Size) {\r
     *StatisticsSize = Size;\r
-    Status = EFI_SUCCESS;\r
+    Status          = EFI_SUCCESS;\r
   } else {\r
     *StatisticsSize = Size;\r
-    Status = EFI_BUFFER_TOO_SMALL;\r
+    Status          = EFI_BUFFER_TOO_SMALL;\r
   }\r
 \r
 ON_EXIT:\r