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