TianoCore EDK2 master
Loading...
Searching...
No Matches
MnpImpl.h File Reference
#include "MnpDriver.h"

Go to the source code of this file.

Data Structures

struct  MNP_INSTANCE_DATA
 
struct  MNP_GROUP_ADDRESS
 
struct  MNP_GROUP_CONTROL_BLOCK
 
struct  MNP_RXDATA_WRAP
 
struct  MNP_TX_BUF_WRAP
 

Macros

#define NET_ETHER_FCS_SIZE   4
 
#define MNP_SYS_POLL_INTERVAL   (10 * TICKS_PER_MS)
 
#define MNP_TIMEOUT_CHECK_INTERVAL   (50 * TICKS_PER_MS)
 
#define MNP_MEDIA_DETECT_INTERVAL   (500 * TICKS_PER_MS)
 
#define MNP_TX_TIMEOUT_TIME   (500 * TICKS_PER_MS)
 
#define MNP_INIT_NET_BUFFER_NUM   512
 
#define MNP_NET_BUFFER_INCREASEMENT   64
 
#define MNP_MAX_NET_BUFFER_NUM   65536
 
#define MNP_TX_BUFFER_INCREASEMENT   32
 
#define MNP_MAX_TX_BUFFER_NUM   65536
 
#define MNP_MAX_RCVD_PACKET_QUE_SIZE   256
 
#define MNP_RECEIVE_UNICAST   0x01
 
#define MNP_RECEIVE_BROADCAST   0x02
 
#define UNICAST_PACKET   MNP_RECEIVE_UNICAST
 
#define BROADCAST_PACKET   MNP_RECEIVE_BROADCAST
 
#define MNP_INSTANCE_DATA_SIGNATURE   SIGNATURE_32 ('M', 'n', 'p', 'I')
 
#define MNP_INSTANCE_DATA_FROM_THIS(a)
 
#define MNP_TX_BUF_WRAP_SIGNATURE   SIGNATURE_32 ('M', 'T', 'B', 'W')
 

Functions

EFI_STATUS MnpInitializeDeviceData (IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle)
 
VOID MnpDestroyDeviceData (IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN EFI_HANDLE ImageHandle)
 
MNP_SERVICE_DATAMnpCreateServiceData (IN MNP_DEVICE_DATA *MnpDeviceData, IN UINT16 VlanId, IN UINT8 Priority OPTIONAL)
 
EFI_STATUS MnpInitializeServiceData (IN OUT MNP_SERVICE_DATA *MnpServiceData, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle)
 
EFI_STATUS MnpDestroyServiceData (IN OUT MNP_SERVICE_DATA *MnpServiceData)
 
EFI_STATUS MnpDestroyServiceChild (IN OUT MNP_SERVICE_DATA *MnpServiceData)
 
MNP_SERVICE_DATAMnpFindServiceData (IN MNP_DEVICE_DATA *MnpDeviceData, IN UINT16 VlanId)
 
VOID MnpInitializeInstanceData (IN MNP_SERVICE_DATA *MnpServiceData, IN OUT MNP_INSTANCE_DATA *Instance)
 
EFI_STATUS EFIAPI MnpTokenExist (IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg)
 
EFI_STATUS EFIAPI MnpCancelTokens (IN OUT NET_MAP *Map, IN OUT NET_MAP_ITEM *Item, IN VOID *Arg)
 
VOID MnpFlushRcvdDataQueue (IN OUT MNP_INSTANCE_DATA *Instance)
 
EFI_STATUS MnpConfigureInstance (IN OUT MNP_INSTANCE_DATA *Instance, IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL)
 
EFI_STATUS MnpGroupOp (IN OUT MNP_INSTANCE_DATA *Instance, IN BOOLEAN JoinFlag, IN EFI_MAC_ADDRESS *MacAddress OPTIONAL, IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL)
 
BOOLEAN MnpIsValidTxToken (IN MNP_INSTANCE_DATA *Instance, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
 
EFI_STATUS MnpBuildTxPacket (IN MNP_SERVICE_DATA *MnpServiceData, IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData, OUT UINT8 **PktBuf, OUT UINT32 *PktLen)
 
EFI_STATUS MnpSyncSendPacket (IN MNP_SERVICE_DATA *MnpServiceData, IN UINT8 *Packet, IN UINT32 Length, IN OUT EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
 
EFI_STATUS MnpInstanceDeliverPacket (IN OUT MNP_INSTANCE_DATA *Instance)
 
VOID EFIAPI MnpRecycleRxData (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS MnpReceivePacket (IN OUT MNP_DEVICE_DATA *MnpDeviceData)
 
NET_BUFMnpAllocNbuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData)
 
VOID MnpFreeNbuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN OUT NET_BUF *Nbuf)
 
UINT8 * MnpAllocTxBuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData)
 
