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

Go to the source code of this file.

Functions

EFI_HANDLE MnpCreateVlanChild (IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle, IN UINT16 VlanId, OUT EFI_DEVICE_PATH_PROTOCOL **Devicepath OPTIONAL)
 
BOOLEAN MnpRemoveVlanTag (IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN OUT NET_BUF *Nbuf, OUT UINT16 *VlanId)
 
VOID MnpInsertVlanTag (IN MNP_SERVICE_DATA *MnpServiceData, IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData, OUT UINT16 *ProtocolType, IN OUT UINT8 **Packet, IN OUT UINT32 *Length)
 
EFI_STATUS MnpCheckVlanVariable (IN MNP_DEVICE_DATA *MnpDeviceData, IN VLAN_TCI *Buffer, IN UINTN NumberOfVlan, OUT UINTN *NewNumberOfVlan)
 
EFI_STATUS MnpGetVlanVariable (IN MNP_DEVICE_DATA *MnpDeviceData, OUT UINTN *NumberOfVlan, OUT VLAN_TCI **VlanVariable)
 
EFI_STATUS MnpSetVlanVariable (IN MNP_DEVICE_DATA *MnpDeviceData, IN UINTN NumberOfVlan, IN VLAN_TCI *VlanVariable)
 
EFI_STATUS EFIAPI VlanConfigSet (IN EFI_VLAN_CONFIG_PROTOCOL *This, IN UINT16 VlanId, IN UINT8 Priority)
 
EFI_STATUS EFIAPI VlanConfigFind (IN EFI_VLAN_CONFIG_PROTOCOL *This, IN UINT16 *VlanId OPTIONAL, OUT UINT16 *NumberOfVlan, OUT EFI_VLAN_FIND_DATA **Entries)
 
EFI_STATUS EFIAPI VlanConfigRemove (IN EFI_VLAN_CONFIG_PROTOCOL *This, IN UINT16 VlanId)
 

Variables

VLAN_DEVICE_PATH mVlanDevicePathTemplate
 
EFI_VLAN_CONFIG_PROTOCOL mVlanConfigProtocolTemplate
 

Detailed Description

VLAN Config Protocol implementation and VLAN packet process routine.

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

Definition in file MnpVlan.c.

Function Documentation

◆ MnpCheckVlanVariable()

EFI_STATUS MnpCheckVlanVariable ( IN MNP_DEVICE_DATA MnpDeviceData,
IN VLAN_TCI Buffer,
IN UINTN  NumberOfVlan,
OUT UINTN NewNumberOfVlan 
)

Check VLAN configuration variable and delete the duplicative content if has identical Vlan ID.

Parameters
[in]MnpDeviceDataPointer to the MNP device context data.
[in]BufferPointer to the buffer contains the array of VLAN_TCI.
[in]NumberOfVlanPointer to number of VLAN.
[out]NewNumberOfVlanPointer to number of unique VLAN.
Return values
EFI_SUCCESSThe VLAN variable is successfully checked.
EFI_OUT_OF_RESOURCESThere is not enough resource to set the configuration.

Definition at line 237 of file MnpVlan.c.

◆ MnpCreateVlanChild()

EFI_HANDLE MnpCreateVlanChild ( IN EFI_HANDLE  ImageHandle,
IN EFI_HANDLE  ControllerHandle,
IN UINT16  VlanId,
OUT EFI_DEVICE_PATH_PROTOCOL **Devicepath  OPTIONAL 
)

Create a child handle for the VLAN ID.

Parameters
[in]ImageHandleThe driver image handle.
[in]ControllerHandleHandle of device to bind driver to.
[in]VlanIdThe VLAN ID.
[out]DevicepathPointer to returned device path for child handle.
Returns
The handle of VLAN child or NULL if failed to create VLAN child.

Definition at line 42 of file MnpVlan.c.

◆ MnpGetVlanVariable()

EFI_STATUS MnpGetVlanVariable ( IN MNP_DEVICE_DATA MnpDeviceData,
OUT UINTN NumberOfVlan,
OUT VLAN_TCI **  VlanVariable 
)

