]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/Ip6Dxe/Ip6Impl.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / Ip6Impl.h
1 /** @file
2 Implementation of EFI_IP6_PROTOCOL protocol interfaces and type definitions.
3
4 Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #ifndef __EFI_IP6_IMPL_H__
12 #define __EFI_IP6_IMPL_H__
13
14 #include <Uefi.h>
15
16 #include <IndustryStandard/Dhcp.h>
17
18 #include <Protocol/ServiceBinding.h>
19 #include <Protocol/ManagedNetwork.h>
20 #include <Protocol/IpSec.h>
21 #include <Protocol/Ip6.h>
22 #include <Protocol/Ip6Config.h>
23 #include <Protocol/Dhcp6.h>
24 #include <Protocol/DevicePath.h>
25 #include <Protocol/HiiConfigRouting.h>
26 #include <Protocol/HiiConfigAccess.h>
27
28 #include <Library/DebugLib.h>
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/UefiRuntimeServicesTableLib.h>
31 #include <Library/BaseLib.h>
32 #include <Library/UefiLib.h>
33 #include <Library/NetLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/MemoryAllocationLib.h>
36 #include <Library/DpcLib.h>
37 #include <Library/HiiLib.h>
38 #include <Library/UefiHiiServicesLib.h>
39 #include <Library/DevicePathLib.h>
40 #include <Library/PrintLib.h>
41
42 #include <Guid/MdeModuleHii.h>
43
44 #include "Ip6Common.h"
45 #include "Ip6Driver.h"
46 #include "Ip6Icmp.h"
47 #include "Ip6If.h"
48 #include "Ip6Input.h"
49 #include "Ip6Mld.h"
50 #include "Ip6Nd.h"
51 #include "Ip6Option.h"
52 #include "Ip6Output.h"
53 #include "Ip6Route.h"
54 #include "Ip6ConfigNv.h"
55 #include "Ip6ConfigImpl.h"
56
57 #define IP6_PROTOCOL_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'P')
58 #define IP6_SERVICE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'S')
59
60 //
61 // The state of IP6 protocol. It starts from UNCONFIGED. if it is
62 // successfully configured, it goes to CONFIGED. if configure NULL
63 // is called, it becomes UNCONFIGED again. If (partly) destroyed, it
64 // becomes DESTROY.
65 //
66 #define IP6_STATE_UNCONFIGED 0
67 #define IP6_STATE_CONFIGED 1
68
69 //
70 // The state of IP6 service. It starts from UNSTARTED. It transits
71 // to STARTED if autoconfigure is started. If default address is
72 // configured, it becomes CONFIGED. and if partly destroyed, it goes
73 // to DESTROY.
74 //
75 #define IP6_SERVICE_UNSTARTED 0
76 #define IP6_SERVICE_STARTED 1
77 #define IP6_SERVICE_CONFIGED 2
78 #define IP6_SERVICE_DESTROY 3
79
80 #define IP6_INSTANCE_FROM_PROTOCOL(Ip6) \
81 CR ((Ip6), IP6_PROTOCOL, Ip6Proto, IP6_PROTOCOL_SIGNATURE)
82
83 #define IP6_SERVICE_FROM_PROTOCOL(Sb) \
84 CR ((Sb), IP6_SERVICE, ServiceBinding, IP6_SERVICE_SIGNATURE)
85
86 #define IP6_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
87
88 extern EFI_IPSEC2_PROTOCOL *mIpSec;
89 extern BOOLEAN mIpSec2Installed;
90
91 //
92 // IP6_TXTOKEN_WRAP wraps the upper layer's transmit token.
93 // The user's data is kept in the Packet. When fragment is
94 // needed, each fragment of the Packet has a reference to the
95 // Packet, no data is actually copied. The Packet will be
96 // released when all the fragments of it have been recycled by
97 // MNP. Upon then, the IP6_TXTOKEN_WRAP will be released, and
98 // user's event signalled.
99 //
100 typedef struct {
101 IP6_PROTOCOL *IpInstance;
102 EFI_IP6_COMPLETION_TOKEN *Token;
103 EFI_EVENT IpSecRecycleSignal;
104 NET_BUF *Packet;
105 BOOLEAN Sent;
106 INTN Life;
107 } IP6_TXTOKEN_WRAP;
108
109 typedef struct {
110 EFI_EVENT IpSecRecycleSignal;
111 NET_BUF *Packet;
112 } IP6_IPSEC_WRAP;
113
114 //
115 // IP6_RXDATA_WRAP wraps the data IP6 child delivers to the
116 // upper layers. The received packet is kept in the Packet.
117 // The Packet itself may be constructured from some fragments.
118 // All the fragments of the Packet is organized by a
119 // IP6_ASSEMBLE_ENTRY structure. If the Packet is recycled by
120 // the upper layer, the assemble entry and its associated
121 // fragments will be freed at last.
122 //
123 typedef struct {
124 LIST_ENTRY Link;
125 IP6_PROTOCOL *IpInstance;
126 NET_BUF *Packet;
127 EFI_IP6_RECEIVE_DATA RxData;
128 } IP6_RXDATA_WRAP;
129
130 struct _IP6_PROTOCOL {
131 UINT32 Signature;
132
133 EFI_IP6_PROTOCOL Ip6Proto;
134 EFI_HANDLE Handle;
135 INTN State;
136
137 IP6_SERVICE *Service;
138 LIST_ENTRY Link; // Link to all the IP protocol from the service
139
140 UINT8 PrefixLength; // PrefixLength of the configured station address.
141 //
142 // User's transmit/receive tokens, and received/delivered packets
143 //
144 NET_MAP RxTokens;
145 NET_MAP TxTokens; // map between (User's Token, IP6_TXTOKE_WRAP)
146 LIST_ENTRY Received; // Received but not delivered packet
147 LIST_ENTRY Delivered; // Delivered and to be recycled packets
148 EFI_LOCK RecycleLock;
149
150 IP6_INTERFACE *Interface;
151 LIST_ENTRY AddrLink; // Ip instances with the same IP address.
152
153 EFI_IPv6_ADDRESS *GroupList; // stored in network order.
154 UINT32 GroupCount;
155
156 EFI_IP6_CONFIG_DATA ConfigData;
157 BOOLEAN InDestroy;
158 };
159
160 struct _IP6_SERVICE {
161 UINT32 Signature;
162 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
163 INTN State;
164
165 //
166 // List of all the IP instances and interfaces, and default
167 // interface and route table and caches.
168 //
169 UINTN NumChildren;
170 LIST_ENTRY Children;
171
172 LIST_ENTRY Interfaces;
173
174 IP6_INTERFACE *DefaultInterface;
175 IP6_ROUTE_TABLE *RouteTable;
176
177 IP6_LINK_RX_TOKEN RecvRequest;
178
179 //
180 // Ip reassemble utilities and MLD data
181 //
182 IP6_ASSEMBLE_TABLE Assemble;
183 IP6_MLD_SERVICE_DATA MldCtrl;
184
185 EFI_IPv6_ADDRESS LinkLocalAddr;
186 BOOLEAN LinkLocalOk;
187 BOOLEAN LinkLocalDadFail;
188 BOOLEAN Dhcp6NeedStart;
189 BOOLEAN Dhcp6NeedInfoRequest;
190
191 //
192 // ND data
193 //
194 UINT8 CurHopLimit;
195 UINT32 LinkMTU;
196 UINT32 BaseReachableTime;
197 UINT32 ReachableTime;
198 UINT32 RetransTimer;
199 LIST_ENTRY NeighborTable;
200
201 LIST_ENTRY OnlinkPrefix;
202 LIST_ENTRY AutonomousPrefix;
203
204 LIST_ENTRY DefaultRouterList;
205 UINT32 RoundRobin;
206
207 UINT8 InterfaceIdLen;
208 UINT8 *InterfaceId;
209
210 BOOLEAN RouterAdvertiseReceived;
211 UINT8 SolicitTimer;
212 UINT32 Ticks;
213
214 //
215 // Low level protocol used by this service instance
216 //
217 EFI_HANDLE Image;
218 EFI_HANDLE Controller;
219
220 EFI_HANDLE MnpChildHandle;
221 EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
222
223 EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
224 EFI_SIMPLE_NETWORK_MODE SnpMode;
225
226 EFI_EVENT Timer;
227 EFI_EVENT FasterTimer;
228
229 //
230 // IPv6 Configuration Protocol instance
231 //
232 IP6_CONFIG_INSTANCE Ip6ConfigInstance;
233
234 //
235 // The string representation of the current mac address of the
236 // NIC this IP6_SERVICE works on.
237 //
238 CHAR16 *MacString;
239 UINT32 MaxPacketSize;
240 UINT32 OldMaxPacketSize;
241 };
242
243 /**
244 The callback function for the net buffer which wraps the user's
245 transmit token. Although this function seems simple,
246 there are some subtle aspects.
247 When a user requests the IP to transmit a packet by passing it a
248 token, the token is wrapped in an IP6_TXTOKEN_WRAP and the data
249 is wrapped in a net buffer. The net buffer's Free function is
250 set to Ip6FreeTxToken. The Token and token wrap are added to the
251 IP child's TxToken map. Then the buffer is passed to Ip6Output for
252 transmission. If an error occurs before that, the buffer
253 is freed, which in turn frees the token wrap. The wrap may
254 have been added to the TxToken map or not, and the user's event
255 shouldn't be signaled because we are still in the EfiIp6Transmit. If
256 the buffer has been sent by Ip6Output, it should be removed from
257 the TxToken map and the user's event signaled. The token wrap and buffer
258 are bound together. Refer to the comments in Ip6Output for information
259 about IP fragmentation.
260
261 @param[in] Context The token's wrap.
262
263 **/
264 VOID
265 EFIAPI
266 Ip6FreeTxToken (
267 IN VOID *Context
268 );
269
270 /**
271 Config the MNP parameter used by IP. The IP driver use one MNP
272 child to transmit/receive frames. By default, it configures MNP
273 to receive unicast/multicast/broadcast. And it will enable/disable
274 the promiscuous receive according to whether there is IP child
275 enable that or not. If Force is FALSE, it will iterate through
276 all the IP children to check whether the promiscuous receive
277 setting has been changed. If it hasn't been changed, it won't
278 reconfigure the MNP. If Force is TRUE, the MNP is configured
279 whether that is changed or not.
280
281 @param[in] IpSb The IP6 service instance that is to be changed.
282 @param[in] Force Force the configuration or not.
283
284 @retval EFI_SUCCESS The MNP successfully configured/reconfigured.
285 @retval Others The configuration failed.
286
287 **/
288 EFI_STATUS
289 Ip6ServiceConfigMnp (
290 IN IP6_SERVICE *IpSb,
291 IN BOOLEAN Force
292 );
293
294 /**
295 Cancel the user's receive/transmit request. It is the worker function of
296 EfiIp6Cancel API.
297
298 @param[in] IpInstance The IP6 child.
299 @param[in] Token The token to cancel. If NULL, all tokens will be
300 cancelled.
301
302 @retval EFI_SUCCESS The token was cancelled.
303 @retval EFI_NOT_FOUND The token isn't found on either the
304 transmit or receive queue.
305 @retval EFI_DEVICE_ERROR Not all tokens are cancelled when Token is NULL.
306
307 **/
308 EFI_STATUS
309 Ip6Cancel (
310 IN IP6_PROTOCOL *IpInstance,
311 IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
312 );
313
314 /**
315 Initialize the IP6_PROTOCOL structure to the unconfigured states.
316
317 @param[in] IpSb The IP6 service instance.
318 @param[in, out] IpInstance The IP6 child instance.
319
320 **/
321 VOID
322 Ip6InitProtocol (
323 IN IP6_SERVICE *IpSb,
324 IN OUT IP6_PROTOCOL *IpInstance
325 );
326
327 /**
328 Clean up the IP6 child, release all the resources used by it.
329
330 @param[in, out] IpInstance The IP6 child to clean up.
331
332 @retval EFI_SUCCESS The IP6 child was cleaned up
333 @retval EFI_DEVICE_ERROR Some resources failed to be released.
334
335 **/
336 EFI_STATUS
337 Ip6CleanProtocol (
338 IN OUT IP6_PROTOCOL *IpInstance
339 );
340
341 //
342 // EFI_IP6_PROTOCOL interface prototypes
343 //
344
345 /**
346 Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.
347
348 The GetModeData() function returns the current operational mode data for this driver instance.
349 The data fields in EFI_IP6_MODE_DATA are read only. This function is used optionally to
350 retrieve the operational mode data of underlying networks or drivers.
351
352 @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
353 @param[out] Ip6ModeData The pointer to the EFI IPv6 Protocol mode data structure.
354 @param[out] MnpConfigData The pointer to the managed network configuration data structure.
355 @param[out] SnpModeData The pointer to the simple network mode data structure.
356
357 @retval EFI_SUCCESS The operation completed successfully.
358 @retval EFI_INVALID_PARAMETER This is NULL.
359 @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
360
361 **/
362 EFI_STATUS
363 EFIAPI
364 EfiIp6GetModeData (
365 IN EFI_IP6_PROTOCOL *This,
366 OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
367 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
368 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
369 );
370
371 /**
372 Assigns an IPv6 address and subnet mask to this EFI IPv6 Protocol driver instance.
373
374 The Configure() function is used to set, change, or reset the operational parameters and filter
375 settings for this EFI IPv6 Protocol instance. Until these parameters have been set, no network traffic
376 can be sent or received by this instance. Once the parameters have been reset (by calling this
377 function with Ip6ConfigData set to NULL), no more traffic can be sent or received until these
378 parameters have been set again. Each EFI IPv6 Protocol instance can be started and stopped
379 independently of each other by enabling or disabling their receive filter settings with the
380 Configure() function.
381
382 If Ip6ConfigData.StationAddress is a valid non-zero IPv6 unicast address, it is required
383 to be one of the currently configured IPv6 addresses list in the EFI IPv6 drivers, or else
384 EFI_INVALID_PARAMETER will be returned. If Ip6ConfigData.StationAddress is
385 unspecified, the IPv6 driver will bind a source address according to the source address selection
386 algorithm. Clients could frequently call GetModeData() to check get a currently configured IPv6.
387 If both Ip6ConfigData.StationAddress and Ip6ConfigData.Destination are unspecified, when
388 transmitting the packet afterwards, the source address filled in each outgoing IPv6 packet
389 is decided based on the destination of this packet.
390
391 If operational parameters are reset or changed, any pending transmit and receive requests will be
392 cancelled. Their completion token status will be set to EFI_ABORTED, and their events will be
393 signaled.
394
395 @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
396 @param[in] Ip6ConfigData The pointer to the EFI IPv6 Protocol configuration data structure.
397 If NULL, reset the configuration data.
398
399 @retval EFI_SUCCESS The driver instance was successfully opened.
400 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
401 - This is NULL.
402 - Ip6ConfigData.StationAddress is neither zero nor
403 a unicast IPv6 address.
404 - Ip6ConfigData.StationAddress is neither zero nor
405 one of the configured IP addresses in the EFI IPv6 driver.
406 - Ip6ConfigData.DefaultProtocol is illegal.
407 @retval EFI_OUT_OF_RESOURCES The EFI IPv6 Protocol driver instance data could not be allocated.
408 @retval EFI_NO_MAPPING The IPv6 driver was responsible for choosing a source address for
409 this instance, but no source address was available for use.
410 @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the IPv6
411 address or prefix length can be changed.
412 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv6
413 Protocol driver instance was not opened.
414 @retval EFI_UNSUPPORTED Default protocol specified through
415 Ip6ConfigData.DefaultProtocol isn't supported.
416
417 **/
418 EFI_STATUS
419 EFIAPI
420 EfiIp6Configure (
421 IN EFI_IP6_PROTOCOL *This,
422 IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL
423 );
424
425 /**
426 Joins and leaves multicast groups.
427
428 The Groups() function is used to join and leave multicast group sessions. Joining a group will
429 enable reception of matching multicast packets. Leaving a group will disable reception of matching
430 multicast packets. Source-Specific Multicast isn't required to be supported.
431
432 If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.
433
434 @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
435 @param[in] JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
436 @param[in] GroupAddress The pointer to the IPv6 multicast address.
437 This is an optional parameter that may be NULL.
438
439 @retval EFI_SUCCESS The operation completed successfully.
440 @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
441 - This is NULL.
442 - JoinFlag is TRUE and GroupAddress is NULL.
443 - GroupAddress is not NULL and *GroupAddress is
444 not a multicast IPv6 address.
445 - GroupAddress is not NULL and *GroupAddress is in the
446 range of SSM destination address.
447 @retval EFI_NOT_STARTED This instance has not been started.
448 @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
449 @retval EFI_UNSUPPORTED This EFI IPv6 Protocol implementation does not support multicast groups.
450 @retval EFI_ALREADY_STARTED The group address is already in the group table (when
451 JoinFlag is TRUE).
452 @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
453 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
454
455 **/
456 EFI_STATUS
457 EFIAPI
458 EfiIp6Groups (
459 IN EFI_IP6_PROTOCOL *This,
460 IN BOOLEAN JoinFlag,
461 IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL
462 );
463
464 /**
465 Adds and deletes routing table entries.
466
467 The Routes() function adds a route to or deletes a route from the routing table.
468
469 Routes are determined by comparing the leftmost PrefixLength bits of Destination with
470 the destination IPv6 address arithmetically. The gateway address must be on the same subnet as the
471 configured station address.
472
473 The default route is added with Destination and PrefixLength both set to all zeros. The
474 default route matches all destination IPv6 addresses that do not match any other routes.
475
476 All EFI IPv6 Protocol instances share a routing table.
477
478 @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
479 @param[in] DeleteRoute Set to TRUE to delete this route from the routing table. Set to
480 FALSE to add this route to the routing table. Destination,
481 PrefixLength and Gateway are used as the key to each
482 route entry.
483 @param[in] Destination The address prefix of the subnet that needs to be routed.
484 This is an optional parameter that may be NULL.
485 @param[in] PrefixLength The prefix length of Destination. Ignored if Destination
486 is NULL.
487 @param[in] GatewayAddress The unicast gateway IPv6 address for this route.
488 This is an optional parameter that may be NULL.
489
490 @retval EFI_SUCCESS The operation completed successfully.
491 @retval EFI_NOT_STARTED The driver instance has not been started.
492 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
493 - This is NULL.
494 - When DeleteRoute is TRUE, both Destination and
495 GatewayAddress are NULL.
496 - When DeleteRoute is FALSE, either Destination or
497 GatewayAddress is NULL.
498 - *GatewayAddress is not a valid unicast IPv6 address.
499 - *GatewayAddress is one of the local configured IPv6
500 addresses.
501 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
502 @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
503 @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
504 DeleteRoute is FALSE).
505
506 **/
507 EFI_STATUS
508 EFIAPI
509 EfiIp6Routes (
510 IN EFI_IP6_PROTOCOL *This,
511 IN BOOLEAN DeleteRoute,
512 IN EFI_IPv6_ADDRESS *Destination OPTIONAL,
513 IN UINT8 PrefixLength,
514 IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL
515 );
516
517 /**
518 Add or delete Neighbor cache entries.
519
520 The Neighbors() function is used to add, update, or delete an entry from a neighbor cache.
521 IPv6 neighbor cache entries are typically inserted and updated by the network protocol driver as
522 network traffic is processed. Most neighbor cache entries will timeout and be deleted if the network
523 traffic stops. Neighbor cache entries that were inserted by Neighbors() may be static (will not
524 timeout) or dynamic (will timeout).
525
526 The implementation should follow the neighbor cache timeout mechanism defined in
527 RFC4861. The default neighbor cache timeout value should be tuned for the expected network
528 environment.
529
530 @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
531 @param[in] DeleteFlag Set to TRUE to delete the specified cache entry. Set to FALSE to
532 add (or update, if it already exists and Override is TRUE) the
533 specified cache entry. TargetIp6Address is used as the key
534 to find the requested cache entry.
535 @param[in] TargetIp6Address The pointer to the Target IPv6 address.
536 @param[in] TargetLinkAddress The pointer to link-layer address of the target. Ignored if NULL.
537 @param[in] Timeout Time in 100-ns units that this entry will remain in the neighbor
538 cache, it will be deleted after Timeout. A value of zero means that
539 the entry is permanent. A non-zero value means that the entry is
540 dynamic.
541 @param[in] Override If TRUE, the cached link-layer address of the matching entry will
542 be overridden and updated; if FALSE, EFI_ACCESS_DENIED
543 will be returned if a corresponding cache entry already exists.
544
545 @retval EFI_SUCCESS The data has been queued for transmission.
546 @retval EFI_NOT_STARTED This instance has not been started.
547 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
548 - This is NULL.
549 - TargetIpAddress is NULL.
550 - *TargetLinkAddress is invalid when not NULL.
551 - *TargetIpAddress is not a valid unicast IPv6 address.
552 - *TargetIpAddress is one of the local configured IPv6
553 addresses.
554 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the neighbor cache.
555 @retval EFI_NOT_FOUND This entry is not in the neighbor cache (when DeleteFlag is
556 TRUE or when DeleteFlag is FALSE while
557 TargetLinkAddress is NULL.).
558 @retval EFI_ACCESS_DENIED The to-be-added entry is already defined in the neighbor cache,
559 and that entry is tagged as un-overridden (when Override
560 is FALSE).
561
562 **/
563 EFI_STATUS
564 EFIAPI
565 EfiIp6Neighbors (
566 IN EFI_IP6_PROTOCOL *This,
567 IN BOOLEAN DeleteFlag,
568 IN EFI_IPv6_ADDRESS *TargetIp6Address,
569 IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,
570 IN UINT32 Timeout,
571 IN BOOLEAN Override
572 );
573
574 /**
575 Places outgoing data packets into the transmit queue.
576
577 The Transmit() function places a sending request in the transmit queue of this
578 EFI IPv6 Protocol instance. Whenever the packet in the token is sent out or some
579 errors occur, the event in the token will be signaled and the status is updated.
580
581 @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
582 @param[in] Token The pointer to the transmit token.
583
584 @retval EFI_SUCCESS The data has been queued for transmission.
585 @retval EFI_NOT_STARTED This instance has not been started.
586 @retval EFI_NO_MAPPING The IPv6 driver was responsible for choosing
587 a source address for this transmission,
588 but no source address was available for use.
589 @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
590 - This is NULL.
591 - Token is NULL.
592 - Token.Event is NULL.
593 - Token.Packet.TxData is NULL.
594 - Token.Packet.ExtHdrsLength is not zero and
595 Token.Packet.ExtHdrs is NULL.
596 - Token.Packet.FragmentCount is zero.
597 - One or more of the Token.Packet.TxData.
598 FragmentTable[].FragmentLength fields is zero.
599 - One or more of the Token.Packet.TxData.
600 FragmentTable[].FragmentBuffer fields is NULL.
601 - Token.Packet.TxData.DataLength is zero or not
602 equal to the sum of fragment lengths.
603 - Token.Packet.TxData.DestinationAddress is non-
604 zero when DestinationAddress is configured as
605 non-zero when doing Configure() for this
606 EFI IPv6 protocol instance.
607 - Token.Packet.TxData.DestinationAddress is
608 unspecified when DestinationAddress is unspecified
609 when doing Configure() for this EFI IPv6 protocol
610 instance.
611 @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.
612 The event was already in the transmit queue.
613 @retval EFI_NOT_READY The completion token could not be queued because
614 the transmit queue is full.
615 @retval EFI_NOT_FOUND Not route is found to the destination address.
616 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
617 @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
618 short to transmit.
619 @retval EFI_BAD_BUFFER_SIZE If Token.Packet.TxData.DataLength is beyond the
620 maximum that which can be described through the
621 Fragment Offset field in Fragment header when
622 performing fragmentation.
623 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
624
625 **/
626 EFI_STATUS
627 EFIAPI
628 EfiIp6Transmit (
629 IN EFI_IP6_PROTOCOL *This,
630 IN EFI_IP6_COMPLETION_TOKEN *Token
631 );
632
633 /**
634 Places a receiving request into the receiving queue.
635
636 The Receive() function places a completion token into the receive packet queue.
637 This function is always asynchronous.
638
639 The Token.Event field in the completion token must be filled in by the caller
640 and cannot be NULL. When the receive operation completes, the EFI IPv6 Protocol
641 driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event
642 is signaled.
643
644 Current Udp implementation creates an IP child for each Udp child.
645 It initiates a asynchronous receive immediately whether or not
646 there is no mapping. Therefore, disable the returning EFI_NO_MAPPING for now.
647 To enable it, the following check must be performed:
648
649 if (NetIp6IsUnspecifiedAddr (&Config->StationAddress) && IP6_NO_MAPPING (IpInstance)) {
650 Status = EFI_NO_MAPPING;
651 goto Exit;
652 }
653
654 @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
655 @param[in] Token The pointer to a token that is associated with the
656 receive data descriptor.
657
658 @retval EFI_SUCCESS The receive completion token was cached.
659 @retval EFI_NOT_STARTED This EFI IPv6 Protocol instance has not been started.
660 @retval EFI_NO_MAPPING When IP6 driver responsible for binding source address to this instance,
661 while no source address is available for use.
662 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
663 - This is NULL.
664 - Token is NULL.
665 - Token.Event is NULL.
666 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
667 resources (usually memory).
668 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
669 The EFI IPv6 Protocol instance has been reset to startup defaults.
670 @retval EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already
671 in the receive queue.
672 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
673
674 **/
675 EFI_STATUS
676 EFIAPI
677 EfiIp6Receive (
678 IN EFI_IP6_PROTOCOL *This,
679 IN EFI_IP6_COMPLETION_TOKEN *Token
680 );
681
682 /**
683 Abort an asynchronous transmit or receive request.
684
685 The Cancel() function is used to abort a pending transmit or receive request.
686 If the token is in the transmit or receive request queues, after calling this
687 function, Token->Status will be set to EFI_ABORTED, and then Token->Event will
688 be signaled. If the token is not in one of the queues, which usually means the
689 asynchronous operation has completed, this function will not signal the token,
690 and EFI_NOT_FOUND is returned.
691
692 @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
693 @param[in] Token The pointer to a token that has been issued by
694 EFI_IP6_PROTOCOL.Transmit() or
695 EFI_IP6_PROTOCOL.Receive(). If NULL, all pending
696 tokens are aborted. Type EFI_IP6_COMPLETION_TOKEN is
697 defined in EFI_IP6_PROTOCOL.Transmit().
698
699 @retval EFI_SUCCESS The asynchronous I/O request was aborted and
700 Token->Event was signaled. When Token is NULL, all
701 pending requests were aborted, and their events were signaled.
702 @retval EFI_INVALID_PARAMETER This is NULL.
703 @retval EFI_NOT_STARTED This instance has not been started.
704 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
705 not found in the transmit or receive queue. It has either completed
706 or was not issued by Transmit() and Receive().
707 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
708
709 **/
710 EFI_STATUS
711 EFIAPI
712 EfiIp6Cancel (
713 IN EFI_IP6_PROTOCOL *This,
714 IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
715 );
716
717 /**
718 Polls for incoming data packets and processes outgoing data packets.
719
720 The Poll() function polls for incoming data packets and processes outgoing data
721 packets. Network drivers and applications can call the EFI_IP6_PROTOCOL.Poll()
722 function to increase the rate that data packets are moved between the communications
723 device and the transmit and receive queues.
724
725 In some systems the periodic timer event may not poll the underlying communications
726 device fast enough to transmit and/or receive all data packets without missing
727 incoming packets or dropping outgoing packets. Drivers and applications that are
728 experiencing packet loss should try calling the EFI_IP6_PROTOCOL.Poll() function
729 more often.
730
731 @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
732
733 @retval EFI_SUCCESS Incoming or outgoing data was processed.
734 @retval EFI_NOT_STARTED This EFI IPv6 Protocol instance has not been started.
735 @retval EFI_INVALID_PARAMETER This is NULL.
736 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
737 @retval EFI_NOT_READY No incoming or outgoing data was processed.
738 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
739 Consider increasing the polling rate.
740
741 **/
742 EFI_STATUS
743 EFIAPI
744 EfiIp6Poll (
745 IN EFI_IP6_PROTOCOL *This
746 );
747
748 #endif