1 | /** @file
|
---|
2 | Header file to be included by MnpVlan.c.
|
---|
3 |
|
---|
4 | Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef __MNP_VLAN_H__
|
---|
10 | #define __MNP_VLAN_H__
|
---|
11 |
|
---|
12 | #include "MnpDriver.h"
|
---|
13 |
|
---|
14 | extern EFI_VLAN_CONFIG_PROTOCOL mVlanConfigProtocolTemplate;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | Create a child handle for the VLAN ID.
|
---|
18 |
|
---|
19 | @param[in] ImageHandle The driver image handle.
|
---|
20 | @param[in] ControllerHandle Handle of device to bind driver to.
|
---|
21 | @param[in] VlanId The VLAN ID.
|
---|
22 | @param[out] Devicepath Pointer to returned device path for child handle.
|
---|
23 |
|
---|
24 | @return The handle of VLAN child or NULL if failed to create VLAN child.
|
---|
25 |
|
---|
26 | **/
|
---|
27 | EFI_HANDLE
|
---|
28 | MnpCreateVlanChild (
|
---|
29 | IN EFI_HANDLE ImageHandle,
|
---|
30 | IN EFI_HANDLE ControllerHandle,
|
---|
31 | IN UINT16 VlanId,
|
---|
32 | OUT EFI_DEVICE_PATH_PROTOCOL **Devicepath OPTIONAL
|
---|
33 | );
|
---|
34 |
|
---|
35 | /**
|
---|
36 | Remove VLAN tag of a packet.
|
---|
37 |
|
---|
38 | @param[in, out] MnpDeviceData Pointer to the mnp device context data.
|
---|
39 | @param[in, out] Nbuf Pointer to the NET_BUF to remove VLAN tag.
|
---|
40 | @param[out] VlanId Pointer to the returned VLAN ID.
|
---|
41 |
|
---|
42 | @retval TRUE VLAN tag is removed from this packet.
|
---|
43 | @retval FALSE There is no VLAN tag in this packet.
|
---|
44 |
|
---|
45 | **/
|
---|
46 | BOOLEAN
|
---|
47 | MnpRemoveVlanTag (
|
---|
48 | IN OUT MNP_DEVICE_DATA *MnpDeviceData,
|
---|
49 | IN OUT NET_BUF *Nbuf,
|
---|
50 | OUT UINT16 *VlanId
|
---|
51 | );
|
---|
52 |
|
---|
53 | /**
|
---|
54 | Build the vlan packet to transmit from the TxData passed in.
|
---|
55 |
|
---|
56 | @param MnpServiceData Pointer to the mnp service context data.
|
---|
57 | @param TxData Pointer to the transmit data containing the
|
---|
58 | information to build the packet.
|
---|
59 | @param ProtocolType Pointer to the Ethernet protocol type.
|
---|
60 | @param Packet Pointer to record the address of the packet.
|
---|
61 | @param Length Pointer to a UINT32 variable used to record the
|
---|
62 | packet's length.
|
---|
63 |
|
---|
64 | **/
|
---|
65 | VOID
|
---|
66 | MnpInsertVlanTag (
|
---|
67 | IN MNP_SERVICE_DATA *MnpServiceData,
|
---|
68 | IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,
|
---|
69 | OUT UINT16 *ProtocolType,
|
---|
70 | IN OUT UINT8 **Packet,
|
---|
71 | IN OUT UINT32 *Length
|
---|
72 | );
|
---|
73 |
|
---|
74 | /**
|
---|
75 | Get VLAN configuration variable.
|
---|
76 |
|
---|
77 | @param[in] MnpDeviceData Pointer to the MNP device context data.
|
---|
78 | @param[out] NumberOfVlan Pointer to number of VLAN to be returned.
|
---|
79 | @param[out] VlanVariable Pointer to the buffer to return requested
|
---|
80 | array of VLAN_TCI.
|
---|
81 |
|
---|
82 | @retval EFI_SUCCESS The array of VLAN_TCI was returned in VlanVariable
|
---|
83 | and number of VLAN was returned in NumberOfVlan.
|
---|
84 | @retval EFI_NOT_FOUND VLAN configuration variable not found.
|
---|
85 | @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the configuration.
|
---|
86 |
|
---|
87 | **/
|
---|
88 | EFI_STATUS
|
---|
89 | MnpGetVlanVariable (
|
---|
90 | IN MNP_DEVICE_DATA *MnpDeviceData,
|
---|
91 | OUT UINTN *NumberOfVlan,
|
---|
92 | OUT VLAN_TCI **VlanVariable
|
---|
93 | );
|
---|
94 |
|
---|
95 | /**
|
---|
96 | Set VLAN configuration variable.
|
---|
97 |
|
---|
98 | @param[in] MnpDeviceData Pointer to the MNP device context data.
|
---|
99 | @param[in] NumberOfVlan Number of VLAN in array VlanVariable.
|
---|
100 | @param[in] VlanVariable Pointer to array of VLAN_TCI.
|
---|
101 |
|
---|
102 | @retval EFI_SUCCESS The VLAN variable is successfully set.
|
---|
103 | @retval EFI_OUT_OF_RESOURCES There is not enough resource to set the configuration.
|
---|
104 |
|
---|
105 | **/
|
---|
106 | EFI_STATUS
|
---|
107 | MnpSetVlanVariable (
|
---|
108 | IN MNP_DEVICE_DATA *MnpDeviceData,
|
---|
109 | IN UINTN NumberOfVlan,
|
---|
110 | IN VLAN_TCI *VlanVariable
|
---|
111 | );
|
---|
112 |
|
---|
113 | /**
|
---|
114 | Create a VLAN device or modify the configuration parameter of an
|
---|
115 | already-configured VLAN.
|
---|
116 |
|
---|
117 | The Set() function is used to create a new VLAN device or change the VLAN
|
---|
118 | configuration parameters. If the VlanId hasn't been configured in the
|
---|
119 | physical Ethernet device, a new VLAN device will be created. If a VLAN with
|
---|
120 | this VlanId is already configured, then related configuration will be updated
|
---|
121 | as the input parameters.
|
---|
122 |
|
---|
123 | If VlanId is zero, the VLAN device will send and receive untagged frames.
|
---|
124 | Otherwise, the VLAN device will send and receive VLAN-tagged frames containing the VlanId.
|
---|
125 | If VlanId is out of scope of (0-4094), EFI_INVALID_PARAMETER is returned.
|
---|
126 | If Priority is out of the scope of (0-7), then EFI_INVALID_PARAMETER is returned.
|
---|
127 | If there is not enough system memory to perform the registration, then
|
---|
128 | EFI_OUT_OF_RESOURCES is returned.
|
---|
129 |
|
---|
130 | @param[in] This Points to the EFI_VLAN_CONFIG_PROTOCOL.
|
---|
131 | @param[in] VlanId A unique identifier (1-4094) of the VLAN which is being created
|
---|
132 | or modified, or zero (0).
|
---|
133 | @param[in] Priority 3 bit priority in VLAN header. Priority 0 is default value. If
|
---|
134 | VlanId is zero (0), Priority is ignored.
|
---|
135 |
|
---|
136 | @retval EFI_SUCCESS The VLAN is successfully configured.
|
---|
137 | @retval EFI_INVALID_PARAMETER One or more of following conditions is TRUE:
|
---|
138 | - This is NULL.
|
---|
139 | - VlanId is an invalid VLAN Identifier.
|
---|
140 | - Priority is invalid.
|
---|
141 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to perform the registration.
|
---|
142 |
|
---|
143 | **/
|
---|
144 | EFI_STATUS
|
---|
145 | EFIAPI
|
---|
146 | VlanConfigSet (
|
---|
147 | IN EFI_VLAN_CONFIG_PROTOCOL *This,
|
---|
148 | IN UINT16 VlanId,
|
---|
149 | IN UINT8 Priority
|
---|
150 | );
|
---|
151 |
|
---|
152 | /**
|
---|
153 | Find configuration information for specified VLAN or all configured VLANs.
|
---|
154 |
|
---|
155 | The Find() function is used to find the configuration information for matching
|
---|
156 | VLAN and allocate a buffer into which those entries are copied.
|
---|
157 |
|
---|
158 | @param[in] This Points to the EFI_VLAN_CONFIG_PROTOCOL.
|
---|
159 | @param[in] VlanId Pointer to VLAN identifier. Set to NULL to find all
|
---|
160 | configured VLANs.
|
---|
161 | @param[out] NumberOfVlan The number of VLANs which is found by the specified criteria.
|
---|
162 | @param[out] Entries The buffer which receive the VLAN configuration.
|
---|
163 |
|
---|
164 | @retval EFI_SUCCESS The VLAN is successfully found.
|
---|
165 | @retval EFI_INVALID_PARAMETER One or more of following conditions is TRUE:
|
---|
166 | - This is NULL.
|
---|
167 | - Specified VlanId is invalid.
|
---|
168 | @retval EFI_NOT_FOUND No matching VLAN is found.
|
---|
169 |
|
---|
170 | **/
|
---|
171 | EFI_STATUS
|
---|
172 | EFIAPI
|
---|
173 | VlanConfigFind (
|
---|
174 | IN EFI_VLAN_CONFIG_PROTOCOL *This,
|
---|
175 | IN UINT16 *VlanId OPTIONAL,
|
---|
176 | OUT UINT16 *NumberOfVlan,
|
---|
177 | OUT EFI_VLAN_FIND_DATA **Entries
|
---|
178 | );
|
---|
179 |
|
---|
180 | /**
|
---|
181 | Remove the configured VLAN device.
|
---|
182 |
|
---|
183 | The Remove() function is used to remove the specified VLAN device.
|
---|
184 | If the VlanId is out of the scope of (0-4094), EFI_INVALID_PARAMETER is returned.
|
---|
185 | If specified VLAN hasn't been previously configured, EFI_NOT_FOUND is returned.
|
---|
186 |
|
---|
187 | @param[in] This Points to the EFI_VLAN_CONFIG_PROTOCOL.
|
---|
188 | @param[in] VlanId Identifier (0-4094) of the VLAN to be removed.
|
---|
189 |
|
---|
190 | @retval EFI_SUCCESS The VLAN is successfully removed.
|
---|
191 | @retval EFI_INVALID_PARAMETER One or more of following conditions is TRUE:
|
---|
192 | - This is NULL.
|
---|
193 | - VlanId is an invalid parameter.
|
---|
194 | @retval EFI_NOT_FOUND The to-be-removed VLAN does not exist.
|
---|
195 |
|
---|
196 | **/
|
---|
197 | EFI_STATUS
|
---|
198 | EFIAPI
|
---|
199 | VlanConfigRemove (
|
---|
200 | IN EFI_VLAN_CONFIG_PROTOCOL *This,
|
---|
201 | IN UINT16 VlanId
|
---|
202 | );
|
---|
203 |
|
---|
204 | #endif
|
---|