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

Go to the source code of this file.

Functions

EFI_STATUS MnpAddFreeNbuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN UINTN Count)
 
NET_BUFMnpAllocNbuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData)
 
VOID MnpFreeNbuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN OUT NET_BUF *Nbuf)
 
EFI_STATUS MnpAddFreeTxBuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN UINTN Count)
 
UINT8 * MnpAllocTxBuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData)
 
VOID MnpFreeTxBuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN OUT UINT8 *TxBuf)
 
EFI_STATUS MnpRecycleTxBuf (IN OUT MNP_DEVICE_DATA *MnpDeviceData)
 
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 MnpDestroyServiceData (IN OUT MNP_SERVICE_DATA *MnpServiceData)
 
EFI_STATUS EFIAPI MnpDestoryChildEntry (IN LIST_ENTRY *Entry, IN VOID *Context)
 
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)
 
EFI_STATUS MnpStartSnp (IN EFI_SIMPLE_NETWORK_PROTOCOL *Snp)
 
EFI_STATUS MnpStopSnp (IN MNP_DEVICE_DATA *MnpDeviceData)
 
EFI_STATUS MnpStart (IN OUT MNP_SERVICE_DATA *MnpServiceData, IN BOOLEAN IsConfigUpdate, IN BOOLEAN EnableSystemPoll)
 
EFI_STATUS MnpStop (IN OUT MNP_SERVICE_DATA *MnpServiceData)
 
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 MnpConfigReceiveFilters (IN MNP_DEVICE_DATA *MnpDeviceData)
 
EFI_STATUS MnpGroupOpAddCtrlBlk (IN OUT MNP_INSTANCE_DATA *Instance, IN OUT MNP_GROUP_CONTROL_BLOCK *CtrlBlk, IN OUT MNP_GROUP_ADDRESS *GroupAddress OPTIONAL, IN EFI_MAC_ADDRESS *MacAddress, IN UINT32 HwAddressSize)
 
BOOLEAN MnpGroupOpDelCtrlBlk (IN MNP_INSTANCE_DATA *Instance, IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk)
 
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)
 

Variables

EFI_SERVICE_BINDING_PROTOCOL mMnpServiceBindingProtocol
 
EFI_MANAGED_NETWORK_PROTOCOL mMnpProtocolTemplate
 
EFI_MANAGED_NETWORK_CONFIG_DATA mMnpDefaultConfigData
 

Detailed Description

Implementation of Managed Network Protocol private services.

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

Definition in file MnpConfig.c.

Function Documentation

◆ MnpAddFreeNbuf()

EFI_STATUS MnpAddFreeNbuf ( IN OUT MNP_DEVICE_DATA MnpDeviceData,
IN UINTN  Count 
)

Add Count of net buffers to MnpDeviceData->FreeNbufQue. The length of the net buffer is specified by MnpDeviceData->BufferLength.

Parameters
[in,out]MnpDeviceDataPointer to the MNP_DEVICE_DATA.
[in]CountNumber of NET_BUFFERs to add.
Return values
EFI_SUCCESSThe specified amount of NET_BUFs are allocated and added to MnpDeviceData->FreeNbufQue.
EFI_OUT_OF_RESOURCESFailed to allocate a NET_BUF structure.

Definition at line 54 of file MnpConfig.c.

◆ MnpAddFreeTxBuf()

EFI_STATUS MnpAddFreeTxBuf ( IN OUT MNP_DEVICE_DATA MnpDeviceData,
IN UINTN  Count 
)

Add Count of TX buffers to MnpDeviceData->AllTxBufList and MnpDeviceData->FreeTxBufList. The length of the buffer is specified by MnpDeviceData->BufferLength.

Parameters
[in,out]MnpDeviceDataPointer to the MNP_DEVICE_DATA.
[in]CountNumber of TX buffers to add.
Return values
EFI_SUCCESSThe specified amount of TX buffers are allocated.
EFI_OUT_OF_RESOURCESFailed to allocate a TX buffer.

Definition at line 215 of file MnpConfig.c.

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

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

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

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

◆ MnpDestoryChildEntry()

EFI_STATUS EFIAPI MnpDestoryChildEntry ( IN LIST_ENTRY Entry,
IN VOID *  Context 
)

Callback function which provided by user to remove one node in NetDestroyLinkList process.

Parameters
[in]EntryThe entry to be removed.
[in]ContextPointer to the callback context corresponds to the Context in NetDestroyLinkList.
Return values
EFI_SUCCESSThe entry has been removed successfully.
OthersFail to remove the entry.

Definition at line 880 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.

◆ MnpFreeTxBuf()

VOID MnpFreeTxBuf ( IN OUT MNP_DEVICE_DATA MnpDeviceData,
IN OUT UINT8 *  TxBuf 
)

Try to reclaim the TX buffer into the buffer pool.

Parameters
[in,out]MnpDeviceDataPointer to the mnp device context data.
[in,out]TxBufPointer to the TX buffer to free.

Definition at line 334 of file MnpConfig.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.

◆ MnpGroupOpAddCtrlBlk()

EFI_STATUS MnpGroupOpAddCtrlBlk ( IN OUT MNP_INSTANCE_DATA Instance,
IN OUT MNP_GROUP_CONTROL_BLOCK CtrlBlk,
IN OUT MNP_GROUP_ADDRESS *GroupAddress  OPTIONAL,
IN EFI_MAC_ADDRESS MacAddress,
IN UINT32  HwAddressSize 
)

