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