]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Declaration of structures and functions of MnpDxe driver.\r | |
3 | \r | |
4 | Copyright (c) 2005 - 2009, Intel Corporation.<BR>\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions\r | |
7 | of the BSD License which accompanies this distribution. The full\r | |
8 | text of the license may be found at<BR>\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _MNP_IMPL_H_\r | |
17 | #define _MNP_IMPL_H_\r | |
18 | \r | |
19 | #include "MnpDriver.h"\r | |
20 | \r | |
21 | #define NET_ETHER_FCS_SIZE 4\r | |
22 | \r | |
23 | #define MNP_SYS_POLL_INTERVAL (10 * TICKS_PER_MS) // 10 milliseconds\r | |
24 | #define MNP_TIMEOUT_CHECK_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds\r | |
25 | #define MNP_TX_TIMEOUT_TIME (500 * TICKS_PER_MS) // 500 milliseconds\r | |
26 | #define MNP_INIT_NET_BUFFER_NUM 512\r | |
27 | #define MNP_NET_BUFFER_INCREASEMENT 64\r | |
28 | #define MNP_MAX_NET_BUFFER_NUM 65536\r | |
29 | \r | |
30 | #define MNP_MAX_RCVD_PACKET_QUE_SIZE 256\r | |
31 | \r | |
32 | #define MNP_RECEIVE_UNICAST 0x01\r | |
33 | #define MNP_RECEIVE_BROADCAST 0x02\r | |
34 | \r | |
35 | #define UNICAST_PACKET MNP_RECEIVE_UNICAST\r | |
36 | #define BROADCAST_PACKET MNP_RECEIVE_BROADCAST\r | |
37 | \r | |
38 | #define MNP_INSTANCE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'I')\r | |
39 | \r | |
40 | #define MNP_INSTANCE_DATA_FROM_THIS(a) \\r | |
41 | CR ( \\r | |
42 | (a), \\r | |
43 | MNP_INSTANCE_DATA, \\r | |
44 | ManagedNetwork, \\r | |
45 | MNP_INSTANCE_DATA_SIGNATURE \\r | |
46 | )\r | |
47 | \r | |
48 | typedef struct {\r | |
49 | UINT32 Signature;\r | |
50 | \r | |
51 | MNP_SERVICE_DATA *MnpServiceData;\r | |
52 | \r | |
53 | EFI_HANDLE Handle;\r | |
54 | \r | |
55 | LIST_ENTRY InstEntry;\r | |
56 | \r | |
57 | EFI_MANAGED_NETWORK_PROTOCOL ManagedNetwork;\r | |
58 | \r | |
59 | BOOLEAN Configured;\r | |
60 | BOOLEAN Destroyed;\r | |
61 | \r | |
62 | LIST_ENTRY GroupCtrlBlkList;\r | |
63 | \r | |
64 | NET_MAP RxTokenMap;\r | |
65 | \r | |
66 | LIST_ENTRY RxDeliveredPacketQueue;\r | |
67 | LIST_ENTRY RcvdPacketQueue;\r | |
68 | UINTN RcvdPacketQueueSize;\r | |
69 | \r | |
70 | EFI_MANAGED_NETWORK_CONFIG_DATA ConfigData;\r | |
71 | \r | |
72 | UINT8 ReceiveFilter;\r | |
73 | } MNP_INSTANCE_DATA;\r | |
74 | \r | |
75 | typedef struct {\r | |
76 | LIST_ENTRY AddrEntry;\r | |
77 | EFI_MAC_ADDRESS Address;\r | |
78 | INTN RefCnt;\r | |
79 | } MNP_GROUP_ADDRESS;\r | |
80 | \r | |
81 | typedef struct {\r | |
82 | LIST_ENTRY CtrlBlkEntry;\r | |
83 | MNP_GROUP_ADDRESS *GroupAddress;\r | |
84 | } MNP_GROUP_CONTROL_BLOCK;\r | |
85 | \r | |
86 | typedef struct {\r | |
87 | LIST_ENTRY WrapEntry;\r | |
88 | MNP_INSTANCE_DATA *Instance;\r | |
89 | EFI_MANAGED_NETWORK_RECEIVE_DATA RxData;\r | |
90 | NET_BUF *Nbuf;\r | |
91 | UINT64 TimeoutTick;\r | |
92 | } MNP_RXDATA_WRAP;\r | |
93 | \r | |
94 | \r | |
95 | /**\r | |
96 | Initialize the mnp device context data.\r | |
97 | \r | |
98 | @param[in, out] MnpDeviceData Pointer to the mnp device context data.\r | |
99 | @param[in] ImageHandle The driver image handle.\r | |
100 | @param[in] ControllerHandle Handle of device to bind driver to.\r | |
101 | \r | |
102 | @retval EFI_SUCCESS The mnp service context is initialized.\r | |
103 | @retval EFI_UNSUPPORTED ControllerHandle does not support Simple Network Protocol.\r | |
104 | @retval Others Other errors as indicated.\r | |
105 | \r | |
106 | **/\r | |
107 | EFI_STATUS\r | |
108 | MnpInitializeDeviceData (\r | |
109 | IN OUT MNP_DEVICE_DATA *MnpDeviceData,\r | |
110 | IN EFI_HANDLE ImageHandle,\r | |
111 | IN EFI_HANDLE ControllerHandle\r | |
112 | );\r | |
113 | \r | |
114 | /**\r | |
115 | Destroy the MNP device context data.\r | |
116 | \r | |
117 | @param[in, out] MnpDeviceData Pointer to the mnp device context data.\r | |
118 | @param[in] ImageHandle The driver image handle.\r | |
119 | \r | |
120 | **/\r | |
121 | VOID\r | |
122 | MnpDestroyDeviceData (\r | |
123 | IN OUT MNP_DEVICE_DATA *MnpDeviceData,\r | |
124 | IN EFI_HANDLE ImageHandle\r | |
125 | );\r | |
126 | \r | |
127 | /**\r | |
128 | Create mnp service context data.\r | |
129 | \r | |
130 | @param[in] MnpDeviceData Pointer to the mnp device context data.\r | |
131 | @param[in] VlanId The VLAN ID.\r | |
132 | @param[in] Priority The VLAN priority. If VlanId is 0,\r | |
133 | Priority is ignored.\r | |
134 | \r | |
135 | @return A pointer to MNP_SERVICE_DATA or NULL if failed to create MNP service context.\r | |
136 | \r | |
137 | **/\r | |
138 | MNP_SERVICE_DATA *\r | |
139 | MnpCreateServiceData (\r | |
140 | IN MNP_DEVICE_DATA *MnpDeviceData,\r | |
141 | IN UINT16 VlanId,\r | |
142 | IN UINT8 Priority OPTIONAL\r | |
143 | );\r | |
144 | \r | |
145 | /**\r | |
146 | Initialize the mnp service context data.\r | |
147 | \r | |
148 | @param[in, out] MnpServiceData Pointer to the mnp service context data.\r | |
149 | @param[in] ImageHandle The driver image handle.\r | |
150 | @param[in] ControllerHandle Handle of device to bind driver to.\r | |
151 | \r | |
152 | @retval EFI_SUCCESS The mnp service context is initialized.\r | |
153 | @retval EFI_UNSUPPORTED ControllerHandle does not support Simple Network Protocol.\r | |
154 | @retval Others Other errors as indicated.\r | |
155 | \r | |
156 | **/\r | |
157 | EFI_STATUS\r | |
158 | MnpInitializeServiceData (\r | |
159 | IN OUT MNP_SERVICE_DATA *MnpServiceData,\r | |
160 | IN EFI_HANDLE ImageHandle,\r | |
161 | IN EFI_HANDLE ControllerHandle\r | |
162 | );\r | |
163 | \r | |
164 | /**\r | |
165 | Destroy the MNP service context data.\r | |
166 | \r | |
167 | @param[in, out] MnpServiceData Pointer to the mnp service context data.\r | |
168 | \r | |
169 | @retval EFI_SUCCESS The mnp service context is destroyed.\r | |
170 | @retval Others Errors as indicated.\r | |
171 | \r | |
172 | **/\r | |
173 | EFI_STATUS\r | |
174 | MnpDestroyServiceData (\r | |
175 | IN OUT MNP_SERVICE_DATA *MnpServiceData\r | |
176 | );\r | |
177 | \r | |
178 | /**\r | |
179 | Destroy all child of the MNP service data.\r | |
180 | \r | |
181 | @param[in, out] MnpServiceData Pointer to the mnp service context data.\r | |
182 | \r | |
183 | @retval EFI_SUCCESS All child are destroyed.\r | |
184 | @retval Others Failed to destroy all child.\r | |
185 | \r | |
186 | **/\r | |
187 | EFI_STATUS\r | |
188 | MnpDestroyServiceChild (\r | |
189 | IN OUT MNP_SERVICE_DATA *MnpServiceData\r | |
190 | );\r | |
191 | \r | |
192 | /**\r | |
193 | Find the MNP Service Data for given VLAN ID.\r | |
194 | \r | |
195 | @param[in] MnpDeviceData Pointer to the mnp device context data.\r | |
196 | @param[in] VlanId The VLAN ID.\r | |
197 | \r | |
198 | @return A pointer to MNP_SERVICE_DATA or NULL if not found.\r | |
199 | \r | |
200 | **/\r | |
201 | MNP_SERVICE_DATA *\r | |
202 | MnpFindServiceData (\r | |
203 | IN MNP_DEVICE_DATA *MnpDeviceData,\r | |
204 | IN UINT16 VlanId\r | |
205 | );\r | |
206 | \r | |
207 | /**\r | |
208 | Initialize the mnp instance context data.\r | |
209 | \r | |
210 | @param[in] MnpServiceData Pointer to the mnp service context data.\r | |
211 | @param[in, out] Instance Pointer to the mnp instance context data\r | |
212 | to initialize.\r | |
213 | \r | |
214 | **/\r | |
215 | VOID\r | |
216 | MnpInitializeInstanceData (\r | |
217 | IN MNP_SERVICE_DATA *MnpServiceData,\r | |
218 | IN OUT MNP_INSTANCE_DATA *Instance\r | |
219 | );\r | |
220 | \r | |
221 | /**\r | |
222 | Check whether the token specified by Arg matches the token in Item.\r | |
223 | \r | |
224 | @param[in] Map Pointer to the NET_MAP.\r | |
225 | @param[in] Item Pointer to the NET_MAP_ITEM.\r | |
226 | @param[in] Arg Pointer to the Arg, it's a pointer to the token to\r | |
227 | check.\r | |
228 | \r | |
229 | @retval EFI_SUCCESS The token specified by Arg is different from the\r | |
230 | token in Item.\r | |
231 | @retval EFI_ACCESS_DENIED The token specified by Arg is the same as that in\r | |
232 | Item.\r | |
233 | \r | |
234 | **/\r | |
235 | EFI_STATUS\r | |
236 | MnpTokenExist (\r | |
237 | IN NET_MAP *Map,\r | |
238 | IN NET_MAP_ITEM *Item,\r | |
239 | IN VOID *Arg\r | |
240 | );\r | |
241 | \r | |
242 | /**\r | |
243 | Cancel the token specified by Arg if it matches the token in Item.\r | |
244 | \r | |
245 | @param[in, out] Map Pointer to the NET_MAP.\r | |
246 | @param[in, out] Item Pointer to the NET_MAP_ITEM.\r | |
247 | @param[in] Arg Pointer to the Arg, it's a pointer to the\r | |
248 | token to cancel.\r | |
249 | \r | |
250 | @retval EFI_SUCCESS The Arg is NULL, and the token in Item is cancelled,\r | |
251 | or the Arg isn't NULL, and the token in Item is\r | |
252 | different from the Arg.\r | |
253 | @retval EFI_ABORTED The Arg isn't NULL, the token in Item mathces the\r | |
254 | Arg, and the token is cancelled.\r | |
255 | \r | |
256 | **/\r | |
257 | EFI_STATUS\r | |
258 | MnpCancelTokens (\r | |
259 | IN OUT NET_MAP *Map,\r | |
260 | IN OUT NET_MAP_ITEM *Item,\r | |
261 | IN VOID *Arg\r | |
262 | );\r | |
263 | \r | |
264 | /**\r | |
265 | Flush the instance's received data.\r | |
266 | \r | |
267 | @param[in, out] Instance Pointer to the mnp instance context data.\r | |
268 | \r | |
269 | **/\r | |
270 | VOID\r | |
271 | MnpFlushRcvdDataQueue (\r | |
272 | IN OUT MNP_INSTANCE_DATA *Instance\r | |
273 | );\r | |
274 | \r | |
275 | /**\r | |
276 | Configure the Instance using ConfigData.\r | |
277 | \r | |
278 | @param[in, out] Instance Pointer to the mnp instance context data.\r | |
279 | @param[in] ConfigData Pointer to the configuration data used to configure\r | |
280 | the isntance.\r | |
281 | \r | |
282 | @retval EFI_SUCCESS The Instance is configured.\r | |
283 | @retval EFI_UNSUPPORTED EnableReceiveTimestamps is on and the\r | |
284 | implementation doesn't support it.\r | |
285 | @retval Others Other errors as indicated.\r | |
286 | \r | |
287 | **/\r | |
288 | EFI_STATUS\r | |
289 | MnpConfigureInstance (\r | |
290 | IN OUT MNP_INSTANCE_DATA *Instance,\r | |
291 | IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL\r | |
292 | );\r | |
293 | \r | |
294 | /**\r | |
295 | Do the group operations for this instance.\r | |
296 | \r | |
297 | @param[in, out] Instance Pointer to the instance context data.\r | |
298 | @param[in] JoinFlag Set to TRUE to join a group. Set to TRUE to\r | |
299 | leave a group/groups.\r | |
300 | @param[in] MacAddress Pointer to the group address to join or leave.\r | |
301 | @param[in] CtrlBlk Pointer to the group control block if JoinFlag\r | |
302 | is FALSE.\r | |
303 | \r | |
304 | @retval EFI_SUCCESS The group operation finished.\r | |
305 | @retval EFI_OUT_OF_RESOURCES Failed due to lack of memory resources.\r | |
306 | @retval Others Other errors as indicated.\r | |
307 | \r | |
308 | **/\r | |
309 | EFI_STATUS\r | |
310 | MnpGroupOp (\r | |
311 | IN OUT MNP_INSTANCE_DATA *Instance,\r | |
312 | IN BOOLEAN JoinFlag,\r | |
313 | IN EFI_MAC_ADDRESS *MacAddress OPTIONAL,\r | |
314 | IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL\r | |
315 | );\r | |
316 | \r | |
317 | /**\r | |
318 | Validates the Mnp transmit token.\r | |
319 | \r | |
320 | @param[in] Instance Pointer to the Mnp instance context data.\r | |
321 | @param[in] Token Pointer to the transmit token to check.\r | |
322 | \r | |
323 | @return The Token is valid or not.\r | |
324 | \r | |
325 | **/\r | |
326 | BOOLEAN\r | |
327 | MnpIsValidTxToken (\r | |
328 | IN MNP_INSTANCE_DATA *Instance,\r | |
329 | IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r | |
330 | );\r | |
331 | \r | |
332 | /**\r | |
333 | Build the packet to transmit from the TxData passed in.\r | |
334 | \r | |
335 | @param[in] MnpServiceData Pointer to the mnp service context data.\r | |
336 | @param[in] TxData Pointer to the transmit data containing the information\r | |
337 | to build the packet.\r | |
338 | @param[out] PktBuf Pointer to record the address of the packet.\r | |
339 | @param[out] PktLen Pointer to a UINT32 variable used to record the packet's\r | |
340 | length.\r | |
341 | \r | |
342 | **/\r | |
343 | VOID\r | |
344 | MnpBuildTxPacket (\r | |
345 | IN MNP_SERVICE_DATA *MnpServiceData,\r | |
346 | IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,\r | |
347 | OUT UINT8 **PktBuf,\r | |
348 | OUT UINT32 *PktLen\r | |
349 | );\r | |
350 | \r | |
351 | /**\r | |
352 | Synchronously send out the packet.\r | |
353 | \r | |
354 | @param[in] MnpServiceData Pointer to the mnp service context data.\r | |
355 | @param[in] Packet Pointer to the pakcet buffer.\r | |
356 | @param[in] Length The length of the packet.\r | |
357 | @param[in, out] Token Pointer to the token the packet generated from.\r | |
358 | \r | |
359 | @retval EFI_SUCCESS The packet is sent out.\r | |
360 | @retval EFI_TIMEOUT Time out occurs, the packet isn't sent.\r | |
361 | @retval EFI_DEVICE_ERROR An unexpected network error occurs.\r | |
362 | \r | |
363 | **/\r | |
364 | EFI_STATUS\r | |
365 | MnpSyncSendPacket (\r | |
366 | IN MNP_SERVICE_DATA *MnpServiceData,\r | |
367 | IN UINT8 *Packet,\r | |
368 | IN UINT32 Length,\r | |
369 | IN OUT EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r | |
370 | );\r | |
371 | \r | |
372 | /**\r | |
373 | Try to deliver the received packet to the instance.\r | |
374 | \r | |
375 | @param[in, out] Instance Pointer to the mnp instance context data.\r | |
376 | \r | |
377 | @retval EFI_SUCCESS The received packet is delivered, or there is no\r | |
378 | packet to deliver, or there is no available receive\r | |
379 | token.\r | |
380 | @retval EFI_OUT_OF_RESOURCES The deliver fails due to lack of memory resource.\r | |
381 | \r | |
382 | **/\r | |
383 | EFI_STATUS\r | |
384 | MnpInstanceDeliverPacket (\r | |
385 | IN OUT MNP_INSTANCE_DATA *Instance\r | |
386 | );\r | |
387 | \r | |
388 | /**\r | |
389 | Recycle the RxData and other resources used to hold and deliver the received\r | |
390 | packet.\r | |
391 | \r | |
392 | @param[in] Event The event this notify function registered to.\r | |
393 | @param[in] Context Pointer to the context data registerd to the Event.\r | |
394 | \r | |
395 | **/\r | |
396 | VOID\r | |
397 | EFIAPI\r | |
398 | MnpRecycleRxData (\r | |
399 | IN EFI_EVENT Event,\r | |
400 | IN VOID *Context\r | |
401 | );\r | |
402 | \r | |
403 | /**\r | |
404 | Try to receive a packet and deliver it.\r | |
405 | \r | |
406 | @param[in, out] MnpDeviceData Pointer to the mnp device context data.\r | |
407 | \r | |
408 | @retval EFI_SUCCESS add return value to function comment\r | |
409 | @retval EFI_NOT_STARTED The simple network protocol is not started.\r | |
410 | @retval EFI_NOT_READY No packet received.\r | |
411 | @retval EFI_DEVICE_ERROR An unexpected error occurs.\r | |
412 | \r | |
413 | **/\r | |
414 | EFI_STATUS\r | |
415 | MnpReceivePacket (\r | |
416 | IN OUT MNP_DEVICE_DATA *MnpDeviceData\r | |
417 | );\r | |
418 | \r | |
419 | /**\r | |
420 | Allocate a free NET_BUF from MnpDeviceData->FreeNbufQue. If there is none\r | |
421 | in the queue, first try to allocate some and add them into the queue, then\r | |
422 | fetch the NET_BUF from the updated FreeNbufQue.\r | |
423 | \r | |
424 | @param[in, out] MnpDeviceData Pointer to the MNP_DEVICE_DATA.\r | |
425 | \r | |
426 | @return Pointer to the allocated free NET_BUF structure, if NULL the\r | |
427 | operation is failed.\r | |
428 | \r | |
429 | **/\r | |
430 | NET_BUF *\r | |
431 | MnpAllocNbuf (\r | |
432 | IN OUT MNP_DEVICE_DATA *MnpDeviceData\r | |
433 | );\r | |
434 | \r | |
435 | /**\r | |
436 | Try to reclaim the Nbuf into the buffer pool.\r | |
437 | \r | |
438 | @param[in, out] MnpDeviceData Pointer to the mnp device context data.\r | |
439 | @param[in, out] Nbuf Pointer to the NET_BUF to free.\r | |
440 | \r | |
441 | **/\r | |
442 | VOID\r | |
443 | MnpFreeNbuf (\r | |
444 | IN OUT MNP_DEVICE_DATA *MnpDeviceData,\r | |
445 | IN OUT NET_BUF *Nbuf\r | |
446 | );\r | |
447 | \r | |
448 | /**\r | |
449 | Remove the received packets if timeout occurs.\r | |
450 | \r | |
451 | @param[in] Event The event this notify function registered to.\r | |
452 | @param[in] Context Pointer to the context data registered to the\r | |
453 | event.\r | |
454 | \r | |
455 | **/\r | |
456 | VOID\r | |
457 | EFIAPI\r | |
458 | MnpCheckPacketTimeout (\r | |
459 | IN EFI_EVENT Event,\r | |
460 | IN VOID *Context\r | |
461 | );\r | |
462 | \r | |
463 | /**\r | |
464 | Poll to receive the packets from Snp. This function is either called by upperlayer\r | |
465 | protocols/applications or the system poll timer notify mechanism.\r | |
466 | \r | |
467 | @param[in] Event The event this notify function registered to.\r | |
468 | @param[in, out] Context Pointer to the context data registered to the event.\r | |
469 | \r | |
470 | **/\r | |
471 | VOID\r | |
472 | EFIAPI\r | |
473 | MnpSystemPoll (\r | |
474 | IN EFI_EVENT Event,\r | |
475 | IN OUT VOID *Context\r | |
476 | );\r | |
477 | \r | |
478 | /**\r | |
479 | Returns the operational parameters for the current MNP child driver. May also\r | |
480 | support returning the underlying SNP driver mode data.\r | |
481 | \r | |
482 | The GetModeData() function is used to read the current mode data (operational\r | |
483 | parameters) from the MNP or the underlying SNP.\r | |
484 | \r | |
485 | @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r | |
486 | @param[out] MnpConfigData Pointer to storage for MNP operational parameters. Type\r | |
487 | EFI_MANAGED_NETWORK_CONFIG_DATA is defined in "Related\r | |
488 | Definitions" below.\r | |
489 | @param[out] SnpModeData Pointer to storage for SNP operational parameters. This\r | |
490 | feature may be unsupported. Type EFI_SIMPLE_NETWORK_MODE\r | |
491 | is defined in the EFI_SIMPLE_NETWORK_PROTOCOL.\r | |
492 | \r | |
493 | @retval EFI_SUCCESS The operation completed successfully.\r | |
494 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
495 | @retval EFI_UNSUPPORTED The requested feature is unsupported in this\r | |
496 | MNP implementation.\r | |
497 | @retval EFI_NOT_STARTED This MNP child driver instance has not been\r | |
498 | configured. The default values are returned in\r | |
499 | MnpConfigData if it is not NULL.\r | |
500 | @retval Others The mode data could not be read.\r | |
501 | \r | |
502 | **/\r | |
503 | EFI_STATUS\r | |
504 | EFIAPI\r | |
505 | MnpGetModeData (\r | |
506 | IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r | |
507 | OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r | |
508 | OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r | |
509 | );\r | |
510 | \r | |
511 | /**\r | |
512 | Sets or clears the operational parameters for the MNP child driver.\r | |
513 | \r | |
514 | The Configure() function is used to set, change, or reset the operational\r | |
515 | parameters for the MNP child driver instance. Until the operational parameters\r | |
516 | have been set, no network traffic can be sent or received by this MNP child\r | |
517 | driver instance. Once the operational parameters have been reset, no more\r | |
518 | traffic can be sent or received until the operational parameters have been set\r | |
519 | again.\r | |
520 | Each MNP child driver instance can be started and stopped independently of\r | |
521 | each other by setting or resetting their receive filter settings with the\r | |
522 | Configure() function.\r | |
523 | After any successful call to Configure(), the MNP child driver instance is\r | |
524 | started. The internal periodic timer (if supported) is enabled. Data can be\r | |
525 | transmitted and may be received if the receive filters have also been enabled.\r | |
526 | Note: If multiple MNP child driver instances will receive the same packet\r | |
527 | because of overlapping receive filter settings, then the first MNP child\r | |
528 | driver instance will receive the original packet and additional instances will\r | |
529 | receive copies of the original packet.\r | |
530 | Note: Warning: Receive filter settings that overlap will consume extra\r | |
531 | processor and/or DMA resources and degrade system and network performance.\r | |
532 | \r | |
533 | @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r | |
534 | @param[in] MnpConfigData Pointer to configuration data that will be assigned\r | |
535 | to the MNP child driver instance. If NULL, the MNP\r | |
536 | child driver instance is reset to startup defaults\r | |
537 | and all pending transmit and receive requests are\r | |
538 | flushed. Type EFI_MANAGED_NETWORK_CONFIG_DATA is\r | |
539 | defined in EFI_MANAGED_NETWORK_PROTOCOL.GetModeData().\r | |
540 | \r | |
541 | @retval EFI_SUCCESS The operation completed successfully.\r | |
542 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r | |
543 | TRUE:\r | |
544 | * This is NULL.\r | |
545 | * MnpConfigData.ProtocolTypeFilter is not\r | |
546 | valid.\r | |
547 | The operational data for the MNP child driver\r | |
548 | instance is unchanged.\r | |
549 | @retval EFI_OUT_OF_RESOURCES Required system resources (usually memory)\r | |
550 | could not be allocated.\r | |
551 | The MNP child driver instance has been reset to\r | |
552 | startup defaults.\r | |
553 | @retval EFI_UNSUPPORTED The requested feature is unsupported in\r | |
554 | this [MNP] implementation. The operational data\r | |
555 | for the MNP child driver instance is unchanged.\r | |
556 | @retval EFI_DEVICE_ERROR An unexpected network or system error\r | |
557 | occurred. The MNP child driver instance has\r | |
558 | been reset to startup defaults.\r | |
559 | @retval Others The MNP child driver instance has been reset to\r | |
560 | startup defaults.\r | |
561 | \r | |
562 | **/\r | |
563 | EFI_STATUS\r | |
564 | EFIAPI\r | |
565 | MnpConfigure (\r | |
566 | IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r | |
567 | IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL\r | |
568 | );\r | |
569 | \r | |
570 | /**\r | |
571 | Translates an IP multicast address to a hardware (MAC) multicast address. This\r | |
572 | function may be unsupported in some MNP implementations.\r | |
573 | \r | |
574 | The McastIpToMac() function translates an IP multicast address to a hardware\r | |
575 | (MAC) multicast address. This function may be implemented by calling the\r | |
576 | underlying EFI_SIMPLE_NETWORK. MCastIpToMac() function, which may also be\r | |
577 | unsupported in some MNP implementations.\r | |
578 | \r | |
579 | @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r | |
580 | @param[in] Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address.\r | |
581 | Set to FALSE if IpAddress is an IPv4 multicast address.\r | |
582 | @param[in] IpAddress Pointer to the multicast IP address (in network byte\r | |
583 | order) to convert.\r | |
584 | @param[out] MacAddress Pointer to the resulting multicast MAC address.\r | |
585 | \r | |
586 | @retval EFI_SUCCESS The operation completed successfully.\r | |
587 | @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:\r | |
588 | * This is NULL.\r | |
589 | * IpAddress is NULL.\r | |
590 | * IpAddress is not a valid multicast IP\r | |
591 | address.\r | |
592 | * MacAddress is NULL.\r | |
593 | @retval EFI_NOT_STARTED This MNP child driver instance has not been\r | |
594 | configured.\r | |
595 | @retval EFI_UNSUPPORTED The requested feature is unsupported in this\r | |
596 | MNP implementation.\r | |
597 | @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r | |
598 | @retval Others The address could not be converted.\r | |
599 | **/\r | |
600 | EFI_STATUS\r | |
601 | EFIAPI\r | |
602 | MnpMcastIpToMac (\r | |
603 | IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r | |
604 | IN BOOLEAN Ipv6Flag,\r | |
605 | IN EFI_IP_ADDRESS *IpAddress,\r | |
606 | OUT EFI_MAC_ADDRESS *MacAddress\r | |
607 | );\r | |
608 | \r | |
609 | /**\r | |
610 | Enables and disables receive filters for multicast address. This function may\r | |
611 | be unsupported in some MNP implementations.\r | |
612 | \r | |
613 | The Groups() function only adds and removes multicast MAC addresses from the\r | |
614 | filter list. The MNP driver does not transmit or process Internet Group\r | |
615 | Management Protocol (IGMP) packets. If JoinFlag is FALSE and MacAddress is\r | |
616 | NULL, then all joined groups are left.\r | |
617 | \r | |
618 | @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r | |
619 | @param[in] JoinFlag Set to TRUE to join this multicast group.\r | |
620 | Set to FALSE to leave this multicast group.\r | |
621 | @param[in] MacAddress Pointer to the multicast MAC group (address) to join or\r | |
622 | leave.\r | |
623 | \r | |
624 | @retval EFI_SUCCESS The requested operation completed successfully.\r | |
625 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
626 | * This is NULL.\r | |
627 | * JoinFlag is TRUE and MacAddress is NULL.\r | |
628 | * MacAddress is not a valid multicast MAC\r | |
629 | address.\r | |
630 | * The MNP multicast group settings are\r | |
631 | unchanged.\r | |
632 | @retval EFI_NOT_STARTED This MNP child driver instance has not been\r | |
633 | configured.\r | |
634 | @retval EFI_ALREADY_STARTED The supplied multicast group is already joined.\r | |
635 | @retval EFI_NOT_FOUND The supplied multicast group is not joined.\r | |
636 | @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r | |
637 | The MNP child driver instance has been reset to\r | |
638 | startup defaults.\r | |
639 | @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP\r | |
640 | implementation.\r | |
641 | @retval Others The requested operation could not be completed.\r | |
642 | The MNP multicast group settings are unchanged.\r | |
643 | \r | |
644 | **/\r | |
645 | EFI_STATUS\r | |
646 | EFIAPI\r | |
647 | MnpGroups (\r | |
648 | IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r | |
649 | IN BOOLEAN JoinFlag,\r | |
650 | IN EFI_MAC_ADDRESS *MacAddress OPTIONAL\r | |
651 | );\r | |
652 | \r | |
653 | /**\r | |
654 | Places asynchronous outgoing data packets into the transmit queue.\r | |
655 | \r | |
656 | The Transmit() function places a completion token into the transmit packet\r | |
657 | queue. This function is always asynchronous.\r | |
658 | The caller must fill in the Token.Event and Token.TxData fields in the\r | |
659 | completion token, and these fields cannot be NULL. When the transmit operation\r | |
660 | completes, the MNP updates the Token.Status field and the Token.Event is\r | |
661 | signaled.\r | |
662 | Note: There may be a performance penalty if the packet needs to be\r | |
663 | defragmented before it can be transmitted by the network device. Systems in\r | |
664 | which performance is critical should review the requirements and features of\r | |
665 | the underlying communications device and drivers.\r | |
666 | \r | |
667 | \r | |
668 | @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r | |
669 | @param[in] Token Pointer to a token associated with the transmit data\r | |
670 | descriptor. Type EFI_MANAGED_NETWORK_COMPLETION_TOKEN\r | |
671 | is defined in "Related Definitions" below.\r | |
672 | \r | |
673 | @retval EFI_SUCCESS The transmit completion token was cached.\r | |
674 | @retval EFI_NOT_STARTED This MNP child driver instance has not been\r | |
675 | configured.\r | |
676 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r | |
677 | TRUE:\r | |
678 | * This is NULL.\r | |
679 | * Token is NULL.\r | |
680 | * Token.Event is NULL.\r | |
681 | * Token.TxData is NULL.\r | |
682 | * Token.TxData.DestinationAddress is not\r | |
683 | NULL and Token.TxData.HeaderLength is zero.\r | |
684 | * Token.TxData.FragmentCount is zero.\r | |
685 | * (Token.TxData.HeaderLength +\r | |
686 | Token.TxData.DataLength) is not equal to the\r | |
687 | sum of the\r | |
688 | Token.TxData.FragmentTable[].FragmentLength\r | |
689 | fields.\r | |
690 | * One or more of the\r | |
691 | Token.TxData.FragmentTable[].FragmentLength\r | |
692 | fields is zero.\r | |
693 | * One or more of the\r | |
694 | Token.TxData.FragmentTable[].FragmentBufferfields\r | |
695 | is NULL.\r | |
696 | * Token.TxData.DataLength is greater than MTU.\r | |
697 | @retval EFI_ACCESS_DENIED The transmit completion token is already in the\r | |
698 | transmit queue.\r | |
699 | @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a\r | |
700 | lack of system resources (usually memory).\r | |
701 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
702 | The MNP child driver instance has been reset to\r | |
703 | startup defaults.\r | |
704 | @retval EFI_NOT_READY The transmit request could not be queued because\r | |
705 | the transmit queue is full.\r | |
706 | \r | |
707 | **/\r | |
708 | EFI_STATUS\r | |
709 | EFIAPI\r | |
710 | MnpTransmit (\r | |
711 | IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r | |
712 | IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r | |
713 | );\r | |
714 | \r | |
715 | /**\r | |
716 | Aborts an asynchronous transmit or receive request.\r | |
717 | \r | |
718 | The Cancel() function is used to abort a pending transmit or receive request.\r | |
719 | If the token is in the transmit or receive request queues, after calling this\r | |
720 | function, Token.Status will be set to EFI_ABORTED and then Token.Event will be\r | |
721 | signaled. If the token is not in one of the queues, which usually means that\r | |
722 | the asynchronous operation has completed, this function will not signal the\r | |
723 | token and EFI_NOT_FOUND is returned.\r | |
724 | \r | |
725 | @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r | |
726 | @param[in] Token Pointer to a token that has been issued by\r | |
727 | EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or\r | |
728 | EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If NULL, all\r | |
729 | pending tokens are aborted.\r | |
730 | \r | |
731 | @retval EFI_SUCCESS The asynchronous I/O request was aborted and\r | |
732 | Token.Event was signaled. When Token is NULL,\r | |
733 | all pending requests were aborted and their\r | |
734 | events were signaled.\r | |
735 | @retval EFI_NOT_STARTED This MNP child driver instance has not been\r | |
736 | configured.\r | |
737 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
738 | @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O\r | |
739 | request was not found in the transmit or\r | |
740 | receive queue. It has either completed or was\r | |
741 | not issued by Transmit() and Receive().\r | |
742 | \r | |
743 | **/\r | |
744 | EFI_STATUS\r | |
745 | EFIAPI\r | |
746 | MnpCancel (\r | |
747 | IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r | |
748 | IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL\r | |
749 | );\r | |
750 | \r | |
751 | /**\r | |
752 | Places an asynchronous receiving request into the receiving queue.\r | |
753 | \r | |
754 | The Receive() function places a completion token into the receive packet\r | |
755 | queue. This function is always asynchronous.\r | |
756 | The caller must fill in the Token.Event field in the completion token, and\r | |
757 | this field cannot be NULL. When the receive operation completes, the MNP\r | |
758 | updates the Token.Status and Token.RxData fields and the Token.Event is\r | |
759 | signaled.\r | |
760 | \r | |
761 | @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r | |
762 | @param[in] Token Pointer to a token associated with the receive\r | |
763 | data descriptor. Type\r | |
764 | EFI_MANAGED_NETWORK_COMPLETION_TOKEN is defined in\r | |
765 | EFI_MANAGED_NETWORK_PROTOCOL.Transmit().\r | |
766 | \r | |
767 | @retval EFI_SUCCESS The receive completion token was cached.\r | |
768 | @retval EFI_NOT_STARTED This MNP child driver instance has not been\r | |
769 | configured.\r | |
770 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r | |
771 | TRUE:\r | |
772 | * This is NULL.\r | |
773 | * Token is NULL.\r | |
774 | * Token.Event is NULL\r | |
775 | @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a\r | |
776 | lack of system resources (usually memory).\r | |
777 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
778 | The MNP child driver instance has been reset to\r | |
779 | startup defaults.\r | |
780 | @retval EFI_ACCESS_DENIED The receive completion token was already in the\r | |
781 | receive queue.\r | |
782 | @retval EFI_NOT_READY The receive request could not be queued because\r | |
783 | the receive queue is full.\r | |
784 | \r | |
785 | **/\r | |
786 | EFI_STATUS\r | |
787 | EFIAPI\r | |
788 | MnpReceive (\r | |
789 | IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r | |
790 | IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r | |
791 | );\r | |
792 | \r | |
793 | /**\r | |
794 | Polls for incoming data packets and processes outgoing data packets.\r | |
795 | \r | |
796 | The Poll() function can be used by network drivers and applications to\r | |
797 | increase the rate that data packets are moved between the communications\r | |
798 | device and the transmit and receive queues.\r | |
799 | Normally, a periodic timer event internally calls the Poll() function. But, in\r | |
800 | some systems, the periodic timer event may not call Poll() fast enough to\r | |
801 | transmit and/or receive all data packets without missing packets. Drivers and\r | |
802 | applications that are experiencing packet loss should try calling the Poll()\r | |
803 | function more often.\r | |
804 | \r | |
805 | @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r | |
806 | \r | |
807 | @retval EFI_SUCCESS Incoming or outgoing data was processed.\r | |
808 | @retval EFI_NOT_STARTED This MNP child driver instance has not been\r | |
809 | configured.\r | |
810 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The\r | |
811 | MNP child driver instance has been reset to startup\r | |
812 | defaults.\r | |
813 | @retval EFI_NOT_READY No incoming or outgoing data was processed. Consider\r | |
814 | increasing the polling rate.\r | |
815 | @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive\r | |
816 | queue. Consider increasing the polling rate.\r | |
817 | \r | |
818 | **/\r | |
819 | EFI_STATUS\r | |
820 | EFIAPI\r | |
821 | MnpPoll (\r | |
822 | IN EFI_MANAGED_NETWORK_PROTOCOL *This\r | |
823 | );\r | |
824 | \r | |
825 | /**\r | |
826 | Configure the Snp receive filters according to the instances' receive filter\r | |
827 | settings.\r | |
828 | \r | |
829 | @param[in] MnpDeviceData Pointer to the mnp device context data.\r | |
830 | \r | |
831 | @retval EFI_SUCCESS The receive filters is configured.\r | |
832 | @retval EFI_OUT_OF_RESOURCES The receive filters can't be configured due\r | |
833 | to lack of memory resource.\r | |
834 | \r | |
835 | **/\r | |
836 | EFI_STATUS\r | |
837 | MnpConfigReceiveFilters (\r | |
838 | IN MNP_DEVICE_DATA *MnpDeviceData\r | |
839 | );\r | |
840 | \r | |
841 | #endif\r |