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