EFI_STATUS MnpRecycleTxBuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData)
 
VOID EFIAPI MnpCheckPacketTimeout (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI MnpCheckMediaStatus (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI MnpSystemPoll (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI MnpGetModeData (IN EFI_MANAGED_NETWORK_PROTOCOL *This, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL)
 
EFI_STATUS EFIAPI MnpConfigure (IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL)
 
EFI_STATUS EFIAPI MnpMcastIpToMac (IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN BOOLEAN Ipv6Flag, IN EFI_IP_ADDRESS *IpAddress, OUT EFI_MAC_ADDRESS *MacAddress)
 
EFI_STATUS EFIAPI MnpGroups (IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_MAC_ADDRESS *MacAddress OPTIONAL)
 
EFI_STATUS EFIAPI MnpTransmit (IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
 
EFI_STATUS EFIAPI MnpCancel (IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL)
 
EFI_STATUS EFIAPI MnpReceive (IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
 
EFI_STATUS EFIAPI MnpPoll (IN EFI_MANAGED_NETWORK_PROTOCOL *This)
 
EFI_STATUS MnpConfigReceiveFilters (IN MNP_DEVICE_DATA *MnpDeviceData)
 

Detailed Description

Declaration of structures and functions of MnpDxe driver.

Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file MnpImpl.h.

Macro Definition Documentation

◆ BROADCAST_PACKET

#define BROADCAST_PACKET   MNP_RECEIVE_BROADCAST

Definition at line 32 of file MnpImpl.h.

◆ MNP_INIT_NET_BUFFER_NUM

#define MNP_INIT_NET_BUFFER_NUM   512

Definition at line 20 of file MnpImpl.h.

◆ MNP_INSTANCE_DATA_FROM_THIS

#define MNP_INSTANCE_DATA_FROM_THIS (   a)
Value:
CR ( \
(a), \
ManagedNetwork, \
MNP_INSTANCE_DATA_SIGNATURE \
)
#define CR(Record, TYPE, Field, TestSignature)
Definition: DebugLib.h:659

Definition at line 36 of file MnpImpl.h.

◆ MNP_INSTANCE_DATA_SIGNATURE

#define MNP_INSTANCE_DATA_SIGNATURE   SIGNATURE_32 ('M', 'n', 'p', 'I')

Definition at line 34 of file MnpImpl.h.

◆ MNP_MAX_NET_BUFFER_NUM

#define MNP_MAX_NET_BUFFER_NUM   65536

Definition at line 22 of file MnpImpl.h.

◆ MNP_MAX_RCVD_PACKET_QUE_SIZE

#define MNP_MAX_RCVD_PACKET_QUE_SIZE   256

Definition at line 26 of file MnpImpl.h.

◆ MNP_MAX_TX_BUFFER_NUM

#define MNP_MAX_TX_BUFFER_NUM   65536

Definition at line 24 of file MnpImpl.h.

◆ MNP_MEDIA_DETECT_INTERVAL

#define MNP_MEDIA_DETECT_INTERVAL   (500 * TICKS_PER_MS)

Definition at line 18 of file MnpImpl.h.

◆ MNP_NET_BUFFER_INCREASEMENT

#define MNP_NET_BUFFER_INCREASEMENT   64

Definition at line 21 of file MnpImpl.h.

◆ MNP_RECEIVE_BROADCAST

#define MNP_RECEIVE_BROADCAST   0x02

Definition at line 29 of file MnpImpl.h.

◆ MNP_RECEIVE_UNICAST

#define MNP_RECEIVE_UNICAST   0x01

Definition at line 28 of file MnpImpl.h.

◆ MNP_SYS_POLL_INTERVAL

#define MNP_SYS_POLL_INTERVAL   (10 * TICKS_PER_MS)

Definition at line 16 of file MnpImpl.h.

◆ MNP_TIMEOUT_CHECK_INTERVAL

#define MNP_TIMEOUT_CHECK_INTERVAL   (50 * TICKS_PER_MS)

Definition at line 17 of file MnpImpl.h.

◆ MNP_TX_BUF_WRAP_SIGNATURE

#define MNP_TX_BUF_WRAP_SIGNATURE   SIGNATURE_32 ('M', 'T', 'B', 'W')

Definition at line 90 of file MnpImpl.h.

◆ MNP_TX_BUFFER_INCREASEMENT

#define MNP_TX_BUFFER_INCREASEMENT   32

Definition at line 23 of file MnpImpl.h.

◆ MNP_TX_TIMEOUT_TIME

#define MNP_TX_TIMEOUT_TIME   (500 * TICKS_PER_MS)

Definition at line 19 of file MnpImpl.h.

◆ NET_ETHER_FCS_SIZE

#define NET_ETHER_FCS_SIZE   4

Definition at line 14 of file MnpImpl.h.

◆ UNICAST_PACKET

#define UNICAST_PACKET   MNP_RECEIVE_UNICAST

Definition at line 31 of file MnpImpl.h.

Function Documentation

◆ MnpAllocNbuf()

NET_BUF * MnpAllocNbuf ( IN OUT MNP_DEVICE_DATA MnpDeviceData)

Allocate a free NET_BUF from MnpDeviceData->FreeNbufQue. If there is none in the queue, first try to allocate some and add them into the queue, then fetch the NET_BUF from the updated FreeNbufQue.

Parameters
[in,out]MnpDeviceDataPointer to the MNP_DEVICE_DATA.
Returns
Pointer to the allocated free NET_BUF structure, if NULL the operation is failed.

Definition at line 103 of file MnpConfig.c.

◆ MnpAllocTxBuf()

UINT8 * MnpAllocTxBuf ( IN OUT MNP_DEVICE_DATA MnpDeviceData)

Allocate a free TX buffer from MnpDeviceData->FreeTxBufList. If there is none in the queue, first try to recycle some from SNP, then try to allocate some and add them into the queue, then fetch the NET_BUF from the updated FreeTxBufList.

Parameters
[in,out]MnpDeviceDataPointer to the MNP_DEVICE_DATA.
Returns
Pointer to the allocated free NET_BUF structure, if NULL the operation is failed.

Definition at line 260 of file MnpConfig.c.

◆ MnpBuildTxPacket()

EFI_STATUS MnpBuildTxPacket ( IN MNP_SERVICE_DATA MnpServiceData,
IN EFI_MANAGED_NETWORK_TRANSMIT_DATA TxData,
OUT UINT8 **  PktBuf,
OUT UINT32 *  PktLen 
)

Build the packet to transmit from the TxData passed in.

Parameters
[in]MnpServiceDataPointer to the mnp service context data.
[in]TxDataPointer to the transmit data containing the information to build the packet.
[out]PktBufPointer to record the address of the packet.
[out]PktLenPointer to a UINT32 variable used to record the packet's length.
Return values
EFI_SUCCESSTxPackage is built.
EFI_OUT_OF_RESOURCESThe deliver fails due to lack of memory resource.

Definition at line 112 of file MnpIo.c.

◆ MnpCancel()

EFI_STATUS EFIAPI MnpCancel ( IN EFI_MANAGED_NETWORK_PROTOCOL This,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token  OPTIONAL 
)

Aborts an asynchronous transmit or receive request.

The Cancel() function is used to abort a pending transmit or receive request. If the token is in the transmit or receive request queues, after calling this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be signaled. If the token is not in one of the queues, which usually means that the asynchronous operation has completed, this function will not signal the token and EFI_NOT_FOUND is returned.

Parameters
[in]ThisPointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
[in]TokenPointer to a token that has been issued by EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If NULL, all pending tokens are aborted.
Return values
EFI_SUCCESSThe asynchronous I/O request was aborted and Token.Event was signaled. When Token is NULL, all pending requests were aborted and their events were signaled.
EFI_NOT_STARTEDThis MNP child driver instance has not been configured.
EFI_INVALID_PARAMETERThis is NULL.
EFI_NOT_FOUNDWhen Token is not NULL, the asynchronous I/O request was not found in the transmit or receive queue. It has either completed or was not issued by Transmit() and Receive().

Definition at line 683 of file MnpMain.c.

◆ MnpCancelTokens()

EFI_STATUS EFIAPI MnpCancelTokens ( IN OUT NET_MAP Map,
IN OUT NET_MAP_ITEM Item,
IN VOID *  Arg 
)

Cancel the token specified by Arg if it matches the token in Item.

Parameters
[in,out]MapPointer to the NET_MAP.
[in,out]ItemPointer to the NET_MAP_ITEM.
[in]ArgPointer to the Arg, it's a pointer to the token to cancel.
Return values
EFI_SUCCESSThe Arg is NULL, and the token in Item is cancelled, or the Arg isn't NULL, and the token in Item is different from the Arg.
EFI_ABORTEDThe Arg isn't NULL, the token in Item mathces the Arg, and the token is cancelled.

Definition at line 1063 of file MnpConfig.c.

◆ MnpCheckMediaStatus()

VOID EFIAPI MnpCheckMediaStatus ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Poll to update MediaPresent field in SNP ModeData by Snp.GetStatus().

Parameters
[in]EventThe event this notify function registered to.
[in]ContextPointer to the context data registered to the event.

Poll to update MediaPresent field in SNP ModeData by Snp->GetStatus().

Parameters
[in]EventThe event this notify function registered to.
[in]ContextPointer to the context data registered to the event.

Definition at line 1064 of file MnpIo.c.

◆ MnpCheckPacketTimeout()

VOID EFIAPI MnpCheckPacketTimeout ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Remove the received packets if timeout occurs.

Parameters
[in]EventThe event this notify function registered to.
[in]ContextPointer to the context data registered to the event.

Definition at line 997 of file MnpIo.c.

◆ MnpConfigReceiveFilters()

EFI_STATUS MnpConfigReceiveFilters ( IN MNP_DEVICE_DATA MnpDeviceData)

Configure the Snp receive filters according to the instances' receive filter settings.

Parameters
[in]MnpDeviceDataPointer to the mnp device context data.
Return values
EFI_SUCCESSThe receive filters is configured.
EFI_OUT_OF_RESOURCESThe receive filters can't be configured due to lack of memory resource.

Definition at line 1538 of file MnpConfig.c.

◆ MnpConfigure()

EFI_STATUS EFIAPI MnpConfigure ( IN EFI_MANAGED_NETWORK_PROTOCOL This,
IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData  OPTIONAL 
)

Sets or clears the operational parameters for the MNP child driver.

The Configure() function is used to set, change, or reset the operational parameters for the MNP child driver instance. Until the operational parameters have been set, no network traffic can be sent or received by this MNP child driver instance. Once the operational parameters have been reset, no more traffic can be sent or received until the operational parameters have been set again. Each MNP child driver instance can be started and stopped independently of each other by setting or resetting their receive filter settings with the Configure() function. After any successful call to Configure(), the MNP child driver instance is started. The internal periodic timer (if supported) is enabled. Data can be transmitted and may be received if the receive filters have also been enabled. Note: If multiple MNP child driver instances will receive the same packet because of overlapping receive filter settings, then the first MNP child driver instance will receive the original packet and additional instances will receive copies of the original packet. Note: Warning: Receive filter settings that overlap will consume extra processor and/or DMA resources and degrade system and network performance.

Parameters
[in]ThisPointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
[in]MnpConfigDataPointer to configuration data that will be assigned to the MNP child driver instance. If NULL, the MNP child driver instance is reset to startup defaults and all pending transmit and receive requests are flushed. Type EFI_MANAGED_NETWORK_CONFIG_DATA is defined in EFI_MANAGED_NETWORK_PROTOCOL.GetModeData().
Return values
EFI_SUCCESSThe operation completed successfully.
EFI_INVALID_PARAMETEROne or more of the following conditions is TRUE: This is NULL. MnpConfigData.ProtocolTypeFilter is not valid. The operational data for the MNP child driver instance is unchanged.
EFI_OUT_OF_RESOURCESRequired system resources (usually memory) could not be allocated. The MNP child driver instance has been reset to startup defaults.
EFI_UNSUPPORTEDThe requested feature is unsupported in this [MNP] implementation. The operational data for the MNP child driver instance is unchanged.
EFI_DEVICE_ERRORAn unexpected network or system error occurred. The MNP child driver instance has been reset to startup defaults.
OthersThe MNP child driver instance has been reset to startup defaults.

Definition at line 144 of file MnpMain.c.

◆ MnpConfigureInstance()

EFI_STATUS MnpConfigureInstance ( IN OUT MNP_INSTANCE_DATA Instance,
IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData  OPTIONAL 
)

Configure the Instance using ConfigData.

Parameters
[in,out]InstancePointer to the mnp instance context data.
[in]ConfigDataPointer to the configuration data used to configure the instance.
Return values
EFI_SUCCESSThe Instance is configured.
EFI_UNSUPPORTEDEnableReceiveTimestamps is on and the implementation doesn't support it.
OthersOther errors as indicated.

Definition at line 1404 of file MnpConfig.c.

◆ MnpCreateServiceData()

MNP_SERVICE_DATA * MnpCreateServiceData ( IN MNP_DEVICE_DATA MnpDeviceData,
IN UINT16  VlanId,
IN UINT8 Priority  OPTIONAL 
)

Create mnp service context data.

Parameters
[in]MnpDeviceDataPointer to the mnp device context data.
[in]VlanIdThe VLAN ID.
[in]PriorityThe VLAN priority. If VlanId is 0, Priority is ignored.
Returns
A pointer to MNP_SERVICE_DATA or NULL if failed to create MNP service context.

Definition at line 690 of file MnpConfig.c.

◆ MnpDestroyDeviceData()

VOID MnpDestroyDeviceData ( IN OUT MNP_DEVICE_DATA MnpDeviceData,
IN EFI_HANDLE  ImageHandle 
)

Destroy the MNP device context data.

Parameters
[in,out]MnpDeviceDataPointer to the mnp device context data.
[in]ImageHandleThe driver image handle.

Definition at line 614 of file MnpConfig.c.

◆ MnpDestroyServiceChild()

EFI_STATUS MnpDestroyServiceChild ( IN OUT MNP_SERVICE_DATA MnpServiceData)

Destroy all child of the MNP service data.

Parameters
[in,out]MnpServiceDataPointer to the mnp service context data.
Return values
EFI_SUCCESSAll child are destroyed.
OthersFailed to destroy all child.

Definition at line 903 of file MnpConfig.c.

◆ MnpDestroyServiceData()

EFI_STATUS MnpDestroyServiceData ( IN OUT MNP_SERVICE_DATA MnpServiceData)

Destroy the MNP service context data.

Parameters
[in,out]MnpServiceDataPointer to the mnp service context data.
Return values
EFI_SUCCESSThe mnp service context is destroyed.
OthersErrors as indicated.

Definition at line 807 of file MnpConfig.c.

◆ MnpFindServiceData()

MNP_SERVICE_DATA * MnpFindServiceData ( IN MNP_DEVICE_DATA MnpDeviceData,
IN UINT16  VlanId 
)

Find the MNP Service Data for given VLAN ID.

Parameters
[in]MnpDeviceDataPointer to the mnp device context data.
[in]VlanIdThe VLAN ID.
Returns
A pointer to MNP_SERVICE_DATA or NULL if not found.

Definition at line 936 of file MnpConfig.c.

◆ MnpFlushRcvdDataQueue()

VOID MnpFlushRcvdDataQueue ( IN OUT MNP_INSTANCE_DATA Instance)

Flush the instance's received data.

Parameters
[in,out]InstancePointer to the mnp instance context data.

Definition at line 1361 of file MnpConfig.c.

◆ MnpFreeNbuf()

VOID MnpFreeNbuf ( IN OUT MNP_DEVICE_DATA MnpDeviceData,
IN OUT NET_BUF Nbuf 
)

Try to reclaim the Nbuf into the buffer pool.

Parameters
[in,out]MnpDeviceDataPointer to the mnp device context data.
[in,out]NbufPointer to the NET_BUF to free.

Definition at line 170 of file MnpConfig.c.

◆ MnpGetModeData()

EFI_STATUS EFIAPI MnpGetModeData ( IN EFI_MANAGED_NETWORK_PROTOCOL This,
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData  OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData  OPTIONAL 
)

Returns the operational parameters for the current MNP child driver. May also support returning the underlying SNP driver mode data.

The GetModeData() function is used to read the current mode data (operational parameters) from the MNP or the underlying SNP.

Parameters
[in]ThisPointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
[out]MnpConfigDataPointer to storage for MNP operational parameters. Type EFI_MANAGED_NETWORK_CONFIG_DATA is defined in "Related Definitions" below.
[out]SnpModeDataPointer to storage for SNP operational parameters. This feature may be unsupported. Type EFI_SIMPLE_NETWORK_MODE is defined in the EFI_SIMPLE_NETWORK_PROTOCOL.
Return values
EFI_SUCCESSThe operation completed successfully.
EFI_INVALID_PARAMETERThis is NULL.
EFI_UNSUPPORTEDThe requested feature is unsupported in this MNP implementation.
EFI_NOT_STARTEDThis MNP child driver instance has not been configured. The default values are returned in MnpConfigData if it is not NULL.
OthersThe mode data could not be read.

Definition at line 38 of file MnpMain.c.

◆ MnpGroupOp()

EFI_STATUS MnpGroupOp ( IN OUT MNP_INSTANCE_DATA Instance,
IN BOOLEAN  JoinFlag,
IN EFI_MAC_ADDRESS *MacAddress  OPTIONAL,
IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk  OPTIONAL 
)

Do the group operations for this instance.

Parameters
[in,out]InstancePointer to the instance context data.
[in]JoinFlagSet to TRUE to join a group. Set to TRUE to leave a group/groups.
[in]MacAddressPointer to the group address to join or leave.
[in]CtrlBlkPointer to the group control block if JoinFlag is FALSE.
Return values
EFI_SUCCESSThe group operation finished.
EFI_OUT_OF_RESOURCESFailed due to lack of memory resources.
OthersOther errors as indicated.

Definition at line 1816 of file MnpConfig.c.

◆ MnpGroups()

EFI_STATUS EFIAPI MnpGroups ( IN EFI_MANAGED_NETWORK_PROTOCOL This,
IN BOOLEAN  JoinFlag,
IN EFI_MAC_ADDRESS *MacAddress  OPTIONAL 
)

Enables and disables receive filters for multicast address. This function may be unsupported in some MNP implementations.

The Groups() function only adds and removes multicast MAC addresses from the filter list. The MNP driver does not transmit or process Internet Group Management Protocol (IGMP) packets. If JoinFlag is FALSE and MacAddress is NULL, then all joined groups are left.

Parameters
[in]ThisPointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
[in]JoinFlagSet to TRUE to join this multicast group. Set to FALSE to leave this multicast group.
[in]MacAddressPointer to the multicast MAC group (address) to join or leave.
Return values
EFI_SUCCESSThe requested operation completed successfully.
EFI_INVALID_PARAMETEROne or more of the following conditions is TRUE: This is NULL. JoinFlag is TRUE and MacAddress is NULL. MacAddress is not a valid multicast MAC address. The MNP multicast group settings are unchanged.
EFI_NOT_STARTEDThis MNP child driver instance has not been configured.
EFI_ALREADY_STARTEDThe supplied multicast group is already joined.
EFI_NOT_FOUNDThe supplied multicast group is not joined.
EFI_DEVICE_ERRORAn unexpected network or system error occurred. The MNP child driver instance has been reset to startup defaults.
EFI_UNSUPPORTEDThe requested feature is unsupported in this MNP implementation.
OthersThe requested operation could not be completed. The MNP multicast group settings are unchanged.

Definition at line 343 of file MnpMain.c.

◆ MnpInitializeDeviceData()

EFI_STATUS MnpInitializeDeviceData ( IN OUT MNP_DEVICE_DATA MnpDeviceData,
IN EFI_HANDLE  ImageHandle,
IN EFI_HANDLE  ControllerHandle 
)

Initialize the mnp device context data.

Parameters
[in,out]MnpDeviceDataPointer to the mnp device context data.
[in]ImageHandleThe driver image handle.
[in]ControllerHandleHandle of device to bind driver to.
Return values
EFI_SUCCESSThe mnp service context is initialized.
EFI_UNSUPPORTEDControllerHandle does not support Simple Network Protocol.
OthersOther errors as indicated.

Definition at line 420 of file MnpConfig.c.

◆ MnpInitializeInstanceData()

VOID MnpInitializeInstanceData ( IN MNP_SERVICE_DATA MnpServiceData,
IN OUT MNP_INSTANCE_DATA Instance 
)

Initialize the mnp instance context data.

Parameters
[in]MnpServiceDataPointer to the mnp service context data.
[in,out]InstancePointer to the mnp instance context data to initialize.

Definition at line 966 of file MnpConfig.c.

◆ MnpInitializeServiceData()

EFI_STATUS MnpInitializeServiceData ( IN OUT MNP_SERVICE_DATA MnpServiceData,
IN EFI_HANDLE  ImageHandle,
IN EFI_HANDLE  ControllerHandle 
)

Initialize the mnp service context data.

Parameters
[in,out]MnpServiceDataPointer to the mnp service context data.
[in]ImageHandleThe driver image handle.
[in]ControllerHandleHandle of device to bind driver to.
Return values
EFI_SUCCESSThe mnp service context is initialized.
EFI_UNSUPPORTEDControllerHandle does not support Simple Network Protocol.
OthersOther errors as indicated.

◆ MnpInstanceDeliverPacket()

EFI_STATUS MnpInstanceDeliverPacket ( IN OUT MNP_INSTANCE_DATA Instance)

Try to deliver the received packet to the instance.

Parameters
[in,out]InstancePointer to the mnp instance context data.
Return values
EFI_SUCCESSThe received packet is delivered, or there is no packet to deliver, or there is no available receive token.
EFI_OUT_OF_RESOURCESThe deliver fails due to lack of memory resource.

Definition at line 306 of file MnpIo.c.

◆ MnpIsValidTxToken()

BOOLEAN MnpIsValidTxToken ( IN MNP_INSTANCE_DATA Instance,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN Token 
)

Validates the Mnp transmit token.

Parameters
[in]InstancePointer to the Mnp instance context data.
[in]TokenPointer to the transmit token to check.
Returns
The Token is valid or not.

Definition at line 22 of file MnpIo.c.

◆ MnpMcastIpToMac()

EFI_STATUS EFIAPI MnpMcastIpToMac ( IN EFI_MANAGED_NETWORK_PROTOCOL This,
IN BOOLEAN  Ipv6Flag,
IN EFI_IP_ADDRESS IpAddress,
OUT EFI_MAC_ADDRESS MacAddress 
)

Translates an IP multicast address to a hardware (MAC) multicast address. This function may be unsupported in some MNP implementations.

The McastIpToMac() function translates an IP multicast address to a hardware (MAC) multicast address. This function may be implemented by calling the underlying EFI_SIMPLE_NETWORK. MCastIpToMac() function, which may also be unsupported in some MNP implementations.

Parameters
[in]ThisPointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
[in]Ipv6FlagSet to TRUE to if IpAddress is an IPv6 multicast address. Set to FALSE if IpAddress is an IPv4 multicast address.
[in]IpAddressPointer to the multicast IP address (in network byte order) to convert.
[out]MacAddressPointer to the resulting multicast MAC address.
Return values
EFI_SUCCESSThe operation completed successfully.
EFI_INVALID_PARAMETEROne of the following conditions is TRUE: This is NULL. IpAddress is NULL. IpAddress is not a valid multicast IP address. MacAddress is NULL.
EFI_NOT_STARTEDThis MNP child driver instance has not been configured.
EFI_UNSUPPORTEDThe requested feature is unsupported in this MNP implementation.
EFI_DEVICE_ERRORAn unexpected network or system error occurred.
OthersThe address could not be converted.

Definition at line 217 of file MnpMain.c.

◆ MnpPoll()

EFI_STATUS EFIAPI MnpPoll ( IN EFI_MANAGED_NETWORK_PROTOCOL This)

Polls for incoming data packets and processes outgoing data packets.

The Poll() function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit and receive queues. Normally, a periodic timer event internally calls the Poll() function. But, in some systems, the periodic timer event may not call Poll() fast enough to transmit and/or receive all data packets without missing packets. Drivers and applications that are experiencing packet loss should try calling the Poll() function more often.

Parameters
[in]ThisPointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
Return values
EFI_SUCCESSIncoming or outgoing data was processed.
EFI_NOT_STARTEDThis MNP child driver instance has not been configured.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. The MNP child driver instance has been reset to startup defaults.
EFI_NOT_READYNo incoming or outgoing data was processed. Consider increasing the polling rate.
EFI_TIMEOUTData was dropped out of the transmit and/or receive queue. Consider increasing the polling rate.

Definition at line 752 of file MnpMain.c.

◆ MnpReceive()

Places an asynchronous receiving request into the receiving queue.

The Receive() function places a completion token into the receive packet queue. This function is always asynchronous. The caller must fill in the Token.Event field in the completion token, and this field cannot be NULL. When the receive operation completes, the MNP updates the Token.Status and Token.RxData fields and the Token.Event is signaled.

Parameters
[in]ThisPointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
[in]TokenPointer to a token associated with the receive data descriptor. Type EFI_MANAGED_NETWORK_COMPLETION_TOKEN is defined in EFI_MANAGED_NETWORK_PROTOCOL.Transmit().
Return values
EFI_SUCCESSThe receive completion token was cached.
EFI_NOT_STARTEDThis MNP child driver instance has not been configured.
EFI_INVALID_PARAMETEROne or more of the following conditions is TRUE: This is NULL. Token is NULL. Token.Event is NULL
EFI_OUT_OF_RESOURCESThe transmit data could not be queued due to a lack of system resources (usually memory).
EFI_DEVICE_ERRORAn unexpected system or network error occurred. The MNP child driver instance has been reset to startup defaults.
EFI_ACCESS_DENIEDThe receive completion token was already in the receive queue.
EFI_NOT_READYThe receive request could not be queued because the receive queue is full.

Definition at line 600 of file MnpMain.c.

◆ MnpReceivePacket()

EFI_STATUS MnpReceivePacket ( IN OUT MNP_DEVICE_DATA MnpDeviceData)

Try to receive a packet and deliver it.

Parameters
[in,out]MnpDeviceDataPointer to the mnp device context data.
Return values
EFI_SUCCESSadd return value to function comment
EFI_NOT_STARTEDThe simple network protocol is not started.
EFI_NOT_READYNo packet received.
EFI_DEVICE_ERRORAn unexpected error occurs.

Definition at line 828 of file MnpIo.c.

◆ MnpRecycleRxData()

VOID EFIAPI MnpRecycleRxData ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Recycle the RxData and other resources used to hold and deliver the received packet.

Parameters
[in]EventThe event this notify function registered to.
[in]ContextPointer to the context data registered to the Event.

Definition at line 424 of file MnpIo.c.

◆ MnpRecycleTxBuf()

EFI_STATUS MnpRecycleTxBuf ( IN OUT MNP_DEVICE_DATA MnpDeviceData)

Try to recycle all the transmitted buffer address from SNP.

Parameters
[in,out]MnpDeviceDataPointer to the mnp device context data.
Return values
EFI_SUCCESSSuccessed to recycle the transmitted buffer address.
OthersFailed to recycle the transmitted buffer address.

Try to recycle all the transmitted buffer address from SNP.

Parameters
[in,out]MnpDeviceDataPointer to the mnp device context data.
Return values
EFI_SUCCESSSuccessed to recyclethe transmitted buffer address.
OthersFailed to recyclethe transmitted buffer address.

Definition at line 381 of file MnpConfig.c.

◆ MnpSyncSendPacket()

EFI_STATUS MnpSyncSendPacket ( IN MNP_SERVICE_DATA MnpServiceData,
IN UINT8 *  Packet,
IN UINT32  Length,
IN OUT EFI_MANAGED_NETWORK_COMPLETION_TOKEN Token 
)

Synchronously send out the packet.

This function places the packet buffer to SNP driver's tansmit queue. The packet can be considered successfully sent out once SNP accept the packet, while the packet buffer recycle is deferred for better performance.

Parameters
[in]MnpServiceDataPointer to the mnp service context data.
[in]PacketPointer to the packet buffer.
[in]LengthThe length of the packet.
[in,out]TokenPointer to the token the packet generated from.
Return values
EFI_SUCCESSThe packet is sent out.
EFI_TIMEOUTTime out occurs, the packet isn't sent.
EFI_DEVICE_ERRORAn unexpected network error occurs.

Definition at line 206 of file MnpIo.c.

◆ MnpSystemPoll()

VOID EFIAPI MnpSystemPoll ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Poll to receive the packets from Snp. This function is either called by upperlayer protocols/applications or the system poll timer notify mechanism.

Parameters
[in]EventThe event this notify function registered to.
[in]ContextPointer to the context data registered to the event.

Definition at line 1096 of file MnpIo.c.

◆ MnpTokenExist()

EFI_STATUS EFIAPI MnpTokenExist ( IN NET_MAP Map,
IN NET_MAP_ITEM Item,
IN VOID *  Arg 
)

Check whether the token specified by Arg matches the token in Item.

Parameters
[in]MapPointer to the NET_MAP.
[in]ItemPointer to the NET_MAP_ITEM.
[in]ArgPointer to the Arg, it's a pointer to the token to check.
Return values
EFI_SUCCESSThe token specified by Arg is different from the token in Item.
EFI_ACCESS_DENIEDThe token specified by Arg is the same as that in Item.

Definition at line 1023 of file MnpConfig.c.

◆ MnpTransmit()

Places asynchronous outgoing data packets into the transmit queue.

The Transmit() function places a completion token into the transmit packet queue. This function is always asynchronous. The caller must fill in the Token.Event and Token.TxData fields in the completion token, and these fields cannot be NULL. When the transmit operation completes, the MNP updates the Token.Status field and the Token.Event is signaled. Note: There may be a performance penalty if the packet needs to be defragmented before it can be transmitted by the network device. Systems in which performance is critical should review the requirements and features of the underlying communications device and drivers.

Parameters
[in]ThisPointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
[in]TokenPointer to a token associated with the transmit data descriptor. Type EFI_MANAGED_NETWORK_COMPLETION_TOKEN is defined in "Related Definitions" below.
Return values
EFI_SUCCESSThe transmit completion token was cached.
EFI_NOT_STARTEDThis MNP child driver instance has not been configured.
EFI_INVALID_PARAMETEROne or more of the following conditions is TRUE: This is NULL. Token is NULL. Token.Event is NULL. Token.TxData is NULL. Token.TxData.DestinationAddress is not NULL and Token.TxData.HeaderLength is zero. Token.TxData.FragmentCount is zero. (Token.TxData.HeaderLength + Token.TxData.DataLength) is not equal to the sum of the Token.TxData.FragmentTable[].FragmentLength fields. One or more of the Token.TxData.FragmentTable[].FragmentLength fields is zero. One or more of the Token.TxData.FragmentTable[].FragmentBufferfields is NULL. Token.TxData.DataLength is greater than MTU.
EFI_ACCESS_DENIEDThe transmit completion token is already in the transmit queue.
EFI_OUT_OF_RESOURCESThe transmit data could not be queued due to a lack of system resources (usually memory).
EFI_DEVICE_ERRORAn unexpected system or network error occurred. The MNP child driver instance has been reset to startup defaults.
EFI_NOT_READYThe transmit request could not be queued because the transmit queue is full.

Definition at line 508 of file MnpMain.c.