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