]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/Ip6Dxe/Ip6If.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / Ip6If.h
CommitLineData
a3bcde70 1/** @file\r
7de8045a 2 Definition for IP6 pseudo interface structure.\r
a3bcde70
HT
3\r
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
5\r
ecf98fbc 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
a3bcde70
HT
7\r
8**/\r
9\r
10#ifndef __EFI_IP6_IF_H__\r
11#define __EFI_IP6_IF_H__\r
12\r
d1050b9d
MK
13#define IP6_LINK_RX_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'R')\r
14#define IP6_LINK_TX_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'T')\r
15#define IP6_INTERFACE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'I')\r
16#define IP6_ADDR_INFO_SIGNATURE SIGNATURE_32 ('I', 'P', 'A', 'I')\r
a3bcde70
HT
17\r
18//\r
19// This prototype is used by both receive and transmission.\r
20// When receiving Netbuf is allocated by IP6_INTERFACE, and\r
21// released by IP6. Flag shows whether the frame is received\r
22// as unicast/multicast/anycast...\r
23//\r
24// When transmitting, the Netbuf is from IP6, and provided\r
25// to the callback as a reference. Flag isn't used.\r
26//\r
27// IpInstance can be NULL which means that it is the IP6 driver\r
28// itself sending the packets. IP6 driver may send packets that\r
29// don't belong to any instance, such as ICMP errors, ICMP\r
30// informational packets. IpInstance is used as a tag in\r
31// this module.\r
32//\r
33typedef\r
34VOID\r
35(*IP6_FRAME_CALLBACK) (\r
d1050b9d
MK
36 NET_BUF *Packet,\r
37 EFI_STATUS IoStatus,\r
38 UINT32 LinkFlag,\r
39 VOID *Context\r
a3bcde70
HT
40 );\r
41\r
42//\r
43// Each receive request is wrapped in an IP6_LINK_RX_TOKEN.\r
44// Upon completion, the Callback will be called. Only one\r
45// receive request is send to MNP. IpInstance is always NULL.\r
46// Reference MNP's spec for information.\r
47//\r
48typedef struct {\r
d1050b9d
MK
49 UINT32 Signature;\r
50 IP6_FRAME_CALLBACK CallBack;\r
51 VOID *Context;\r
52 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;\r
a3bcde70
HT
53} IP6_LINK_RX_TOKEN;\r
54\r
55//\r
56// Each transmit request is wrapped in an IP6_LINK_TX_TOKEN.\r
57// Upon completion, the Callback will be called.\r
58//\r
59typedef struct {\r
d1050b9d
MK
60 UINT32 Signature;\r
61 LIST_ENTRY Link;\r
a3bcde70 62\r
d1050b9d
MK
63 IP6_PROTOCOL *IpInstance;\r
64 IP6_FRAME_CALLBACK CallBack;\r
65 NET_BUF *Packet;\r
66 VOID *Context;\r
a3bcde70 67\r
d1050b9d
MK
68 EFI_MAC_ADDRESS DstMac;\r
69 EFI_MAC_ADDRESS SrcMac;\r
a3bcde70 70\r
d1050b9d
MK
71 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;\r
72 EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData;\r
a3bcde70
HT
73} IP6_LINK_TX_TOKEN;\r
74\r
75struct _IP6_ADDRESS_INFO {\r
d1050b9d
MK
76 UINT32 Signature;\r
77 LIST_ENTRY Link;\r
78 EFI_IPv6_ADDRESS Address;\r
79 BOOLEAN IsAnycast;\r
80 UINT8 PrefixLength;\r
81 UINT32 ValidLifetime;\r
82 UINT32 PreferredLifetime;\r
a3bcde70
HT
83};\r
84\r
85//\r
86// Callback to select which frame to cancel. Caller can cancel a\r
87// single frame, or all the frame from an IP instance.\r
88//\r
89typedef\r
90BOOLEAN\r
91(*IP6_FRAME_TO_CANCEL) (\r
d1050b9d
MK
92 IP6_LINK_TX_TOKEN *Frame,\r
93 VOID *Context\r
a3bcde70
HT
94 );\r
95\r
96struct _IP6_INTERFACE {\r
d1050b9d
MK
97 UINT32 Signature;\r
98 LIST_ENTRY Link;\r
99 INTN RefCnt;\r
a3bcde70
HT
100\r
101 //\r
102 // IP address and prefix length of the interface. The fileds\r
103 // are invalid if (Configured == FALSE)\r
104 //\r
d1050b9d
MK
105 LIST_ENTRY AddressList;\r
106 UINT32 AddressCount;\r
107 BOOLEAN Configured;\r
a3bcde70 108\r
d1050b9d 109 IP6_SERVICE *Service;\r
a3bcde70 110\r
d1050b9d
MK
111 EFI_HANDLE Controller;\r
112 EFI_HANDLE Image;\r
a3bcde70
HT
113\r
114 //\r
115 // Queues to keep the frames sent and waiting ARP request.\r
116 //\r
d1050b9d
MK
117 LIST_ENTRY ArpQues;\r
118 LIST_ENTRY SentFrames;\r
a3bcde70
HT
119\r
120 //\r
121 // The interface's configuration variables\r
122 //\r
d1050b9d
MK
123 UINT32 DupAddrDetect;\r
124 LIST_ENTRY DupAddrDetectList;\r
125 LIST_ENTRY DelayJoinList;\r
a3bcde70
HT
126\r
127 //\r
128 // All the IP instances that have the same IP/SubnetMask are linked\r
129 // together through IpInstances. If any of the instance enables\r
130 // promiscuous receive, PromiscRecv is true.\r
131 //\r
d1050b9d
MK
132 LIST_ENTRY IpInstances;\r
133 BOOLEAN PromiscRecv;\r
a3bcde70
HT
134};\r
135\r
136/**\r
137 Create an IP6_INTERFACE.\r
138\r
139 @param[in] IpSb The IP6 service binding instance.\r
140 @param[in] LinkLocal If TRUE, the instance is created for link-local address.\r
141 Otherwise, it is not for a link-local address.\r
142\r
143 @return Point to the created IP6_INTERFACE, otherwise NULL.\r
144\r
145**/\r
146IP6_INTERFACE *\r
147Ip6CreateInterface (\r
d1050b9d
MK
148 IN IP6_SERVICE *IpSb,\r
149 IN BOOLEAN LinkLocal\r
a3bcde70
HT
150 );\r
151\r
152/**\r
153 Free the interface used by IpInstance. All the IP instance with\r
154 the same Ip/prefix pair share the same interface. It is reference\r
155 counted. All the frames that haven't been sent will be cancelled.\r
156 Because the IpInstance is optional, the caller must remove\r
157 IpInstance from the interface's instance list.\r
158\r
159 @param[in] Interface The interface used by the IpInstance.\r
160 @param[in] IpInstance The IP instance that free the interface. NULL if\r
161 the IP driver is releasing the default interface.\r
162\r
163**/\r
164VOID\r
165Ip6CleanInterface (\r
d1050b9d
MK
166 IN IP6_INTERFACE *Interface,\r
167 IN IP6_PROTOCOL *IpInstance OPTIONAL\r
a3bcde70
HT
168 );\r
169\r
170/**\r
171 Free the link layer transmit token. It will close the event\r
172 then free the memory used.\r
173\r
174 @param[in] Token Token to free.\r
175\r
176**/\r
177VOID\r
178Ip6FreeLinkTxToken (\r
d1050b9d 179 IN IP6_LINK_TX_TOKEN *Token\r
a3bcde70
HT
180 );\r
181\r
182/**\r
183 Request Ip6OnFrameReceivedDpc as a DPC at TPL_CALLBACK\r
184\r
185 @param Event The receive event delivered to MNP for receive.\r
186 @param Context Context for the callback.\r
187\r
188**/\r
189VOID\r
190EFIAPI\r
191Ip6OnFrameReceived (\r
d1050b9d
MK
192 IN EFI_EVENT Event,\r
193 IN VOID *Context\r
a3bcde70
HT
194 );\r
195\r
196/**\r
197 Request to receive the packet from the interface.\r
198\r
199 @param[in] CallBack Function to call when the receive finished.\r
200 @param[in] IpSb Points to the IP6 service binding instance.\r
201\r
202 @retval EFI_ALREADY_STARTED There is already a pending receive request.\r
203 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to receive.\r
7de8045a 204 @retval EFI_SUCCESS The receive request has been started.\r
a3bcde70
HT
205\r
206**/\r
207EFI_STATUS\r
208Ip6ReceiveFrame (\r
d1050b9d
MK
209 IN IP6_FRAME_CALLBACK CallBack,\r
210 IN IP6_SERVICE *IpSb\r
a3bcde70
HT
211 );\r
212\r
213/**\r
214 Send a frame from the interface. If the next hop is multicast address,\r
215 it is transmitted immediately. If the next hop is a unicast,\r
216 and the NextHop's MAC is not known, it will perform address resolution.\r
217 If some error happened, the CallBack won't be called. So, the caller\r
218 must test the return value, and take action when there is an error.\r
219\r
220 @param[in] Interface The interface to send the frame from\r
221 @param[in] IpInstance The IP child that request the transmission.\r
222 NULL if it is the IP6 driver itself.\r
223 @param[in] Packet The packet to transmit.\r
224 @param[in] NextHop The immediate destination to transmit the packet to.\r
225 @param[in] CallBack Function to call back when transmit finished.\r
226 @param[in] Context Opaque parameter to the call back.\r
227\r
228 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to send the frame.\r
229 @retval EFI_NO_MAPPING Can't resolve the MAC for the nexthop.\r
230 @retval EFI_SUCCESS The packet successfully transmitted.\r
231\r
232**/\r
233EFI_STATUS\r
234Ip6SendFrame (\r
d1050b9d
MK
235 IN IP6_INTERFACE *Interface,\r
236 IN IP6_PROTOCOL *IpInstance OPTIONAL,\r
237 IN NET_BUF *Packet,\r
238 IN EFI_IPv6_ADDRESS *NextHop,\r
239 IN IP6_FRAME_CALLBACK CallBack,\r
240 IN VOID *Context\r
a3bcde70
HT
241 );\r
242\r
243/**\r
244 The heartbeat timer of IP6 service instance. It times out\r
245 all of its IP6 children's received-but-not-delivered and\r
246 transmitted-but-not-recycle packets.\r
247\r
248 @param[in] Event The IP6 service instance's heart beat timer.\r
249 @param[in] Context The IP6 service instance.\r
250\r
251**/\r
252VOID\r
253EFIAPI\r
254Ip6TimerTicking (\r
d1050b9d
MK
255 IN EFI_EVENT Event,\r
256 IN VOID *Context\r
a3bcde70
HT
257 );\r
258\r
259#endif\r