TianoCore EDK2 master
Loading...
Searching...
No Matches
MnpIo.c File Reference
#include "MnpImpl.h"
#include "MnpVlan.h"

Go to the source code of this file.

Functions

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 MnpDeliverPacket (IN MNP_SERVICE_DATA *MnpServiceData)
 
VOID EFIAPI MnpRecycleRxData (IN EFI_EVENT Event, IN VOID *Context)
 
VOID MnpQueueRcvdPacket (IN OUT MNP_INSTANCE_DATA *Instance, IN OUT MNP_RXDATA_WRAP *RxDataWrap)
 
BOOLEAN MnpMatchPacket (IN MNP_INSTANCE_DATA *Instance, IN EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData, IN MNP_GROUP_ADDRESS *GroupAddress OPTIONAL, IN UINT8 PktAttr)
 
VOID MnpAnalysePacket (IN MNP_SERVICE_DATA *MnpServiceData, IN NET_BUF *Nbuf, IN OUT EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData, OUT MNP_GROUP_ADDRESS **GroupAddress, OUT UINT8 *PktAttr)
 
MNP_RXDATA_WRAPMnpWrapRxData (IN MNP_INSTANCE_DATA *Instance, IN EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData)
 
VOID MnpEnqueuePacket (IN MNP_SERVICE_DATA *MnpServiceData, IN NET_BUF *Nbuf)
 
EFI_STATUS MnpReceivePacket (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)
 

Detailed Description

Implementation of Managed Network Protocol I/O functions.

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

Definition in file MnpIo.c.

Function Documentation

◆ MnpAnalysePacket()

VOID MnpAnalysePacket ( IN MNP_SERVICE_DATA MnpServiceData,
IN NET_BUF Nbuf,
IN OUT EFI_MANAGED_NETWORK_RECEIVE_DATA RxData,
OUT MNP_GROUP_ADDRESS **  GroupAddress,
OUT UINT8 *  PktAttr 
)

Analyse the received packets.

Parameters
[in]MnpServiceDataPointer to the mnp service context data.
[in]NbufPointer to the net buffer holding the received packet.
[in,out]RxDataPointer to the buffer used to save the analysed result in EFI_MANAGED_NETWORK_RECEIVE_DATA.
[out]GroupAddressPointer to pointer to a MNP_GROUP_ADDRESS used to pass out the address of the multicast address the received packet destinated to.
[out]PktAttrPointer to the buffer used to save the analysed packet attribute.

Definition at line 604 of file MnpIo.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.

◆ 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.

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.

◆ MnpDeliverPacket()

VOID MnpDeliverPacket ( IN MNP_SERVICE_DATA MnpServiceData)

Deliver the received packet for the instances belonging to the MnpServiceData.

Parameters
[in]MnpServiceDataPointer to the mnp service context data.

Definition at line 394 of file MnpIo.c.

◆ MnpEnqueuePacket()

VOID MnpEnqueuePacket ( IN MNP_SERVICE_DATA MnpServiceData,
IN NET_BUF Nbuf 
)

Enqueue the received the packets to the instances belonging to the MnpServiceData.

Parameters
[in]MnpServiceDataPointer to the mnp service context data.
[in]NbufPointer to the net buffer representing the received packet.

Definition at line 754 of file MnpIo.c.

◆ 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.

◆ MnpMatchPacket()

BOOLEAN MnpMatchPacket ( IN MNP_INSTANCE_DATA Instance,
IN EFI_MANAGED_NETWORK_RECEIVE_DATA RxData,
IN MNP_GROUP_ADDRESS *GroupAddress  OPTIONAL,
IN UINT8  PktAttr 
)

Match the received packet with the instance receive filters.

Parameters
[in]InstancePointer to the mnp instance context data.
[in]RxDataPointer to the EFI_MANAGED_NETWORK_RECEIVE_DATA.
[in]GroupAddressPointer to the GroupAddress, the GroupAddress is non-NULL and it contains the destination multicast mac address of the received packet if the packet destinated to a multicast mac address.
[in]PktAttrThe received packets attribute.
Returns
The received packet matches the instance's receive filters or not.

Definition at line 528 of file MnpIo.c.

◆ MnpQueueRcvdPacket()

VOID MnpQueueRcvdPacket ( IN OUT MNP_INSTANCE_DATA Instance,
IN OUT MNP_RXDATA_WRAP RxDataWrap 
)

Queue the received packet into instance's receive queue.

Parameters
[in,out]InstancePointer to the mnp instance context data.
[in,out]RxDataWrapPointer to the Wrap structure containing the received data and other information.

Definition at line 469 of file MnpIo.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.

◆ 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.

◆ MnpWrapRxData()

MNP_RXDATA_WRAP * MnpWrapRxData ( IN MNP_INSTANCE_DATA Instance,
IN EFI_MANAGED_NETWORK_RECEIVE_DATA RxData 
)

Wrap the RxData.

Parameters
[in]InstancePointer to the mnp instance context data.
[in]RxDataPointer to the receive data to wrap.
Returns
Pointer to a MNP_RXDATA_WRAP which wraps the RxData.

Definition at line 700 of file MnpIo.c.