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