]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/MnpDxe/MnpImpl.h
For network dynamic media support:
[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.<BR>
5 All rights reserved. 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 MnpTokenExist (
238 IN NET_MAP *Map,
239 IN NET_MAP_ITEM *Item,
240 IN VOID *Arg
241 );
242
243 /**
244 Cancel the token specified by Arg if it matches the token in Item.
245
246 @param[in, out] Map Pointer to the NET_MAP.
247 @param[in, out] Item Pointer to the NET_MAP_ITEM.
248 @param[in] Arg Pointer to the Arg, it's a pointer to the
249 token to cancel.
250
251 @retval EFI_SUCCESS The Arg is NULL, and the token in Item is cancelled,
252 or the Arg isn't NULL, and the token in Item is
253 different from the Arg.
254 @retval EFI_ABORTED The Arg isn't NULL, the token in Item mathces the
255 Arg, and the token is cancelled.
256
257 **/
258 EFI_STATUS
259 MnpCancelTokens (
260 IN OUT NET_MAP *Map,
261 IN OUT NET_MAP_ITEM *Item,
262 IN VOID *Arg
263 );
264
265 /**
266 Flush the instance's received data.
267
268 @param[in, out] Instance Pointer to the mnp instance context data.
269
270 **/
271 VOID
272 MnpFlushRcvdDataQueue (
273 IN OUT MNP_INSTANCE_DATA *Instance
274 );
275
276 /**
277 Configure the Instance using ConfigData.
278
279 @param[in, out] Instance Pointer to the mnp instance context data.
280 @param[in] ConfigData Pointer to the configuration data used to configure
281 the isntance.
282
283 @retval EFI_SUCCESS The Instance is configured.
284 @retval EFI_UNSUPPORTED EnableReceiveTimestamps is on and the
285 implementation doesn't support it.
286 @retval Others Other errors as indicated.
287
288 **/
289 EFI_STATUS
290 MnpConfigureInstance (
291 IN OUT MNP_INSTANCE_DATA *Instance,
292 IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL
293 );
294
295 /**
296 Do the group operations for this instance.
297
298 @param[in, out] Instance Pointer to the instance context data.
299 @param[in] JoinFlag Set to TRUE to join a group. Set to TRUE to
300 leave a group/groups.
301 @param[in] MacAddress Pointer to the group address to join or leave.
302 @param[in] CtrlBlk Pointer to the group control block if JoinFlag
303 is FALSE.
304
305 @retval EFI_SUCCESS The group operation finished.
306 @retval EFI_OUT_OF_RESOURCES Failed due to lack of memory resources.
307 @retval Others Other errors as indicated.
308
309 **/
310 EFI_STATUS
311 MnpGroupOp (
312 IN OUT MNP_INSTANCE_DATA *Instance,
313 IN BOOLEAN JoinFlag,
314 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL,
315 IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL
316 );
317
318 /**
319 Validates the Mnp transmit token.
320
321 @param[in] Instance Pointer to the Mnp instance context data.
322 @param[in] Token Pointer to the transmit token to check.
323
324 @return The Token is valid or not.
325
326 **/
327 BOOLEAN
328 MnpIsValidTxToken (
329 IN MNP_INSTANCE_DATA *Instance,
330 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
331 );
332
333 /**
334 Build the packet to transmit from the TxData passed in.
335
336 @param[in] MnpServiceData Pointer to the mnp service context data.
337 @param[in] TxData Pointer to the transmit data containing the information
338 to build the packet.
339 @param[out] PktBuf Pointer to record the address of the packet.
340 @param[out] PktLen Pointer to a UINT32 variable used to record the packet's
341 length.
342
343 **/
344 VOID
345 MnpBuildTxPacket (
346 IN MNP_SERVICE_DATA *MnpServiceData,
347 IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,
348 OUT UINT8 **PktBuf,
349 OUT UINT32 *PktLen
350 );
351
352 /**
353 Synchronously send out the packet.
354
355 @param[in] MnpServiceData Pointer to the mnp service context data.
356 @param[in] Packet Pointer to the pakcet buffer.
357 @param[in] Length The length of the packet.
358 @param[in, out] Token Pointer to the token the packet generated from.
359
360 @retval EFI_SUCCESS The packet is sent out.
361 @retval EFI_TIMEOUT Time out occurs, the packet isn't sent.
362 @retval EFI_DEVICE_ERROR An unexpected network error occurs.
363
364 **/
365 EFI_STATUS
366 MnpSyncSendPacket (
367 IN MNP_SERVICE_DATA *MnpServiceData,
368 IN UINT8 *Packet,
369 IN UINT32 Length,
370 IN OUT EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
371 );
372
373 /**
374 Try to deliver the received packet to the instance.
375
376 @param[in, out] Instance Pointer to the mnp instance context data.
377
378 @retval EFI_SUCCESS The received packet is delivered, or there is no
379 packet to deliver, or there is no available receive
380 token.
381 @retval EFI_OUT_OF_RESOURCES The deliver fails due to lack of memory resource.
382
383 **/
384 EFI_STATUS
385 MnpInstanceDeliverPacket (
386 IN OUT MNP_INSTANCE_DATA *Instance
387 );
388
389 /**
390 Recycle the RxData and other resources used to hold and deliver the received
391 packet.
392
393 @param[in] Event The event this notify function registered to.
394 @param[in] Context Pointer to the context data registerd to the Event.
395
396 **/
397 VOID
398 EFIAPI
399 MnpRecycleRxData (
400 IN EFI_EVENT Event,
401 IN VOID *Context
402 );
403
404 /**
405 Try to receive a packet and deliver it.
406
407 @param[in, out] MnpDeviceData Pointer to the mnp device context data.
408
409 @retval EFI_SUCCESS add return value to function comment
410 @retval EFI_NOT_STARTED The simple network protocol is not started.
411 @retval EFI_NOT_READY No packet received.
412 @retval EFI_DEVICE_ERROR An unexpected error occurs.
413
414 **/
415 EFI_STATUS
416 MnpReceivePacket (
417 IN OUT MNP_DEVICE_DATA *MnpDeviceData
418 );
419
420 /**
421 Allocate a free NET_BUF from MnpDeviceData->FreeNbufQue. If there is none
422 in the queue, first try to allocate some and add them into the queue, then
423 fetch the NET_BUF from the updated FreeNbufQue.
424
425 @param[in, out] MnpDeviceData Pointer to the MNP_DEVICE_DATA.
426
427 @return Pointer to the allocated free NET_BUF structure, if NULL the
428 operation is failed.
429
430 **/
431 NET_BUF *
432 MnpAllocNbuf (
433 IN OUT MNP_DEVICE_DATA *MnpDeviceData
434 );
435
436 /**
437 Try to reclaim the Nbuf into the buffer pool.
438
439 @param[in, out] MnpDeviceData Pointer to the mnp device context data.
440 @param[in, out] Nbuf Pointer to the NET_BUF to free.
441
442 **/
443 VOID
444 MnpFreeNbuf (
445 IN OUT MNP_DEVICE_DATA *MnpDeviceData,
446 IN OUT NET_BUF *Nbuf
447 );
448
449 /**
450 Remove the received packets if timeout occurs.
451
452 @param[in] Event The event this notify function registered to.
453 @param[in] Context Pointer to the context data registered to the event.
454
455 **/
456 VOID
457 EFIAPI
458 MnpCheckPacketTimeout (
459 IN EFI_EVENT Event,
460 IN VOID *Context
461 );
462
463 /**
464 Poll to update MediaPresent field in SNP ModeData by Snp.GetStatus().
465
466 @param[in] Event The event this notify function registered to.
467 @param[in] Context Pointer to the context data registered to the event.
468
469 **/
470 VOID
471 EFIAPI
472 MnpCheckMediaStatus (
473 IN EFI_EVENT Event,
474 IN VOID *Context
475 );
476
477 /**
478 Poll to receive the packets from Snp. This function is either called by upperlayer
479 protocols/applications or the system poll timer notify mechanism.
480
481 @param[in] Event The event this notify function registered to.
482 @param[in] Context Pointer to the context data registered to the event.
483
484 **/
485 VOID
486 EFIAPI
487 MnpSystemPoll (
488 IN EFI_EVENT Event,
489 IN VOID *Context
490 );
491
492 /**
493 Returns the operational parameters for the current MNP child driver. May also
494 support returning the underlying SNP driver mode data.
495
496 The GetModeData() function is used to read the current mode data (operational
497 parameters) from the MNP or the underlying SNP.
498
499 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
500 @param[out] MnpConfigData Pointer to storage for MNP operational parameters. Type
501 EFI_MANAGED_NETWORK_CONFIG_DATA is defined in "Related
502 Definitions" below.
503 @param[out] SnpModeData Pointer to storage for SNP operational parameters. This
504 feature may be unsupported. Type EFI_SIMPLE_NETWORK_MODE
505 is defined in the EFI_SIMPLE_NETWORK_PROTOCOL.
506
507 @retval EFI_SUCCESS The operation completed successfully.
508 @retval EFI_INVALID_PARAMETER This is NULL.
509 @retval EFI_UNSUPPORTED The requested feature is unsupported in this
510 MNP implementation.
511 @retval EFI_NOT_STARTED This MNP child driver instance has not been
512 configured. The default values are returned in
513 MnpConfigData if it is not NULL.
514 @retval Others The mode data could not be read.
515
516 **/
517 EFI_STATUS
518 EFIAPI
519 MnpGetModeData (
520 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
521 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
522 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
523 );
524
525 /**
526 Sets or clears the operational parameters for the MNP child driver.
527
528 The Configure() function is used to set, change, or reset the operational
529 parameters for the MNP child driver instance. Until the operational parameters
530 have been set, no network traffic can be sent or received by this MNP child
531 driver instance. Once the operational parameters have been reset, no more
532 traffic can be sent or received until the operational parameters have been set
533 again.
534 Each MNP child driver instance can be started and stopped independently of
535 each other by setting or resetting their receive filter settings with the
536 Configure() function.
537 After any successful call to Configure(), the MNP child driver instance is
538 started. The internal periodic timer (if supported) is enabled. Data can be
539 transmitted and may be received if the receive filters have also been enabled.
540 Note: If multiple MNP child driver instances will receive the same packet
541 because of overlapping receive filter settings, then the first MNP child
542 driver instance will receive the original packet and additional instances will
543 receive copies of the original packet.
544 Note: Warning: Receive filter settings that overlap will consume extra
545 processor and/or DMA resources and degrade system and network performance.
546
547 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
548 @param[in] MnpConfigData Pointer to configuration data that will be assigned
549 to the MNP child driver instance. If NULL, the MNP
550 child driver instance is reset to startup defaults
551 and all pending transmit and receive requests are
552 flushed. Type EFI_MANAGED_NETWORK_CONFIG_DATA is
553 defined in EFI_MANAGED_NETWORK_PROTOCOL.GetModeData().
554
555 @retval EFI_SUCCESS The operation completed successfully.
556 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
557 TRUE:
558 * This is NULL.
559 * MnpConfigData.ProtocolTypeFilter is not
560 valid.
561 The operational data for the MNP child driver
562 instance is unchanged.
563 @retval EFI_OUT_OF_RESOURCES Required system resources (usually memory)
564 could not be allocated.
565 The MNP child driver instance has been reset to
566 startup defaults.
567 @retval EFI_UNSUPPORTED The requested feature is unsupported in
568 this [MNP] implementation. The operational data
569 for the MNP child driver instance is unchanged.
570 @retval EFI_DEVICE_ERROR An unexpected network or system error
571 occurred. The MNP child driver instance has
572 been reset to startup defaults.
573 @retval Others The MNP child driver instance has been reset to
574 startup defaults.
575
576 **/
577 EFI_STATUS
578 EFIAPI
579 MnpConfigure (
580 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
581 IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL
582 );
583
584 /**
585 Translates an IP multicast address to a hardware (MAC) multicast address. This
586 function may be unsupported in some MNP implementations.
587
588 The McastIpToMac() function translates an IP multicast address to a hardware
589 (MAC) multicast address. This function may be implemented by calling the
590 underlying EFI_SIMPLE_NETWORK. MCastIpToMac() function, which may also be
591 unsupported in some MNP implementations.
592
593 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
594 @param[in] Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address.
595 Set to FALSE if IpAddress is an IPv4 multicast address.
596 @param[in] IpAddress Pointer to the multicast IP address (in network byte
597 order) to convert.
598 @param[out] MacAddress Pointer to the resulting multicast MAC address.
599
600 @retval EFI_SUCCESS The operation completed successfully.
601 @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:
602 * This is NULL.
603 * IpAddress is NULL.
604 * IpAddress is not a valid multicast IP
605 address.
606 * MacAddress is NULL.
607 @retval EFI_NOT_STARTED This MNP child driver instance has not been
608 configured.
609 @retval EFI_UNSUPPORTED The requested feature is unsupported in this
610 MNP implementation.
611 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
612 @retval Others The address could not be converted.
613 **/
614 EFI_STATUS
615 EFIAPI
616 MnpMcastIpToMac (
617 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
618 IN BOOLEAN Ipv6Flag,
619 IN EFI_IP_ADDRESS *IpAddress,
620 OUT EFI_MAC_ADDRESS *MacAddress
621 );
622
623 /**
624 Enables and disables receive filters for multicast address. This function may
625 be unsupported in some MNP implementations.
626
627 The Groups() function only adds and removes multicast MAC addresses from the
628 filter list. The MNP driver does not transmit or process Internet Group
629 Management Protocol (IGMP) packets. If JoinFlag is FALSE and MacAddress is
630 NULL, then all joined groups are left.
631
632 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
633 @param[in] JoinFlag Set to TRUE to join this multicast group.
634 Set to FALSE to leave this multicast group.
635 @param[in] MacAddress Pointer to the multicast MAC group (address) to join or
636 leave.
637
638 @retval EFI_SUCCESS The requested operation completed successfully.
639 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
640 * This is NULL.
641 * JoinFlag is TRUE and MacAddress is NULL.
642 * MacAddress is not a valid multicast MAC
643 address.
644 * The MNP multicast group settings are
645 unchanged.
646 @retval EFI_NOT_STARTED This MNP child driver instance has not been
647 configured.
648 @retval EFI_ALREADY_STARTED The supplied multicast group is already joined.
649 @retval EFI_NOT_FOUND The supplied multicast group is not joined.
650 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
651 The MNP child driver instance has been reset to
652 startup defaults.
653 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP
654 implementation.
655 @retval Others The requested operation could not be completed.
656 The MNP multicast group settings are unchanged.
657
658 **/
659 EFI_STATUS
660 EFIAPI
661 MnpGroups (
662 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
663 IN BOOLEAN JoinFlag,
664 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL
665 );
666
667 /**
668 Places asynchronous outgoing data packets into the transmit queue.
669
670 The Transmit() function places a completion token into the transmit packet
671 queue. This function is always asynchronous.
672 The caller must fill in the Token.Event and Token.TxData fields in the
673 completion token, and these fields cannot be NULL. When the transmit operation
674 completes, the MNP updates the Token.Status field and the Token.Event is
675 signaled.
676 Note: There may be a performance penalty if the packet needs to be
677 defragmented before it can be transmitted by the network device. Systems in
678 which performance is critical should review the requirements and features of
679 the underlying communications device and drivers.
680
681
682 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
683 @param[in] Token Pointer to a token associated with the transmit data
684 descriptor. Type EFI_MANAGED_NETWORK_COMPLETION_TOKEN
685 is defined in "Related Definitions" below.
686
687 @retval EFI_SUCCESS The transmit completion token was cached.
688 @retval EFI_NOT_STARTED This MNP child driver instance has not been
689 configured.
690 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
691 TRUE:
692 * This is NULL.
693 * Token is NULL.
694 * Token.Event is NULL.
695 * Token.TxData is NULL.
696 * Token.TxData.DestinationAddress is not
697 NULL and Token.TxData.HeaderLength is zero.
698 * Token.TxData.FragmentCount is zero.
699 * (Token.TxData.HeaderLength +
700 Token.TxData.DataLength) is not equal to the
701 sum of the
702 Token.TxData.FragmentTable[].FragmentLength
703 fields.
704 * One or more of the
705 Token.TxData.FragmentTable[].FragmentLength
706 fields is zero.
707 * One or more of the
708 Token.TxData.FragmentTable[].FragmentBufferfields
709 is NULL.
710 * Token.TxData.DataLength is greater than MTU.
711 @retval EFI_ACCESS_DENIED The transmit completion token is already in the
712 transmit queue.
713 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a
714 lack of system resources (usually memory).
715 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
716 The MNP child driver instance has been reset to
717 startup defaults.
718 @retval EFI_NOT_READY The transmit request could not be queued because
719 the transmit queue is full.
720
721 **/
722 EFI_STATUS
723 EFIAPI
724 MnpTransmit (
725 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
726 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
727 );
728
729 /**
730 Aborts an asynchronous transmit or receive request.
731
732 The Cancel() function is used to abort a pending transmit or receive request.
733 If the token is in the transmit or receive request queues, after calling this
734 function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
735 signaled. If the token is not in one of the queues, which usually means that
736 the asynchronous operation has completed, this function will not signal the
737 token and EFI_NOT_FOUND is returned.
738
739 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
740 @param[in] Token Pointer to a token that has been issued by
741 EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or
742 EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If NULL, all
743 pending tokens are aborted.
744
745 @retval EFI_SUCCESS The asynchronous I/O request was aborted and
746 Token.Event was signaled. When Token is NULL,
747 all pending requests were aborted and their
748 events were signaled.
749 @retval EFI_NOT_STARTED This MNP child driver instance has not been
750 configured.
751 @retval EFI_INVALID_PARAMETER This is NULL.
752 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O
753 request was not found in the transmit or
754 receive queue. It has either completed or was
755 not issued by Transmit() and Receive().
756
757 **/
758 EFI_STATUS
759 EFIAPI
760 MnpCancel (
761 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
762 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL
763 );
764
765 /**
766 Places an asynchronous receiving request into the receiving queue.
767
768 The Receive() function places a completion token into the receive packet
769 queue. This function is always asynchronous.
770 The caller must fill in the Token.Event field in the completion token, and
771 this field cannot be NULL. When the receive operation completes, the MNP
772 updates the Token.Status and Token.RxData fields and the Token.Event is
773 signaled.
774
775 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
776 @param[in] Token Pointer to a token associated with the receive
777 data descriptor. Type
778 EFI_MANAGED_NETWORK_COMPLETION_TOKEN is defined in
779 EFI_MANAGED_NETWORK_PROTOCOL.Transmit().
780
781 @retval EFI_SUCCESS The receive completion token was cached.
782 @retval EFI_NOT_STARTED This MNP child driver instance has not been
783 configured.
784 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
785 TRUE:
786 * This is NULL.
787 * Token is NULL.
788 * Token.Event is NULL
789 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a
790 lack of system resources (usually memory).
791 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
792 The MNP child driver instance has been reset to
793 startup defaults.
794 @retval EFI_ACCESS_DENIED The receive completion token was already in the
795 receive queue.
796 @retval EFI_NOT_READY The receive request could not be queued because
797 the receive queue is full.
798
799 **/
800 EFI_STATUS
801 EFIAPI
802 MnpReceive (
803 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
804 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
805 );
806
807 /**
808 Polls for incoming data packets and processes outgoing data packets.
809
810 The Poll() function can be used by network drivers and applications to
811 increase the rate that data packets are moved between the communications
812 device and the transmit and receive queues.
813 Normally, a periodic timer event internally calls the Poll() function. But, in
814 some systems, the periodic timer event may not call Poll() fast enough to
815 transmit and/or receive all data packets without missing packets. Drivers and
816 applications that are experiencing packet loss should try calling the Poll()
817 function more often.
818
819 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
820
821 @retval EFI_SUCCESS Incoming or outgoing data was processed.
822 @retval EFI_NOT_STARTED This MNP child driver instance has not been
823 configured.
824 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
825 MNP child driver instance has been reset to startup
826 defaults.
827 @retval EFI_NOT_READY No incoming or outgoing data was processed. Consider
828 increasing the polling rate.
829 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
830 queue. Consider increasing the polling rate.
831
832 **/
833 EFI_STATUS
834 EFIAPI
835 MnpPoll (
836 IN EFI_MANAGED_NETWORK_PROTOCOL *This
837 );
838
839 /**
840 Configure the Snp receive filters according to the instances' receive filter
841 settings.
842
843 @param[in] MnpDeviceData Pointer to the mnp device context data.
844
845 @retval EFI_SUCCESS The receive filters is configured.
846 @retval EFI_OUT_OF_RESOURCES The receive filters can't be configured due
847 to lack of memory resource.
848
849 **/
850 EFI_STATUS
851 MnpConfigReceiveFilters (
852 IN MNP_DEVICE_DATA *MnpDeviceData
853 );
854
855 #endif