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