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