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