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