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