Get VLAN configuration variable.

Parameters
[in]MnpDeviceDataPointer to the MNP device context data.
[out]NumberOfVlanPointer to number of VLAN to be returned.
[out]VlanVariablePointer to the buffer to return requested array of VLAN_TCI.
Return values
EFI_SUCCESSThe array of VLAN_TCI was returned in VlanVariable and number of VLAN was returned in NumberOfVlan.
EFI_NOT_FOUNDVLAN configuration variable not found.
EFI_OUT_OF_RESOURCESThere is not enough pool memory to store the configuration.

Definition at line 295 of file MnpVlan.c.

◆ MnpInsertVlanTag()

VOID MnpInsertVlanTag ( IN MNP_SERVICE_DATA MnpServiceData,
IN EFI_MANAGED_NETWORK_TRANSMIT_DATA TxData,
OUT UINT16 *  ProtocolType,
IN OUT UINT8 **  Packet,
IN OUT UINT32 *  Length 
)

Build the vlan packet to transmit from the TxData passed in.

Parameters
MnpServiceDataPointer to the mnp service context data.
TxDataPointer to the transmit data containing the information to build the packet.
ProtocolTypePointer to the Ethernet protocol type.
PacketPointer to record the address of the packet.
LengthPointer to a UINT32 variable used to record the packet's length.

Definition at line 177 of file MnpVlan.c.

◆ MnpRemoveVlanTag()

BOOLEAN MnpRemoveVlanTag ( IN OUT MNP_DEVICE_DATA MnpDeviceData,
IN OUT NET_BUF Nbuf,
OUT UINT16 *  VlanId 
)

Remove VLAN tag from a packet.

Parameters
[in,out]MnpDeviceDataPointer to the mnp device context data.
[in,out]NbufPointer to the NET_BUF to remove VLAN tag.
[out]VlanIdPointer to the returned VLAN ID.
Return values
TRUEVLAN tag is removed from this packet.
FALSEThere is no VLAN tag in this packet.

Definition at line 117 of file MnpVlan.c.

◆ MnpSetVlanVariable()

EFI_STATUS MnpSetVlanVariable ( IN MNP_DEVICE_DATA MnpDeviceData,
IN UINTN  NumberOfVlan,
IN VLAN_TCI VlanVariable 
)

Set VLAN configuration variable.

Parameters
[in]MnpDeviceDataPointer to the MNP device context data.
[in]NumberOfVlanNumber of VLAN in array VlanVariable.
[in]VlanVariablePointer to array of VLAN_TCI.
Return values
EFI_SUCCESSThe VLAN variable is successfully set.
EFI_OUT_OF_RESOURCESThere is not enough resource to set the configuration.

Definition at line 363 of file MnpVlan.c.

◆ VlanConfigFind()

EFI_STATUS EFIAPI VlanConfigFind ( IN EFI_VLAN_CONFIG_PROTOCOL This,
IN UINT16 *VlanId  OPTIONAL,
OUT UINT16 *  NumberOfVlan,
OUT EFI_VLAN_FIND_DATA **  Entries 
)

Find configuration information for specified VLAN or all configured VLANs.

The Find() function is used to find the configuration information for matching VLAN and allocate a buffer into which those entries are copied.

Parameters
[in]ThisPoints to the EFI_VLAN_CONFIG_PROTOCOL.
[in]VlanIdPointer to VLAN identifier. Set to NULL to find all configured VLANs.
[out]NumberOfVlanThe number of VLANs which is found by the specified criteria.
[out]EntriesThe buffer which receive the VLAN configuration.
Return values
EFI_SUCCESSThe VLAN is successfully found.
EFI_INVALID_PARAMETEROne or more of following conditions is TRUE:
  • This is NULL.
  • Specified VlanId is invalid.
EFI_NOT_FOUNDNo matching VLAN is found.

Definition at line 560 of file MnpVlan.c.

◆ VlanConfigRemove()

EFI_STATUS EFIAPI VlanConfigRemove ( IN EFI_VLAN_CONFIG_PROTOCOL This,
IN UINT16  VlanId 
)

