X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FSnpDxe%2FTransmit.c;h=44fdd71f41a8e6dcbec26a01bbcb262eda26fbb8;hp=f103a59b3fb769d7ab5e0d19f3797b95b453aa31;hb=9d510e61fceee7b92955ef9a3c20343752d8ce3f;hpb=f381602727922e793de5826ee390344cb907e07a
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c b/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c
index f103a59b3f..44fdd71f41 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c
+++ b/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c
@@ -1,14 +1,8 @@
/** @file
Implementation of transmitting a packet.
-
-Copyright (c) 2004 - 2007, Intel Corporation.
-All rights reserved. This program and the accompanying materials are licensed
-and made available under the terms and conditions of the BSD License which
-accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -90,7 +84,7 @@ PxeFillHeader (
Snp->Cdb.DBsize = PXE_DBSIZE_NOT_USED;
Snp->Cdb.DBaddr = PXE_DBADDR_NOT_USED;
- Snp->Cdb.CPBsize = sizeof (PXE_CPB_FILL_HEADER_FRAGMENTED);
+ Snp->Cdb.CPBsize = (UINT16) sizeof (PXE_CPB_FILL_HEADER_FRAGMENTED);
Snp->Cdb.CPBaddr = (UINT64)(UINTN) Cpb;
Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
@@ -101,7 +95,7 @@ PxeFillHeader (
//
// Issue UNDI command and check result.
//
- DEBUG ((EFI_D_INFO | EFI_D_NET, "\nSnp->undi.fill_header() "));
+ DEBUG ((EFI_D_NET, "\nSnp->undi.fill_header() "));
(*Snp->IssueUndi32Command) ((UINT64) (UINTN) &Snp->Cdb);
@@ -162,7 +156,7 @@ PxeTransmit (
Snp->Cdb.OpFlags = PXE_OPFLAGS_TRANSMIT_WHOLE;
- Snp->Cdb.CPBsize = sizeof (PXE_CPB_TRANSMIT);
+ Snp->Cdb.CPBsize = (UINT16) sizeof (PXE_CPB_TRANSMIT);
Snp->Cdb.CPBaddr = (UINT64)(UINTN) Cpb;
Snp->Cdb.OpCode = PXE_OPCODE_TRANSMIT;
@@ -177,16 +171,15 @@ PxeTransmit (
//
// Issue UNDI command and check result.
//
- DEBUG ((EFI_D_INFO | EFI_D_NET, "\nSnp->undi.transmit() "));
- DEBUG ((EFI_D_INFO | EFI_D_NET, "\nSnp->Cdb.OpCode == %x", Snp->Cdb.OpCode));
- DEBUG ((EFI_D_INFO | EFI_D_NET, "\nSnp->Cdb.CPBaddr == %LX", Snp->Cdb.CPBaddr));
- DEBUG ((EFI_D_INFO | EFI_D_NET, "\nSnp->Cdb.DBaddr == %LX", Snp->Cdb.DBaddr));
- DEBUG ((EFI_D_INFO | EFI_D_NET, "\nCpb->FrameAddr == %LX\n", Cpb->FrameAddr));
+ DEBUG ((EFI_D_NET, "\nSnp->undi.transmit() "));
+ DEBUG ((EFI_D_NET, "\nSnp->Cdb.OpCode == %x", Snp->Cdb.OpCode));
+ DEBUG ((EFI_D_NET, "\nSnp->Cdb.CPBaddr == %LX", Snp->Cdb.CPBaddr));
+ DEBUG ((EFI_D_NET, "\nSnp->Cdb.DBaddr == %LX", Snp->Cdb.DBaddr));
+ DEBUG ((EFI_D_NET, "\nCpb->FrameAddr == %LX\n", Cpb->FrameAddr));
(*Snp->IssueUndi32Command) ((UINT64) (UINTN) &Snp->Cdb);
- DEBUG ((EFI_D_INFO | EFI_D_NET, "\nexit Snp->undi.transmit() "));
- DEBUG ((EFI_D_INFO | EFI_D_NET, "\nSnp->Cdb.StatCode == %r", Snp->Cdb.StatCode));
+ DEBUG ((EFI_D_NET, "\nexit Snp->undi.transmit() "));
//
// we will unmap the buffers in get_status call, not here
@@ -195,66 +188,72 @@ PxeTransmit (
case PXE_STATCODE_SUCCESS:
return EFI_SUCCESS;
+ case PXE_STATCODE_BUFFER_FULL:
case PXE_STATCODE_QUEUE_FULL:
case PXE_STATCODE_BUSY:
Status = EFI_NOT_READY;
+ DEBUG (
+ (EFI_D_NET,
+ "\nSnp->undi.transmit() %xh:%xh\n",
+ Snp->Cdb.StatFlags,
+ Snp->Cdb.StatCode)
+ );
break;
default:
+ DEBUG (
+ (EFI_D_ERROR,
+ "\nSnp->undi.transmit() %xh:%xh\n",
+ Snp->Cdb.StatFlags,
+ Snp->Cdb.StatCode)
+ );
Status = EFI_DEVICE_ERROR;
}
- DEBUG (
- (EFI_D_ERROR,
- "\nSnp->undi.transmit() %xh:%xh\n",
- Snp->Cdb.StatFlags,
- Snp->Cdb.StatCode)
- );
-
return Status;
}
/**
Places a packet in the transmit queue of a network interface.
-
+
This function places the packet specified by Header and Buffer on the transmit
- queue. If HeaderSize is nonzero and HeaderSize is not equal to
- This->Mode->MediaHeaderSize, then EFI_INVALID_PARAMETER will be returned. If
+ queue. If HeaderSize is nonzero and HeaderSize is not equal to
+ This->Mode->MediaHeaderSize, then EFI_INVALID_PARAMETER will be returned. If
BufferSize is less than This->Mode->MediaHeaderSize, then EFI_BUFFER_TOO_SMALL
- will be returned. If Buffer is NULL, then EFI_INVALID_PARAMETER will be
+ will be returned. If Buffer is NULL, then EFI_INVALID_PARAMETER will be
returned. If HeaderSize is nonzero and DestAddr or Protocol is NULL, then
EFI_INVALID_PARAMETER will be returned. If the transmit engine of the network
- interface is busy, then EFI_NOT_READY will be returned. If this packet can be
- accepted by the transmit engine of the network interface, the packet contents
- specified by Buffer will be placed on the transmit queue of the network
- interface, and EFI_SUCCESS will be returned. GetStatus() can be used to
- determine when the packet has actually been transmitted. The contents of the
- Buffer must not be modified until the packet has actually been transmitted.
+ interface is busy, then EFI_NOT_READY will be returned. If this packet can be
+ accepted by the transmit engine of the network interface, the packet contents
+ specified by Buffer will be placed on the transmit queue of the network
+ interface, and EFI_SUCCESS will be returned. GetStatus() can be used to
+ determine when the packet has actually been transmitted. The contents of the
+ Buffer must not be modified until the packet has actually been transmitted.
The Transmit() function performs nonblocking I/O. A caller who wants to perform
- blocking I/O, should call Transmit(), and then GetStatus() until the
+ blocking I/O, should call Transmit(), and then GetStatus() until the
transmitted buffer shows up in the recycled transmit buffer.
If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.
@param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.
- @param HeaderSize The size, in bytes, of the media header to be filled in by the
+ @param HeaderSize The size, in bytes, of the media header to be filled in by the
Transmit() function. If HeaderSize is nonzero, then it must
be equal to This->Mode->MediaHeaderSize and the DestAddr and
Protocol parameters must not be NULL.
@param BufferSize The size, in bytes, of the entire packet (media header and
data) to be transmitted through the network interface.
- @param Buffer A pointer to the packet (media header followed by data) to be
- transmitted. This parameter cannot be NULL. If HeaderSize is
+ @param Buffer A pointer to the packet (media header followed by data) to be
+ transmitted. This parameter cannot be NULL. If HeaderSize is
zero, then the media header in Buffer must already be filled
- in by the caller. If HeaderSize is nonzero, then the media
+ in by the caller. If HeaderSize is nonzero, then the media
header will be filled in by the Transmit() function.
- @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this
- parameter is ignored. If HeaderSize is nonzero and SrcAddr
- is NULL, then This->Mode->CurrentAddress is used for the
+ @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this
+ parameter is ignored. If HeaderSize is nonzero and SrcAddr
+ is NULL, then This->Mode->CurrentAddress is used for the
source HW MAC address.
- @param DestAddr The destination HW MAC address. If HeaderSize is zero, then
+ @param DestAddr The destination HW MAC address. If HeaderSize is zero, then
this parameter is ignored.
- @param Protocol The type of header to build. If HeaderSize is zero, then this
- parameter is ignored. See RFC 1700, section "Ether Types,"
+ @param Protocol The type of header to build. If HeaderSize is zero, then this
+ parameter is ignored. See RFC 1700, section "Ether Types,"
for examples.
@retval EFI_SUCCESS The packet was placed on the transmit queue.