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