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