]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/SnpDxe/Transmit.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / Transmit.c
index 989481e0f86ec680652624a4171c4b44621a0f34..aff4e8410f5f9b321ed5d547794a96fc55d6f25a 100644 (file)
@@ -1,11 +1,11 @@
 /** @file\r
     Implementation of transmitting a packet.\r
\r
-Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>\r
-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
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+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
@@ -90,7 +90,7 @@ PxeFillHeader (
   Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
   Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
 \r
-  Snp->Cdb.CPBsize    = sizeof (PXE_CPB_FILL_HEADER_FRAGMENTED);\r
+  Snp->Cdb.CPBsize    = (UINT16) sizeof (PXE_CPB_FILL_HEADER_FRAGMENTED);\r
   Snp->Cdb.CPBaddr    = (UINT64)(UINTN) Cpb;\r
 \r
   Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
@@ -162,7 +162,7 @@ PxeTransmit (
 \r
   Snp->Cdb.OpFlags    = PXE_OPFLAGS_TRANSMIT_WHOLE;\r
 \r
-  Snp->Cdb.CPBsize    = sizeof (PXE_CPB_TRANSMIT);\r
+  Snp->Cdb.CPBsize    = (UINT16) sizeof (PXE_CPB_TRANSMIT);\r
   Snp->Cdb.CPBaddr    = (UINT64)(UINTN) Cpb;\r
 \r
   Snp->Cdb.OpCode     = PXE_OPCODE_TRANSMIT;\r
@@ -186,7 +186,6 @@ PxeTransmit (
   (*Snp->IssueUndi32Command) ((UINT64) (UINTN) &Snp->Cdb);\r
 \r
   DEBUG ((EFI_D_NET, "\nexit Snp->undi.transmit()  "));\r
-  DEBUG ((EFI_D_NET, "\nSnp->Cdb.StatCode == %r", Snp->Cdb.StatCode));\r
 \r
   //\r
   // we will unmap the buffers in get_status call, not here\r
@@ -195,66 +194,72 @@ PxeTransmit (
   case PXE_STATCODE_SUCCESS:\r
     return EFI_SUCCESS;\r
 \r
+  case PXE_STATCODE_BUFFER_FULL:\r
   case PXE_STATCODE_QUEUE_FULL:\r
   case PXE_STATCODE_BUSY:\r
     Status = EFI_NOT_READY;\r
+    DEBUG (\r
+      (EFI_D_NET,\r
+      "\nSnp->undi.transmit()  %xh:%xh\n",\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
+      );\r
     break;\r
 \r
   default:\r
+    DEBUG (\r
+      (EFI_D_ERROR,\r
+      "\nSnp->undi.transmit()  %xh:%xh\n",\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
+      );\r
     Status = EFI_DEVICE_ERROR;\r
   }\r
 \r
-  DEBUG (\r
-    (EFI_D_ERROR,\r
-    "\nSnp->undi.transmit()  %xh:%xh\n",\r
-    Snp->Cdb.StatFlags,\r
-    Snp->Cdb.StatCode)\r
-    );\r
-\r
   return Status;\r
 }\r
 \r
 /**\r
   Places a packet in the transmit queue of a network interface.\r
-  \r
+\r
   This function places the packet specified by Header and Buffer on the transmit\r
-  queue. If HeaderSize is nonzero and HeaderSize is not equal to \r
-  This->Mode->MediaHeaderSize, then EFI_INVALID_PARAMETER will be returned. If \r
+  queue. If HeaderSize is nonzero and HeaderSize is not equal to\r
+  This->Mode->MediaHeaderSize, then EFI_INVALID_PARAMETER will be returned. If\r
   BufferSize is less than This->Mode->MediaHeaderSize, then EFI_BUFFER_TOO_SMALL\r
-  will be returned. If Buffer is NULL, then EFI_INVALID_PARAMETER will be \r
+  will be returned. If Buffer is NULL, then EFI_INVALID_PARAMETER will be\r
   returned. If HeaderSize is nonzero and DestAddr or Protocol is NULL, then\r
   EFI_INVALID_PARAMETER will be returned. If the transmit engine of the network\r
-  interface is busy, then EFI_NOT_READY will be returned. If this packet can be \r
-  accepted by the transmit engine of the network interface, the packet contents \r
-  specified by Buffer will be placed on the transmit queue of the network \r
-  interface, and EFI_SUCCESS will be returned. GetStatus() can be used to \r
-  determine when the packet has actually been transmitted. The contents of the \r
-  Buffer must not be modified until the packet has actually been transmitted. \r
+  interface is busy, then EFI_NOT_READY will be returned. If this packet can be\r
+  accepted by the transmit engine of the network interface, the packet contents\r
+  specified by Buffer will be placed on the transmit queue of the network\r
+  interface, and EFI_SUCCESS will be returned. GetStatus() can be used to\r
+  determine when the packet has actually been transmitted. The contents of the\r
+  Buffer must not be modified until the packet has actually been transmitted.\r
   The Transmit() function performs nonblocking I/O. A caller who wants to perform\r
-  blocking I/O, should call Transmit(), and then GetStatus() until the \r
+  blocking I/O, should call Transmit(), and then GetStatus() until the\r
   transmitted buffer shows up in the recycled transmit buffer.\r
   If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
 \r
   @param This       A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
-  @param HeaderSize The size, in bytes, of the media header to be filled in by the \r
+  @param HeaderSize The size, in bytes, of the media header to be filled in by the\r
                     Transmit() function. If HeaderSize is nonzero, then it must\r
                     be equal to This->Mode->MediaHeaderSize and the DestAddr and\r
                     Protocol parameters must not be NULL.\r
   @param BufferSize The size, in bytes, of the entire packet (media header and\r
                     data) to be transmitted through the network interface.\r
-  @param Buffer     A pointer to the packet (media header followed by data) to be \r
-                    transmitted. This parameter cannot be NULL. If HeaderSize is \r
+  @param Buffer     A pointer to the packet (media header followed by data) to be\r
+                    transmitted. This parameter cannot be NULL. If HeaderSize is\r
                     zero, then the media header in Buffer must already be filled\r
-                    in by the caller. If HeaderSize is nonzero, then the media \r
+                    in by the caller. If HeaderSize is nonzero, then the media\r
                     header will be filled in by the Transmit() function.\r
-  @param SrcAddr    The source HW MAC address. If HeaderSize is zero, then this \r
-                    parameter is ignored. If HeaderSize is nonzero and SrcAddr \r
-                    is NULL, then This->Mode->CurrentAddress is used for the \r
+  @param SrcAddr    The source HW MAC address. If HeaderSize is zero, then this\r
+                    parameter is ignored. If HeaderSize is nonzero and SrcAddr\r
+                    is NULL, then This->Mode->CurrentAddress is used for the\r
                     source HW MAC address.\r
-  @param DestAddr   The destination HW MAC address. If HeaderSize is zero, then \r
+  @param DestAddr   The destination HW MAC address. If HeaderSize is zero, then\r
                     this parameter is ignored.\r
-  @param Protocol   The type of header to build. If HeaderSize is zero, then this \r
-                    parameter is ignored. See RFC 1700, section "Ether Types," \r
+  @param Protocol   The type of header to build. If HeaderSize is zero, then this\r
+                    parameter is ignored. See RFC 1700, section "Ether Types,"\r
                     for examples.\r
 \r
   @retval EFI_SUCCESS           The packet was placed on the transmit queue.\r