2 Definition for IP6 pseudo interface structure.
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __EFI_IP6_IF_H__
11 #define __EFI_IP6_IF_H__
13 #define IP6_LINK_RX_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'R')
14 #define IP6_LINK_TX_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'T')
15 #define IP6_INTERFACE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'I')
16 #define IP6_ADDR_INFO_SIGNATURE SIGNATURE_32 ('I', 'P', 'A', 'I')
19 // This prototype is used by both receive and transmission.
20 // When receiving Netbuf is allocated by IP6_INTERFACE, and
21 // released by IP6. Flag shows whether the frame is received
22 // as unicast/multicast/anycast...
24 // When transmitting, the Netbuf is from IP6, and provided
25 // to the callback as a reference. Flag isn't used.
27 // IpInstance can be NULL which means that it is the IP6 driver
28 // itself sending the packets. IP6 driver may send packets that
29 // don't belong to any instance, such as ICMP errors, ICMP
30 // informational packets. IpInstance is used as a tag in
35 (*IP6_FRAME_CALLBACK
) (
43 // Each receive request is wrapped in an IP6_LINK_RX_TOKEN.
44 // Upon completion, the Callback will be called. Only one
45 // receive request is send to MNP. IpInstance is always NULL.
46 // Reference MNP's spec for information.
50 IP6_FRAME_CALLBACK CallBack
;
52 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken
;
56 // Each transmit request is wrapped in an IP6_LINK_TX_TOKEN.
57 // Upon completion, the Callback will be called.
63 IP6_PROTOCOL
*IpInstance
;
64 IP6_FRAME_CALLBACK CallBack
;
68 EFI_MAC_ADDRESS DstMac
;
69 EFI_MAC_ADDRESS SrcMac
;
71 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken
;
72 EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData
;
75 struct _IP6_ADDRESS_INFO
{
78 EFI_IPv6_ADDRESS Address
;
82 UINT32 PreferredLifetime
;
86 // Callback to select which frame to cancel. Caller can cancel a
87 // single frame, or all the frame from an IP instance.
91 (*IP6_FRAME_TO_CANCEL
) (
92 IP6_LINK_TX_TOKEN
*Frame
,
96 struct _IP6_INTERFACE
{
102 // IP address and prefix length of the interface. The fileds
103 // are invalid if (Configured == FALSE)
105 LIST_ENTRY AddressList
;
109 IP6_SERVICE
*Service
;
111 EFI_HANDLE Controller
;
115 // Queues to keep the frames sent and waiting ARP request.
118 LIST_ENTRY SentFrames
;
121 // The interface's configuration variables
123 UINT32 DupAddrDetect
;
124 LIST_ENTRY DupAddrDetectList
;
125 LIST_ENTRY DelayJoinList
;
128 // All the IP instances that have the same IP/SubnetMask are linked
129 // together through IpInstances. If any of the instance enables
130 // promiscuous receive, PromiscRecv is true.
132 LIST_ENTRY IpInstances
;
137 Create an IP6_INTERFACE.
139 @param[in] IpSb The IP6 service binding instance.
140 @param[in] LinkLocal If TRUE, the instance is created for link-local address.
141 Otherwise, it is not for a link-local address.
143 @return Point to the created IP6_INTERFACE, otherwise NULL.
148 IN IP6_SERVICE
*IpSb
,
153 Free the interface used by IpInstance. All the IP instance with
154 the same Ip/prefix pair share the same interface. It is reference
155 counted. All the frames that haven't been sent will be cancelled.
156 Because the IpInstance is optional, the caller must remove
157 IpInstance from the interface's instance list.
159 @param[in] Interface The interface used by the IpInstance.
160 @param[in] IpInstance The IP instance that free the interface. NULL if
161 the IP driver is releasing the default interface.
166 IN IP6_INTERFACE
*Interface
,
167 IN IP6_PROTOCOL
*IpInstance OPTIONAL
171 Free the link layer transmit token. It will close the event
172 then free the memory used.
174 @param[in] Token Token to free.
179 IN IP6_LINK_TX_TOKEN
*Token
183 Request Ip6OnFrameReceivedDpc as a DPC at TPL_CALLBACK
185 @param Event The receive event delivered to MNP for receive.
186 @param Context Context for the callback.
197 Request to receive the packet from the interface.
199 @param[in] CallBack Function to call when the receive finished.
200 @param[in] IpSb Points to the IP6 service binding instance.
202 @retval EFI_ALREADY_STARTED There is already a pending receive request.
203 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to receive.
204 @retval EFI_SUCCESS The receive request has been started.
209 IN IP6_FRAME_CALLBACK CallBack
,
214 Send a frame from the interface. If the next hop is multicast address,
215 it is transmitted immediately. If the next hop is a unicast,
216 and the NextHop's MAC is not known, it will perform address resolution.
217 If some error happened, the CallBack won't be called. So, the caller
218 must test the return value, and take action when there is an error.
220 @param[in] Interface The interface to send the frame from
221 @param[in] IpInstance The IP child that request the transmission.
222 NULL if it is the IP6 driver itself.
223 @param[in] Packet The packet to transmit.
224 @param[in] NextHop The immediate destination to transmit the packet to.
225 @param[in] CallBack Function to call back when transmit finished.
226 @param[in] Context Opaque parameter to the call back.
228 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to send the frame.
229 @retval EFI_NO_MAPPING Can't resolve the MAC for the nexthop.
230 @retval EFI_SUCCESS The packet successfully transmitted.
235 IN IP6_INTERFACE
*Interface
,
236 IN IP6_PROTOCOL
*IpInstance OPTIONAL
,
238 IN EFI_IPv6_ADDRESS
*NextHop
,
239 IN IP6_FRAME_CALLBACK CallBack
,
244 The heartbeat timer of IP6 service instance. It times out
245 all of its IP6 children's received-but-not-delivered and
246 transmitted-but-not-recycle packets.
248 @param[in] Event The IP6 service instance's heart beat timer.
249 @param[in] Context The IP6 service instance.