]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.h
Add VLAN support.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / MnpDxe / MnpVlan.h
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.h b/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.h
new file mode 100644 (file)
index 0000000..abd6727
--- /dev/null
@@ -0,0 +1,212 @@
+/** @file\r
+  Header file to be included by MnpVlan.c.\r
+\r
+Copyright (c) 2009, Intel Corporation<BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions\r
+of the BSD License which accompanies this distribution.  The full\r
+text of the license may be found at<BR>\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __MNP_VLAN_H__\r
+#define __MNP_VLAN_H__\r
+\r
+#include "MnpDriver.h"\r
+\r
+extern EFI_VLAN_CONFIG_PROTOCOL mVlanConfigProtocolTemplate;\r
+\r
+\r
+/**\r
+  Create a child handle for the VLAN ID.\r
+\r
+  @param[in]       ImageHandle        The driver image handle.\r
+  @param[in]       ControllerHandle   Handle of device to bind driver to.\r
+  @param[in]       VlanId             The VLAN ID.\r
+  @param[out]      Devicepath         Pointer to returned device path for child handle.\r
+\r
+  @return The handle of VLAN child or NULL if failed to create VLAN child.\r
+\r
+**/\r
+EFI_HANDLE\r
+MnpCreateVlanChild (\r
+  IN     EFI_HANDLE                  ImageHandle,\r
+  IN     EFI_HANDLE                  ControllerHandle,\r
+  IN     UINT16                      VlanId,\r
+     OUT EFI_DEVICE_PATH_PROTOCOL    **Devicepath OPTIONAL\r
+  );\r
+\r
+/**\r
+  Remove VLAN tag of a packet.\r
+\r
+  @param[in, out]  MnpDeviceData      Pointer to the mnp device context data.\r
+  @param[in, out]  Nbuf               Pointer to the NET_BUF to remove VLAN tag.\r
+  @param[out]      VlanId             Pointer to the returned VLAN ID.\r
+\r
+  @retval TRUE             VLAN tag is removed from this packet.\r
+  @retval FALSE            There is no VLAN tag in this packet.\r
+\r
+**/\r
+BOOLEAN\r
+MnpRemoveVlanTag (\r
+  IN OUT MNP_DEVICE_DATA   *MnpDeviceData,\r
+  IN OUT NET_BUF           *Nbuf,\r
+     OUT UINT16            *VlanId\r
+  );\r
+\r
+/**\r
+  Build the packet to transmit from the TxData passed in.\r
+\r
+  @param  MnpServiceData         Pointer to the mnp service context data.\r
+  @param  TxData                 Pointer to the transmit data containing the\r
+                                 information to build the packet.\r
+  @param  ProtocolType           Pointer to the Ethernet protocol type.\r
+  @param  Packet                 Pointer to record the address of the packet.\r
+  @param  Length                 Pointer to a UINT32 variable used to record the\r
+                                 packet's length.\r
+\r
+**/\r
+VOID\r
+MnpInsertVlanTag (\r
+  IN     MNP_SERVICE_DATA                    *MnpServiceData,\r
+  IN     EFI_MANAGED_NETWORK_TRANSMIT_DATA   *TxData,\r
+     OUT UINT16                              *ProtocolType,\r
+  IN OUT UINT8                               **Packet,\r
+  IN OUT UINT32                              *Length\r
+  );\r
+\r
+/**\r
+  Get VLAN configuration variable.\r
+\r
+  @param[in]       MnpDeviceData      Pointer to the MNP device context data.\r
+  @param[out]      NumberOfVlan       Pointer to number of VLAN to be returned.\r
+  @param[out]      VlanVariable       Pointer to the buffer to return requested\r
+                                      array of VLAN_TCI.\r
+\r
+  @retval EFI_SUCCESS            The array of VLAN_TCI was returned in VlanVariable\r
+                                 and number of VLAN was returned in NumberOfVlan.\r
+  @retval EFI_NOT_FOUND          VLAN configuration variable not found.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough pool memory to store the configuration.\r
+\r
+**/\r
+EFI_STATUS\r
+MnpGetVlanVariable (\r
+  IN     MNP_DEVICE_DATA   *MnpDeviceData,\r
+     OUT UINTN             *NumberOfVlan,\r
+     OUT VLAN_TCI          **VlanVariable\r
+  );\r
+\r
+/**\r
+  Set VLAN configuration variable.\r
+\r
+  @param[in] MnpDeviceData       Pointer to the MNP device context data.\r
+  @param[in] NumberOfVlan        Number of VLAN in array VlanVariable.\r
+  @param[in] VlanVariable        Pointer to array of VLAN_TCI.\r
+\r
+  @retval EFI_SUCCESS            The VLAN variable is successfully set.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough resource to set the configuration.\r
+\r
+**/\r
+EFI_STATUS\r
+MnpSetVlanVariable (\r
+  IN MNP_DEVICE_DATA             *MnpDeviceData,\r
+  IN UINTN                       NumberOfVlan,\r
+  IN VLAN_TCI                    *VlanVariable\r
+  );\r
+\r
+/**\r
+  Create a VLAN device or modify the configuration parameter of an\r
+  already-configured VLAN.\r
+\r
+  The Set() function is used to create a new VLAN device or change the VLAN\r
+  configuration parameters. If the VlanId hasn't been configured in the\r
+  physical Ethernet device, a new VLAN device will be created. If a VLAN with\r
+  this VlanId is already configured, then related configuration will be updated\r
+  as the input parameters.\r
+\r
+  If VlanId is zero, the VLAN device will send and receive untagged frames.\r
+  Otherwise, the VLAN device will send and receive VLAN-tagged frames containing the VlanId.\r
+  If VlanId is out of scope of (0-4094), EFI_INVALID_PARAMETER is returned.\r
+  If Priority is out of the scope of (0-7), then EFI_INVALID_PARAMETER is returned.\r
+  If there is not enough system memory to perform the registration, then\r
+  EFI_OUT_OF_RESOURCES is returned.\r
+\r
+  @param[in] This                Points to the EFI_VLAN_CONFIG_PROTOCOL.\r
+  @param[in] VlanId              A unique identifier (1-4094) of the VLAN which is being created\r
+                                 or modified, or zero (0).\r
+  @param[in] Priority            3 bit priority in VLAN header. Priority 0 is default value. If\r
+                                 VlanId is zero (0), Priority is ignored.\r
+\r
+  @retval EFI_SUCCESS            The VLAN is successfully configured.\r
+  @retval EFI_INVALID_PARAMETER  One or more of following conditions is TRUE:\r
+                                 - This is NULL.\r
+                                 - VlanId is an invalid VLAN Identifier.\r
+                                 - Priority is invalid.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to perform the registration.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VlanConfigSet (\r
+  IN EFI_VLAN_CONFIG_PROTOCOL    *This,\r
+  IN UINT16                      VlanId,\r
+  IN UINT8                       Priority\r
+  );\r
+\r
+/**\r
+  Find configuration information for specified VLAN or all configured VLANs.\r
+\r
+  The Find() function is used to find the configuration information for matching\r
+  VLAN and allocate a buffer into which those entries are copied.\r
+\r
+  @param[in]  This               Points to the EFI_VLAN_CONFIG_PROTOCOL.\r
+  @param[in]  VlanId             Pointer to VLAN identifier. Set to NULL to find all\r
+                                 configured VLANs.\r
+  @param[out] NumberOfVlan       The number of VLANs which is found by the specified criteria.\r
+  @param[out] Entries            The buffer which receive the VLAN configuration.\r
+\r
+  @retval EFI_SUCCESS            The VLAN is successfully found.\r
+  @retval EFI_INVALID_PARAMETER  One or more of following conditions is TRUE:\r
+                                 - This is NULL.\r
+                                 - Specified VlanId is invalid.\r
+  @retval EFI_NOT_FOUND          No matching VLAN is found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VlanConfigFind (\r
+  IN     EFI_VLAN_CONFIG_PROTOCOL    *This,\r
+  IN     UINT16                      *VlanId OPTIONAL,\r
+     OUT UINT16                      *NumberOfVlan,\r
+     OUT EFI_VLAN_FIND_DATA          **Entries\r
+  );\r
+\r
+/**\r
+  Remove the configured VLAN device.\r
+\r
+  The Remove() function is used to remove the specified VLAN device.\r
+  If the VlanId is out of the scope of (0-4094), EFI_INVALID_PARAMETER is returned.\r
+  If specified VLAN hasn't been previously configured, EFI_NOT_FOUND is returned.\r
+\r
+  @param[in] This                Points to the EFI_VLAN_CONFIG_PROTOCOL.\r
+  @param[in] VlanId              Identifier (0-4094) of the VLAN to be removed.\r
+\r
+  @retval EFI_SUCCESS            The VLAN is successfully removed.\r
+  @retval EFI_INVALID_PARAMETER  One or more of following conditions is TRUE:\r
+                                 - This is NULL.\r
+                                 - VlanId  is an invalid parameter.\r
+  @retval EFI_NOT_FOUND          The to-be-removed VLAN does not exist.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VlanConfigRemove (\r
+  IN EFI_VLAN_CONFIG_PROTOCOL    *This,\r
+  IN UINT16                      VlanId\r
+  );\r
+\r
+#endif\r