Home | History | Annotate | Download | only in MnpDxe
      1 /** @file
      2   Header file to be included by MnpVlan.c.
      3 
      4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
      5 This program and the accompanying materials
      6 are licensed and made available under the terms and conditions
      7 of the BSD License which accompanies this distribution.  The full
      8 text of the license may be found at<BR>
      9 http://opensource.org/licenses/bsd-license.php
     10 
     11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14 **/
     15 
     16 #ifndef __MNP_VLAN_H__
     17 #define __MNP_VLAN_H__
     18 
     19 #include "MnpDriver.h"
     20 
     21 extern EFI_VLAN_CONFIG_PROTOCOL mVlanConfigProtocolTemplate;
     22 
     23 
     24 /**
     25   Create a child handle for the VLAN ID.
     26 
     27   @param[in]       ImageHandle        The driver image handle.
     28   @param[in]       ControllerHandle   Handle of device to bind driver to.
     29   @param[in]       VlanId             The VLAN ID.
     30   @param[out]      Devicepath         Pointer to returned device path for child handle.
     31 
     32   @return The handle of VLAN child or NULL if failed to create VLAN child.
     33 
     34 **/
     35 EFI_HANDLE
     36 MnpCreateVlanChild (
     37   IN     EFI_HANDLE                  ImageHandle,
     38   IN     EFI_HANDLE                  ControllerHandle,
     39   IN     UINT16                      VlanId,
     40      OUT EFI_DEVICE_PATH_PROTOCOL    **Devicepath OPTIONAL
     41   );
     42 
     43 /**
     44   Remove VLAN tag of a packet.
     45 
     46   @param[in, out]  MnpDeviceData      Pointer to the mnp device context data.
     47   @param[in, out]  Nbuf               Pointer to the NET_BUF to remove VLAN tag.
     48   @param[out]      VlanId             Pointer to the returned VLAN ID.
     49 
     50   @retval TRUE             VLAN tag is removed from this packet.
     51   @retval FALSE            There is no VLAN tag in this packet.
     52 
     53 **/
     54 BOOLEAN
     55 MnpRemoveVlanTag (
     56   IN OUT MNP_DEVICE_DATA   *MnpDeviceData,
     57   IN OUT NET_BUF           *Nbuf,
     58      OUT UINT16            *VlanId
     59   );
     60 
     61 /**
     62   Build the vlan packet to transmit from the TxData passed in.
     63 
     64   @param  MnpServiceData         Pointer to the mnp service context data.
     65   @param  TxData                 Pointer to the transmit data containing the
     66                                  information to build the packet.
     67   @param  ProtocolType           Pointer to the Ethernet protocol type.
     68   @param  Packet                 Pointer to record the address of the packet.
     69   @param  Length                 Pointer to a UINT32 variable used to record the
     70                                  packet's length.
     71 
     72 **/
     73 VOID
     74 MnpInsertVlanTag (
     75   IN     MNP_SERVICE_DATA                    *MnpServiceData,
     76   IN     EFI_MANAGED_NETWORK_TRANSMIT_DATA   *TxData,
     77      OUT UINT16                              *ProtocolType,
     78   IN OUT UINT8                               **Packet,
     79   IN OUT UINT32                              *Length
     80   );
     81 
     82 /**
     83   Get VLAN configuration variable.
     84 
     85   @param[in]       MnpDeviceData      Pointer to the MNP device context data.
     86   @param[out]      NumberOfVlan       Pointer to number of VLAN to be returned.
     87   @param[out]      VlanVariable       Pointer to the buffer to return requested
     88                                       array of VLAN_TCI.
     89 
     90   @retval EFI_SUCCESS            The array of VLAN_TCI was returned in VlanVariable
     91                                  and number of VLAN was returned in NumberOfVlan.
     92   @retval EFI_NOT_FOUND          VLAN configuration variable not found.
     93   @retval EFI_OUT_OF_RESOURCES   There is not enough pool memory to store the configuration.
     94 
     95 **/
     96 EFI_STATUS
     97 MnpGetVlanVariable (
     98   IN     MNP_DEVICE_DATA   *MnpDeviceData,
     99      OUT UINTN             *NumberOfVlan,
    100      OUT VLAN_TCI          **VlanVariable
    101   );
    102 
    103 /**
    104   Set VLAN configuration variable.
    105 
    106   @param[in] MnpDeviceData       Pointer to the MNP device context data.
    107   @param[in] NumberOfVlan        Number of VLAN in array VlanVariable.
    108   @param[in] VlanVariable        Pointer to array of VLAN_TCI.
    109 
    110   @retval EFI_SUCCESS            The VLAN variable is successfully set.
    111   @retval EFI_OUT_OF_RESOURCES   There is not enough resource to set the configuration.
    112 
    113 **/
    114 EFI_STATUS
    115 MnpSetVlanVariable (
    116   IN MNP_DEVICE_DATA             *MnpDeviceData,
    117   IN UINTN                       NumberOfVlan,
    118   IN VLAN_TCI                    *VlanVariable
    119   );
    120 
    121 /**
    122   Create a VLAN device or modify the configuration parameter of an
    123   already-configured VLAN.
    124 
    125   The Set() function is used to create a new VLAN device or change the VLAN
    126   configuration parameters. If the VlanId hasn't been configured in the
    127   physical Ethernet device, a new VLAN device will be created. If a VLAN with
    128   this VlanId is already configured, then related configuration will be updated
    129   as the input parameters.
    130 
    131   If VlanId is zero, the VLAN device will send and receive untagged frames.
    132   Otherwise, the VLAN device will send and receive VLAN-tagged frames containing the VlanId.
    133   If VlanId is out of scope of (0-4094), EFI_INVALID_PARAMETER is returned.
    134   If Priority is out of the scope of (0-7), then EFI_INVALID_PARAMETER is returned.
    135   If there is not enough system memory to perform the registration, then
    136   EFI_OUT_OF_RESOURCES is returned.
    137 
    138   @param[in] This                Points to the EFI_VLAN_CONFIG_PROTOCOL.
    139   @param[in] VlanId              A unique identifier (1-4094) of the VLAN which is being created
    140                                  or modified, or zero (0).
    141   @param[in] Priority            3 bit priority in VLAN header. Priority 0 is default value. If
    142                                  VlanId is zero (0), Priority is ignored.
    143 
    144   @retval EFI_SUCCESS            The VLAN is successfully configured.
    145   @retval EFI_INVALID_PARAMETER  One or more of following conditions is TRUE:
    146                                  - This is NULL.
    147                                  - VlanId is an invalid VLAN Identifier.
    148                                  - Priority is invalid.
    149   @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to perform the registration.
    150 
    151 **/
    152 EFI_STATUS
    153 EFIAPI
    154 VlanConfigSet (
    155   IN EFI_VLAN_CONFIG_PROTOCOL    *This,
    156   IN UINT16                      VlanId,
    157   IN UINT8                       Priority
    158   );
    159 
    160 /**
    161   Find configuration information for specified VLAN or all configured VLANs.
    162 
    163   The Find() function is used to find the configuration information for matching
    164   VLAN and allocate a buffer into which those entries are copied.
    165 
    166   @param[in]  This               Points to the EFI_VLAN_CONFIG_PROTOCOL.
    167   @param[in]  VlanId             Pointer to VLAN identifier. Set to NULL to find all
    168                                  configured VLANs.
    169   @param[out] NumberOfVlan       The number of VLANs which is found by the specified criteria.
    170   @param[out] Entries            The buffer which receive the VLAN configuration.
    171 
    172   @retval EFI_SUCCESS            The VLAN is successfully found.
    173   @retval EFI_INVALID_PARAMETER  One or more of following conditions is TRUE:
    174                                  - This is NULL.
    175                                  - Specified VlanId is invalid.
    176   @retval EFI_NOT_FOUND          No matching VLAN is found.
    177 
    178 **/
    179 EFI_STATUS
    180 EFIAPI
    181 VlanConfigFind (
    182   IN     EFI_VLAN_CONFIG_PROTOCOL    *This,
    183   IN     UINT16                      *VlanId OPTIONAL,
    184      OUT UINT16                      *NumberOfVlan,
    185      OUT EFI_VLAN_FIND_DATA          **Entries
    186   );
    187 
    188 /**
    189   Remove the configured VLAN device.
    190 
    191   The Remove() function is used to remove the specified VLAN device.
    192   If the VlanId is out of the scope of (0-4094), EFI_INVALID_PARAMETER is returned.
    193   If specified VLAN hasn't been previously configured, EFI_NOT_FOUND is returned.
    194 
    195   @param[in] This                Points to the EFI_VLAN_CONFIG_PROTOCOL.
    196   @param[in] VlanId              Identifier (0-4094) of the VLAN to be removed.
    197 
    198   @retval EFI_SUCCESS            The VLAN is successfully removed.
    199   @retval EFI_INVALID_PARAMETER  One or more of following conditions is TRUE:
    200                                  - This is NULL.
    201                                  - VlanId  is an invalid parameter.
    202   @retval EFI_NOT_FOUND          The to-be-removed VLAN does not exist.
    203 
    204 **/
    205 EFI_STATUS
    206 EFIAPI
    207 VlanConfigRemove (
    208   IN EFI_VLAN_CONFIG_PROTOCOL    *This,
    209   IN UINT16                      VlanId
    210   );
    211 
    212 #endif
    213