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