Add a group address control block which controls the MacAddress for this instance.

Parameters
[in,out]InstancePointer to the mnp instance context data.
[in,out]CtrlBlkPointer to the group address control block.
[in,out]GroupAddressPointer to the group address.
[in]MacAddressPointer to the mac address.
[in]HwAddressSizeThe hardware address size.
Return values
EFI_SUCCESSThe group address control block is added.
EFI_OUT_OF_RESOURCESFailed due to lack of memory resources.

Definition at line 1697 of file MnpConfig.c.

◆ MnpGroupOpDelCtrlBlk()

BOOLEAN MnpGroupOpDelCtrlBlk ( IN MNP_INSTANCE_DATA Instance,
IN MNP_GROUP_CONTROL_BLOCK CtrlBlk 
)

Delete a group control block from the instance. If the controlled group address's reference count reaches zero, the group address is removed too.

Parameters
[in]InstancePointer to the instance context data.
[in]CtrlBlkPointer to the group control block to delete.
Returns
The group address controlled by the control block is no longer used or not.

Definition at line 1759 of file MnpConfig.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.

◆ 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 recyclethe transmitted buffer address.
OthersFailed to recyclethe transmitted buffer address.

Definition at line 381 of file MnpConfig.c.

◆ MnpStart()

EFI_STATUS MnpStart ( IN OUT MNP_SERVICE_DATA MnpServiceData,
IN BOOLEAN  IsConfigUpdate,
IN BOOLEAN  EnableSystemPoll 
)

Start the managed network, this function is called when one instance is configured or reconfigured.

Parameters
[in,out]MnpServiceDataPointer to the mnp service context data.
[in]IsConfigUpdateThe instance is reconfigured or it's the first time the instanced is configured.
[in]EnableSystemPollEnable the system polling or not.
Return values
EFI_SUCCESSThe managed network is started and some configuration is updated.
OthersOther errors as indicated.

Definition at line 1191 of file MnpConfig.c.

◆ MnpStartSnp()

EFI_STATUS MnpStartSnp ( IN EFI_SIMPLE_NETWORK_PROTOCOL Snp)

Start and initialize the simple network.

Parameters
[in]SnpPointer to the simple network protocol.
Return values
EFI_SUCCESSThe simple network protocol is started.
OthersOther errors as indicated.

Definition at line 1111 of file MnpConfig.c.

◆ MnpStop()

EFI_STATUS MnpStop ( IN OUT MNP_SERVICE_DATA MnpServiceData)

Stop the managed network.

Parameters
[in,out]MnpServiceDataPointer to the mnp service context data.
Return values
EFI_SUCCESSThe managed network is stopped.
OthersOther errors as indicated.

Definition at line 1297 of file MnpConfig.c.

◆ MnpStopSnp()

EFI_STATUS MnpStopSnp ( IN MNP_DEVICE_DATA MnpDeviceData)

Stop the simple network.

Parameters
[in]MnpDeviceDataPointer to the MNP_DEVICE_DATA.
Return values
EFI_SUCCESSThe simple network is stopped.
OthersOther errors as indicated.

Definition at line 1144 of file MnpConfig.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.

Variable Documentation

◆ mMnpDefaultConfigData

EFI_MANAGED_NETWORK_CONFIG_DATA mMnpDefaultConfigData
Initial value:
= {
10000000,
10000000,
0,
}
#define FALSE
Definition: Base.h:307

Definition at line 28 of file MnpConfig.c.

◆ mMnpProtocolTemplate

EFI_MANAGED_NETWORK_PROTOCOL mMnpProtocolTemplate
Initial value:
= {
}
EFI_STATUS EFIAPI MnpMcastIpToMac(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN BOOLEAN Ipv6Flag, IN EFI_IP_ADDRESS *IpAddress, OUT EFI_MAC_ADDRESS *MacAddress)
Definition: MnpMain.c:217
EFI_STATUS EFIAPI MnpTransmit(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
Definition: MnpMain.c:508
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)
Definition: MnpMain.c:38
EFI_STATUS EFIAPI MnpConfigure(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL)
Definition: MnpMain.c:144
EFI_STATUS EFIAPI MnpReceive(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
Definition: MnpMain.c:600
EFI_STATUS EFIAPI MnpCancel(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL)
Definition: MnpMain.c:683
EFI_STATUS EFIAPI MnpPoll(IN EFI_MANAGED_NETWORK_PROTOCOL *This)
Definition: MnpMain.c:752
EFI_STATUS EFIAPI MnpGroups(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_MAC_ADDRESS *MacAddress OPTIONAL)
Definition: MnpMain.c:343

Definition at line 17 of file MnpConfig.c.

◆ mMnpServiceBindingProtocol

EFI_SERVICE_BINDING_PROTOCOL mMnpServiceBindingProtocol
Initial value:
= {
}
EFI_STATUS EFIAPI MnpServiceBindingDestroyChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE ChildHandle)
Definition: MnpDriver.c:546
EFI_STATUS EFIAPI MnpServiceBindingCreateChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN OUT EFI_HANDLE *ChildHandle)
Definition: MnpDriver.c:430

Definition at line 12 of file MnpConfig.c.