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