Subrata Banik | 20fe24b | 2021-12-09 02:46:38 +0530 | [diff] [blame] | 1 | /** @file |
| 2 | EFI VLAN Config protocol is to provide manageability interface for VLAN configuration. |
| 3 | |
| 4 | Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> |
| 5 | SPDX-License-Identifier: BSD-2-Clause-Patent |
| 6 | |
| 7 | @par Revision Reference: |
| 8 | This Protocol is introduced in UEFI Specification 2.2 |
| 9 | |
| 10 | **/ |
| 11 | |
| 12 | #ifndef __EFI_VLANCONFIG_PROTOCOL_H__ |
| 13 | #define __EFI_VLANCONFIG_PROTOCOL_H__ |
| 14 | |
| 15 | |
| 16 | #define EFI_VLAN_CONFIG_PROTOCOL_GUID \ |
| 17 | { \ |
| 18 | 0x9e23d768, 0xd2f3, 0x4366, {0x9f, 0xc3, 0x3a, 0x7a, 0xba, 0x86, 0x43, 0x74 } \ |
| 19 | } |
| 20 | |
| 21 | typedef struct _EFI_VLAN_CONFIG_PROTOCOL EFI_VLAN_CONFIG_PROTOCOL; |
| 22 | |
| 23 | |
| 24 | /// |
| 25 | /// EFI_VLAN_FIND_DATA |
| 26 | /// |
| 27 | typedef struct { |
| 28 | UINT16 VlanId; ///< Vlan Identifier. |
| 29 | UINT8 Priority; ///< Priority of this VLAN. |
| 30 | } EFI_VLAN_FIND_DATA; |
| 31 | |
| 32 | |
| 33 | /** |
| 34 | Create a VLAN device or modify the configuration parameter of an |
| 35 | already-configured VLAN. |
| 36 | |
| 37 | The Set() function is used to create a new VLAN device or change the VLAN |
| 38 | configuration parameters. If the VlanId hasn't been configured in the |
| 39 | physical Ethernet device, a new VLAN device will be created. If a VLAN with |
| 40 | this VlanId is already configured, then related configuration will be updated |
| 41 | as the input parameters. |
| 42 | |
| 43 | If VlanId is zero, the VLAN device will send and receive untagged frames. |
| 44 | Otherwise, the VLAN device will send and receive VLAN-tagged frames containing the VlanId. |
| 45 | If VlanId is out of scope of (0-4094), EFI_INVALID_PARAMETER is returned. |
| 46 | If Priority is out of the scope of (0-7), then EFI_INVALID_PARAMETER is returned. |
| 47 | If there is not enough system memory to perform the registration, then |
| 48 | EFI_OUT_OF_RESOURCES is returned. |
| 49 | |
| 50 | @param[in] This Points to the EFI_VLAN_CONFIG_PROTOCOL. |
| 51 | @param[in] VlanId A unique identifier (1-4094) of the VLAN which is being created |
| 52 | or modified, or zero (0). |
| 53 | @param[in] Priority 3 bit priority in VLAN header. Priority 0 is default value. If |
| 54 | VlanId is zero (0), Priority is ignored. |
| 55 | |
| 56 | @retval EFI_SUCCESS The VLAN is successfully configured. |
| 57 | @retval EFI_INVALID_PARAMETER One or more of following conditions is TRUE: |
| 58 | - This is NULL. |
| 59 | - VlanId is an invalid VLAN Identifier. |
| 60 | - Priority is invalid. |
| 61 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to perform the registration. |
| 62 | |
| 63 | **/ |
| 64 | typedef |
| 65 | EFI_STATUS |
| 66 | (EFIAPI *EFI_VLAN_CONFIG_SET)( |
| 67 | IN EFI_VLAN_CONFIG_PROTOCOL *This, |
| 68 | IN UINT16 VlanId, |
| 69 | IN UINT8 Priority |
| 70 | ); |
| 71 | |
| 72 | /** |
| 73 | Find configuration information for specified VLAN or all configured VLANs. |
| 74 | |
| 75 | The Find() function is used to find the configuration information for matching |
| 76 | VLAN and allocate a buffer into which those entries are copied. |
| 77 | |
| 78 | @param[in] This Points to the EFI_VLAN_CONFIG_PROTOCOL. |
| 79 | @param[in] VlanId Pointer to VLAN identifier. Set to NULL to find all |
| 80 | configured VLANs. |
| 81 | @param[out] NumberOfVlan The number of VLANs which is found by the specified criteria. |
| 82 | @param[out] Entries The buffer which receive the VLAN configuration. |
| 83 | |
| 84 | @retval EFI_SUCCESS The VLAN is successfully found. |
| 85 | @retval EFI_INVALID_PARAMETER One or more of following conditions is TRUE: |
| 86 | - This is NULL. |
| 87 | - Specified VlanId is invalid. |
| 88 | @retval EFI_NOT_FOUND No matching VLAN is found. |
| 89 | |
| 90 | **/ |
| 91 | typedef |
| 92 | EFI_STATUS |
| 93 | (EFIAPI *EFI_VLAN_CONFIG_FIND)( |
| 94 | IN EFI_VLAN_CONFIG_PROTOCOL *This, |
| 95 | IN UINT16 *VlanId OPTIONAL, |
| 96 | OUT UINT16 *NumberOfVlan, |
| 97 | OUT EFI_VLAN_FIND_DATA **Entries |
| 98 | ); |
| 99 | |
| 100 | /** |
| 101 | Remove the configured VLAN device. |
| 102 | |
| 103 | The Remove() function is used to remove the specified VLAN device. |
| 104 | If the VlanId is out of the scope of (0-4094), EFI_INVALID_PARAMETER is returned. |
| 105 | If specified VLAN hasn't been previously configured, EFI_NOT_FOUND is returned. |
| 106 | |
| 107 | @param[in] This Points to the EFI_VLAN_CONFIG_PROTOCOL. |
| 108 | @param[in] VlanId Identifier (0-4094) of the VLAN to be removed. |
| 109 | |
| 110 | @retval EFI_SUCCESS The VLAN is successfully removed. |
| 111 | @retval EFI_INVALID_PARAMETER One or more of following conditions is TRUE: |
| 112 | - This is NULL. |
| 113 | - VlanId is an invalid parameter. |
| 114 | @retval EFI_NOT_FOUND The to-be-removed VLAN does not exist. |
| 115 | |
| 116 | **/ |
| 117 | typedef |
| 118 | EFI_STATUS |
| 119 | (EFIAPI *EFI_VLAN_CONFIG_REMOVE)( |
| 120 | IN EFI_VLAN_CONFIG_PROTOCOL *This, |
| 121 | IN UINT16 VlanId |
| 122 | ); |
| 123 | |
| 124 | /// |
| 125 | /// EFI_VLAN_CONFIG_PROTOCOL |
| 126 | /// provide manageability interface for VLAN setting. The intended |
| 127 | /// VLAN tagging implementation is IEEE802.1Q. |
| 128 | /// |
| 129 | struct _EFI_VLAN_CONFIG_PROTOCOL { |
| 130 | EFI_VLAN_CONFIG_SET Set; |
| 131 | EFI_VLAN_CONFIG_FIND Find; |
| 132 | EFI_VLAN_CONFIG_REMOVE Remove; |
| 133 | }; |
| 134 | |
| 135 | extern EFI_GUID gEfiVlanConfigProtocolGuid; |
| 136 | |
| 137 | #endif |