Remove the configured VLAN device.

The Remove() function is used to remove the specified VLAN device. If the VlanId is out of the scope of (0-4094), EFI_INVALID_PARAMETER is returned. If specified VLAN hasn't been previously configured, EFI_NOT_FOUND is returned.

Parameters
[in]ThisPoints to the EFI_VLAN_CONFIG_PROTOCOL.
[in]VlanIdIdentifier (0-4094) of the VLAN to be removed.
Return values
EFI_SUCCESSThe VLAN is successfully removed.
EFI_INVALID_PARAMETEROne or more of following conditions is TRUE:
  • This is NULL.
  • VlanId is an invalid parameter.
EFI_NOT_FOUNDThe to-be-removed VLAN does not exist.

Definition at line 647 of file MnpVlan.c.

◆ VlanConfigSet()

EFI_STATUS EFIAPI VlanConfigSet ( IN EFI_VLAN_CONFIG_PROTOCOL This,
IN UINT16  VlanId,
IN UINT8  Priority 
)

Create a VLAN device or modify the configuration parameter of an already-configured VLAN.

The Set() function is used to create a new VLAN device or change the VLAN configuration parameters. If the VlanId hasn't been configured in the physical Ethernet device, a new VLAN device will be created. If a VLAN with this VlanId is already configured, then related configuration will be updated as the input parameters.

If VlanId is zero, the VLAN device will send and receive untagged frames. Otherwise, the VLAN device will send and receive VLAN-tagged frames containing the VlanId. If VlanId is out of scope of (0-4094), EFI_INVALID_PARAMETER is returned. If Priority is out of the scope of (0-7), then EFI_INVALID_PARAMETER is returned. If there is not enough system memory to perform the registration, then EFI_OUT_OF_RESOURCES is returned.

Parameters
[in]ThisPoints to the EFI_VLAN_CONFIG_PROTOCOL.
[in]VlanIdA unique identifier (1-4094) of the VLAN which is being created or modified, or zero (0).
[in]Priority3 bit priority in VLAN header. Priority 0 is default value. If VlanId is zero (0), Priority is ignored.
Return values
EFI_SUCCESSThe VLAN is successfully configured.
EFI_INVALID_PARAMETEROne or more of following conditions is TRUE:
  • This is NULL.
  • VlanId is an invalid VLAN Identifier.
  • Priority is invalid.
EFI_OUT_OF_RESOURCESThere is not enough system memory to perform the registration.

Definition at line 411 of file MnpVlan.c.

Variable Documentation

◆ mVlanConfigProtocolTemplate

EFI_VLAN_CONFIG_PROTOCOL mVlanConfigProtocolTemplate
Initial value:
= {
}
EFI_STATUS EFIAPI VlanConfigSet(IN EFI_VLAN_CONFIG_PROTOCOL *This, IN UINT16 VlanId, IN UINT8 Priority)
Definition: MnpVlan.c:411
EFI_STATUS EFIAPI VlanConfigFind(IN EFI_VLAN_CONFIG_PROTOCOL *This, IN UINT16 *VlanId OPTIONAL, OUT UINT16 *NumberOfVlan, OUT EFI_VLAN_FIND_DATA **Entries)
Definition: MnpVlan.c:560
EFI_STATUS EFIAPI VlanConfigRemove(IN EFI_VLAN_CONFIG_PROTOCOL *This, IN UINT16 VlanId)
Definition: MnpVlan.c:647

Definition at line 24 of file MnpVlan.c.

◆ mVlanDevicePathTemplate

VLAN_DEVICE_PATH mVlanDevicePathTemplate
Initial value:
= {
{
{
(UINT8)(sizeof (VLAN_DEVICE_PATH)),
(UINT8)((sizeof (VLAN_DEVICE_PATH)) >> 8)
}
},
0
}
#define MSG_VLAN_DP
Definition: DevicePath.h:964
#define MESSAGING_DEVICE_PATH
Definition: DevicePath.h:321

Definition at line 12 of file MnpVlan.c.