]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/MnpDxe/MnpImpl.h
Fixed GCC 4.4 build issue. All protocols and public interfaces must specify EFIAPI...
[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
dd29f3ed 4Copyright (c) 2005 - 2010, Intel Corporation.<BR>\r
83cbd279 5All rights reserved. This 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
237MnpTokenExist (\r
779ae357 238 IN NET_MAP *Map,\r
239 IN NET_MAP_ITEM *Item,\r
240 IN VOID *Arg\r
83cbd279 241 );\r
242\r
b6c4ecad 243/**\r
244 Cancel the token specified by Arg if it matches the token in Item.\r
245\r
6e4bac4d 246 @param[in, out] Map Pointer to the NET_MAP.\r
247 @param[in, out] Item Pointer to the NET_MAP_ITEM.\r
779ae357 248 @param[in] Arg Pointer to the Arg, it's a pointer to the\r
6e4bac4d 249 token to cancel.\r
b6c4ecad 250\r
779ae357 251 @retval EFI_SUCCESS The Arg is NULL, and the token in Item is cancelled,\r
3e8c18da 252 or the Arg isn't NULL, and the token in Item is\r
253 different from the Arg.\r
254 @retval EFI_ABORTED The Arg isn't NULL, the token in Item mathces the\r
255 Arg, and the token is cancelled.\r
b6c4ecad 256\r
257**/\r
83cbd279 258EFI_STATUS\r
259MnpCancelTokens (\r
779ae357 260 IN OUT NET_MAP *Map,\r
261 IN OUT NET_MAP_ITEM *Item,\r
262 IN VOID *Arg\r
83cbd279 263 );\r
264\r
b6c4ecad 265/**\r
266 Flush the instance's received data.\r
267\r
6e4bac4d 268 @param[in, out] Instance Pointer to the mnp instance context data.\r
b6c4ecad 269\r
270**/\r
83cbd279 271VOID\r
272MnpFlushRcvdDataQueue (\r
779ae357 273 IN OUT MNP_INSTANCE_DATA *Instance\r
83cbd279 274 );\r
275\r
b6c4ecad 276/**\r
277 Configure the Instance using ConfigData.\r
278\r
6e4bac4d 279 @param[in, out] Instance Pointer to the mnp instance context data.\r
280 @param[in] ConfigData Pointer to the configuration data used to configure\r
b6c4ecad 281 the isntance.\r
282\r
283 @retval EFI_SUCCESS The Instance is configured.\r
284 @retval EFI_UNSUPPORTED EnableReceiveTimestamps is on and the\r
285 implementation doesn't support it.\r
6e4bac4d 286 @retval Others Other errors as indicated.\r
b6c4ecad 287\r
288**/\r
83cbd279 289EFI_STATUS\r
290MnpConfigureInstance (\r
779ae357 291 IN OUT MNP_INSTANCE_DATA *Instance,\r
292 IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL\r
83cbd279 293 );\r
294\r
b6c4ecad 295/**\r
296 Do the group operations for this instance.\r
297\r
6e4bac4d 298 @param[in, out] Instance Pointer to the instance context data.\r
779ae357 299 @param[in] JoinFlag Set to TRUE to join a group. Set to TRUE to\r
6e4bac4d 300 leave a group/groups.\r
301 @param[in] MacAddress Pointer to the group address to join or leave.\r
779ae357 302 @param[in] CtrlBlk Pointer to the group control block if JoinFlag\r
6e4bac4d 303 is FALSE.\r
b6c4ecad 304\r
6e4bac4d 305 @retval EFI_SUCCESS The group operation finished.\r
306 @retval EFI_OUT_OF_RESOURCES Failed due to lack of memory resources.\r
307 @retval Others Other errors as indicated.\r
b6c4ecad 308\r
309**/\r
83cbd279 310EFI_STATUS\r
311MnpGroupOp (\r
779ae357 312 IN OUT MNP_INSTANCE_DATA *Instance,\r
313 IN BOOLEAN JoinFlag,\r
314 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL,\r
315 IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL\r
83cbd279 316 );\r
317\r
b6c4ecad 318/**\r
319 Validates the Mnp transmit token.\r
320\r
6e4bac4d 321 @param[in] Instance Pointer to the Mnp instance context data.\r
322 @param[in] Token Pointer to the transmit token to check.\r
b6c4ecad 323\r
324 @return The Token is valid or not.\r
325\r
326**/\r
83cbd279 327BOOLEAN\r
328MnpIsValidTxToken (\r
779ae357 329 IN MNP_INSTANCE_DATA *Instance,\r
330 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r
83cbd279 331 );\r
332\r
b6c4ecad 333/**\r
334 Build the packet to transmit from the TxData passed in.\r
335\r
6e4bac4d 336 @param[in] MnpServiceData Pointer to the mnp service context data.\r
779ae357 337 @param[in] TxData Pointer to the transmit data containing the information\r
6e4bac4d 338 to build the packet.\r
339 @param[out] PktBuf Pointer to record the address of the packet.\r
779ae357 340 @param[out] PktLen Pointer to a UINT32 variable used to record the packet's\r
6e4bac4d 341 length.\r
342\r
b6c4ecad 343**/\r
83cbd279 344VOID\r
345MnpBuildTxPacket (\r
779ae357 346 IN MNP_SERVICE_DATA *MnpServiceData,\r
347 IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,\r
348 OUT UINT8 **PktBuf,\r
349 OUT UINT32 *PktLen\r
83cbd279 350 );\r
351\r
b6c4ecad 352/**\r
353 Synchronously send out the packet.\r
354\r
6e4bac4d 355 @param[in] MnpServiceData Pointer to the mnp service context data.\r
356 @param[in] Packet Pointer to the pakcet buffer.\r
357 @param[in] Length The length of the packet.\r
358 @param[in, out] Token Pointer to the token the packet generated from.\r
b6c4ecad 359\r
6e4bac4d 360 @retval EFI_SUCCESS The packet is sent out.\r
361 @retval EFI_TIMEOUT Time out occurs, the packet isn't sent.\r
362 @retval EFI_DEVICE_ERROR An unexpected network error occurs.\r
b6c4ecad 363\r
364**/\r
83cbd279 365EFI_STATUS\r
366MnpSyncSendPacket (\r
779ae357 367 IN MNP_SERVICE_DATA *MnpServiceData,\r
368 IN UINT8 *Packet,\r
369 IN UINT32 Length,\r
370 IN OUT EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r
83cbd279 371 );\r
372\r
b6c4ecad 373/**\r
374 Try to deliver the received packet to the instance.\r
375\r
6e4bac4d 376 @param[in, out] Instance Pointer to the mnp instance context data.\r
b6c4ecad 377\r
378 @retval EFI_SUCCESS The received packet is delivered, or there is no\r
379 packet to deliver, or there is no available receive\r
380 token.\r
381 @retval EFI_OUT_OF_RESOURCES The deliver fails due to lack of memory resource.\r
382\r
383**/\r
83cbd279 384EFI_STATUS\r
385MnpInstanceDeliverPacket (\r
779ae357 386 IN OUT MNP_INSTANCE_DATA *Instance\r
83cbd279 387 );\r
388\r
b6c4ecad 389/**\r
390 Recycle the RxData and other resources used to hold and deliver the received\r
391 packet.\r
392\r
6e4bac4d 393 @param[in] Event The event this notify function registered to.\r
394 @param[in] Context Pointer to the context data registerd to the Event.\r
395\r
b6c4ecad 396**/\r
83cbd279 397VOID\r
398EFIAPI\r
399MnpRecycleRxData (\r
779ae357 400 IN EFI_EVENT Event,\r
401 IN VOID *Context\r
83cbd279 402 );\r
403\r
b6c4ecad 404/**\r
405 Try to receive a packet and deliver it.\r
406\r
779ae357 407 @param[in, out] MnpDeviceData Pointer to the mnp device context data.\r
b6c4ecad 408\r
409 @retval EFI_SUCCESS add return value to function comment\r
410 @retval EFI_NOT_STARTED The simple network protocol is not started.\r
411 @retval EFI_NOT_READY No packet received.\r
412 @retval EFI_DEVICE_ERROR An unexpected error occurs.\r
413\r
414**/\r
83cbd279 415EFI_STATUS\r
416MnpReceivePacket (\r
779ae357 417 IN OUT MNP_DEVICE_DATA *MnpDeviceData\r
83cbd279 418 );\r
419\r
b6c4ecad 420/**\r
779ae357 421 Allocate a free NET_BUF from MnpDeviceData->FreeNbufQue. If there is none\r
b6c4ecad 422 in the queue, first try to allocate some and add them into the queue, then\r
423 fetch the NET_BUF from the updated FreeNbufQue.\r
424\r
779ae357 425 @param[in, out] MnpDeviceData Pointer to the MNP_DEVICE_DATA.\r
b6c4ecad 426\r
779ae357 427 @return Pointer to the allocated free NET_BUF structure, if NULL the\r
3e8c18da 428 operation is failed.\r
b6c4ecad 429\r
430**/\r
83cbd279 431NET_BUF *\r
432MnpAllocNbuf (\r
779ae357 433 IN OUT MNP_DEVICE_DATA *MnpDeviceData\r
83cbd279 434 );\r
435\r
b6c4ecad 436/**\r
437 Try to reclaim the Nbuf into the buffer pool.\r
438\r
779ae357 439 @param[in, out] MnpDeviceData Pointer to the mnp device context data.\r
5fe2f07f 440 @param[in, out] Nbuf Pointer to the NET_BUF to free.\r
6e4bac4d 441\r
b6c4ecad 442**/\r
83cbd279 443VOID\r
444MnpFreeNbuf (\r
779ae357 445 IN OUT MNP_DEVICE_DATA *MnpDeviceData,\r
6e4bac4d 446 IN OUT NET_BUF *Nbuf\r
83cbd279 447 );\r
448\r
b6c4ecad 449/**\r
450 Remove the received packets if timeout occurs.\r
451\r
dd29f3ed 452 @param[in] Event The event this notify function registered to.\r
453 @param[in] Context Pointer to the context data registered to the event.\r
779ae357 454\r
b6c4ecad 455**/\r
83cbd279 456VOID\r
457EFIAPI\r
458MnpCheckPacketTimeout (\r
779ae357 459 IN EFI_EVENT Event,\r
460 IN VOID *Context\r
83cbd279 461 );\r
462\r
dd29f3ed 463/**\r
464 Poll to update MediaPresent field in SNP ModeData by Snp.GetStatus().\r
465\r
466 @param[in] Event The event this notify function registered to.\r
467 @param[in] Context Pointer to the context data registered to the event.\r
468\r
469**/\r
470VOID\r
471EFIAPI\r
472MnpCheckMediaStatus (\r
473 IN EFI_EVENT Event,\r
474 IN VOID *Context\r
475 );\r
476\r
b6c4ecad 477/**\r
478 Poll to receive the packets from Snp. This function is either called by upperlayer\r
479 protocols/applications or the system poll timer notify mechanism.\r
480\r
dd29f3ed 481 @param[in] Event The event this notify function registered to.\r
482 @param[in] Context Pointer to the context data registered to the event.\r
b6c4ecad 483\r
484**/\r
83cbd279 485VOID\r
486EFIAPI\r
487MnpSystemPoll (\r
dd29f3ed 488 IN EFI_EVENT Event,\r
489 IN VOID *Context\r
83cbd279 490 );\r
491\r
b6c4ecad 492/**\r
493 Returns the operational parameters for the current MNP child driver. May also\r
779ae357 494 support returning the underlying SNP driver mode data.\r
495\r
b6c4ecad 496 The GetModeData() function is used to read the current mode data (operational\r
779ae357 497 parameters) from the MNP or the underlying SNP.\r
b6c4ecad 498\r
3e8c18da 499 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
500 @param[out] MnpConfigData Pointer to storage for MNP operational parameters. Type\r
501 EFI_MANAGED_NETWORK_CONFIG_DATA is defined in "Related\r
502 Definitions" below.\r
503 @param[out] SnpModeData Pointer to storage for SNP operational parameters. This\r
504 feature may be unsupported. Type EFI_SIMPLE_NETWORK_MODE\r
505 is defined in the EFI_SIMPLE_NETWORK_PROTOCOL.\r
779ae357 506\r
b6c4ecad 507 @retval EFI_SUCCESS The operation completed successfully.\r
508 @retval EFI_INVALID_PARAMETER This is NULL.\r
509 @retval EFI_UNSUPPORTED The requested feature is unsupported in this\r
510 MNP implementation.\r
511 @retval EFI_NOT_STARTED This MNP child driver instance has not been\r
512 configured. The default values are returned in\r
513 MnpConfigData if it is not NULL.\r
6e4bac4d 514 @retval Others The mode data could not be read.\r
b6c4ecad 515\r
516**/\r
83cbd279 517EFI_STATUS\r
518EFIAPI\r
519MnpGetModeData (\r
779ae357 520 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
521 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
522 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
83cbd279 523 );\r
524\r
b6c4ecad 525/**\r
779ae357 526 Sets or clears the operational parameters for the MNP child driver.\r
527\r
528 The Configure() function is used to set, change, or reset the operational\r
b6c4ecad 529 parameters for the MNP child driver instance. Until the operational parameters\r
530 have been set, no network traffic can be sent or received by this MNP child\r
531 driver instance. Once the operational parameters have been reset, no more\r
532 traffic can be sent or received until the operational parameters have been set\r
533 again.\r
534 Each MNP child driver instance can be started and stopped independently of\r
535 each other by setting or resetting their receive filter settings with the\r
536 Configure() function.\r
537 After any successful call to Configure(), the MNP child driver instance is\r
538 started. The internal periodic timer (if supported) is enabled. Data can be\r
539 transmitted and may be received if the receive filters have also been enabled.\r
540 Note: If multiple MNP child driver instances will receive the same packet\r
541 because of overlapping receive filter settings, then the first MNP child\r
542 driver instance will receive the original packet and additional instances will\r
543 receive copies of the original packet.\r
544 Note: Warning: Receive filter settings that overlap will consume extra\r
545 processor and/or DMA resources and degrade system and network performance.\r
546\r
6e4bac4d 547 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
548 @param[in] MnpConfigData Pointer to configuration data that will be assigned\r
549 to the MNP child driver instance. If NULL, the MNP\r
550 child driver instance is reset to startup defaults\r
551 and all pending transmit and receive requests are\r
552 flushed. Type EFI_MANAGED_NETWORK_CONFIG_DATA is\r
553 defined in EFI_MANAGED_NETWORK_PROTOCOL.GetModeData().\r
b6c4ecad 554\r
555 @retval EFI_SUCCESS The operation completed successfully.\r
556 @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r
557 TRUE:\r
558 * This is NULL.\r
559 * MnpConfigData.ProtocolTypeFilter is not\r
560 valid.\r
561 The operational data for the MNP child driver\r
562 instance is unchanged.\r
563 @retval EFI_OUT_OF_RESOURCES Required system resources (usually memory)\r
564 could not be allocated.\r
565 The MNP child driver instance has been reset to\r
566 startup defaults.\r
567 @retval EFI_UNSUPPORTED The requested feature is unsupported in\r
568 this [MNP] implementation. The operational data\r
569 for the MNP child driver instance is unchanged.\r
570 @retval EFI_DEVICE_ERROR An unexpected network or system error\r
571 occurred. The MNP child driver instance has\r
572 been reset to startup defaults.\r
6e4bac4d 573 @retval Others The MNP child driver instance has been reset to\r
b6c4ecad 574 startup defaults.\r
575\r
576**/\r
83cbd279 577EFI_STATUS\r
578EFIAPI\r
579MnpConfigure (\r
779ae357 580 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
581 IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL\r
83cbd279 582 );\r
583\r
b6c4ecad 584/**\r
779ae357 585 Translates an IP multicast address to a hardware (MAC) multicast address. This\r
586 function may be unsupported in some MNP implementations.\r
587\r
b6c4ecad 588 The McastIpToMac() function translates an IP multicast address to a hardware\r
589 (MAC) multicast address. This function may be implemented by calling the\r
6e4bac4d 590 underlying EFI_SIMPLE_NETWORK. MCastIpToMac() function, which may also be\r
b6c4ecad 591 unsupported in some MNP implementations.\r
592\r
6e4bac4d 593 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
594 @param[in] Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address.\r
595 Set to FALSE if IpAddress is an IPv4 multicast address.\r
596 @param[in] IpAddress Pointer to the multicast IP address (in network byte\r
597 order) to convert.\r
779ae357 598 @param[out] MacAddress Pointer to the resulting multicast MAC address.\r
b6c4ecad 599\r
600 @retval EFI_SUCCESS The operation completed successfully.\r
601 @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:\r
602 * This is NULL.\r
603 * IpAddress is NULL.\r
604 * IpAddress is not a valid multicast IP\r
605 address.\r
606 * MacAddress is NULL.\r
607 @retval EFI_NOT_STARTED This MNP child driver instance has not been\r
608 configured.\r
609 @retval EFI_UNSUPPORTED The requested feature is unsupported in this\r
610 MNP implementation.\r
611 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
6e4bac4d 612 @retval Others The address could not be converted.\r
b6c4ecad 613**/\r
83cbd279 614EFI_STATUS\r
615EFIAPI\r
616MnpMcastIpToMac (\r
779ae357 617 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
618 IN BOOLEAN Ipv6Flag,\r
619 IN EFI_IP_ADDRESS *IpAddress,\r
620 OUT EFI_MAC_ADDRESS *MacAddress\r
83cbd279 621 );\r
622\r
b6c4ecad 623/**\r
779ae357 624 Enables and disables receive filters for multicast address. This function may\r
b6c4ecad 625 be unsupported in some MNP implementations.\r
779ae357 626\r
627 The Groups() function only adds and removes multicast MAC addresses from the\r
b6c4ecad 628 filter list. The MNP driver does not transmit or process Internet Group\r
629 Management Protocol (IGMP) packets. If JoinFlag is FALSE and MacAddress is\r
630 NULL, then all joined groups are left.\r
779ae357 631\r
3e8c18da 632 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
633 @param[in] JoinFlag Set to TRUE to join this multicast group.\r
634 Set to FALSE to leave this multicast group.\r
635 @param[in] MacAddress Pointer to the multicast MAC group (address) to join or\r
636 leave.\r
b6c4ecad 637\r
638 @retval EFI_SUCCESS The requested operation completed successfully.\r
639 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
640 * This is NULL.\r
641 * JoinFlag is TRUE and MacAddress is NULL.\r
642 * MacAddress is not a valid multicast MAC\r
643 address.\r
644 * The MNP multicast group settings are\r
645 unchanged.\r
646 @retval EFI_NOT_STARTED This MNP child driver instance has not been\r
647 configured.\r
648 @retval EFI_ALREADY_STARTED The supplied multicast group is already joined.\r
649 @retval EFI_NOT_FOUND The supplied multicast group is not joined.\r
650 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
651 The MNP child driver instance has been reset to\r
652 startup defaults.\r
653 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP\r
654 implementation.\r
6e4bac4d 655 @retval Others The requested operation could not be completed.\r
b6c4ecad 656 The MNP multicast group settings are unchanged.\r
657\r
658**/\r
83cbd279 659EFI_STATUS\r
660EFIAPI\r
661MnpGroups (\r
779ae357 662 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
663 IN BOOLEAN JoinFlag,\r
664 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL\r
83cbd279 665 );\r
666\r
b6c4ecad 667/**\r
668 Places asynchronous outgoing data packets into the transmit queue.\r
779ae357 669\r
670 The Transmit() function places a completion token into the transmit packet\r
b6c4ecad 671 queue. This function is always asynchronous.\r
672 The caller must fill in the Token.Event and Token.TxData fields in the\r
673 completion token, and these fields cannot be NULL. When the transmit operation\r
674 completes, the MNP updates the Token.Status field and the Token.Event is\r
675 signaled.\r
676 Note: There may be a performance penalty if the packet needs to be\r
677 defragmented before it can be transmitted by the network device. Systems in\r
678 which performance is critical should review the requirements and features of\r
679 the underlying communications device and drivers.\r
779ae357 680\r
681\r
3e8c18da 682 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
683 @param[in] Token Pointer to a token associated with the transmit data\r
6e4bac4d 684 descriptor. Type EFI_MANAGED_NETWORK_COMPLETION_TOKEN\r
779ae357 685 is defined in "Related Definitions" below.\r
b6c4ecad 686\r
687 @retval EFI_SUCCESS The transmit completion token was cached.\r
688 @retval EFI_NOT_STARTED This MNP child driver instance has not been\r
689 configured.\r
690 @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r
691 TRUE:\r
692 * This is NULL.\r
693 * Token is NULL.\r
694 * Token.Event is NULL.\r
695 * Token.TxData is NULL.\r
696 * Token.TxData.DestinationAddress is not\r
697 NULL and Token.TxData.HeaderLength is zero.\r
698 * Token.TxData.FragmentCount is zero.\r
699 * (Token.TxData.HeaderLength +\r
700 Token.TxData.DataLength) is not equal to the\r
701 sum of the\r
702 Token.TxData.FragmentTable[].FragmentLength\r
703 fields.\r
704 * One or more of the\r
705 Token.TxData.FragmentTable[].FragmentLength\r
706 fields is zero.\r
707 * One or more of the\r
708 Token.TxData.FragmentTable[].FragmentBufferfields\r
709 is NULL.\r
710 * Token.TxData.DataLength is greater than MTU.\r
711 @retval EFI_ACCESS_DENIED The transmit completion token is already in the\r
712 transmit queue.\r
713 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a\r
779ae357 714 lack of system resources (usually memory).\r
b6c4ecad 715 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
716 The MNP child driver instance has been reset to\r
717 startup defaults.\r
718 @retval EFI_NOT_READY The transmit request could not be queued because\r
719 the transmit queue is full.\r
720\r
721**/\r
83cbd279 722EFI_STATUS\r
723EFIAPI\r
724MnpTransmit (\r
779ae357 725 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
726 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r
83cbd279 727 );\r
728\r
b6c4ecad 729/**\r
779ae357 730 Aborts an asynchronous transmit or receive request.\r
731\r
b6c4ecad 732 The Cancel() function is used to abort a pending transmit or receive request.\r
733 If the token is in the transmit or receive request queues, after calling this\r
734 function, Token.Status will be set to EFI_ABORTED and then Token.Event will be\r
735 signaled. If the token is not in one of the queues, which usually means that\r
736 the asynchronous operation has completed, this function will not signal the\r
737 token and EFI_NOT_FOUND is returned.\r
738\r
3e8c18da 739 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
740 @param[in] Token Pointer to a token that has been issued by\r
741 EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or\r
779ae357 742 EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If NULL, all\r
743 pending tokens are aborted.\r
b6c4ecad 744\r
745 @retval EFI_SUCCESS The asynchronous I/O request was aborted and\r
746 Token.Event was signaled. When Token is NULL,\r
747 all pending requests were aborted and their\r
748 events were signaled.\r
749 @retval EFI_NOT_STARTED This MNP child driver instance has not been\r
750 configured.\r
751 @retval EFI_INVALID_PARAMETER This is NULL.\r
752 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O\r
753 request was not found in the transmit or\r
754 receive queue. It has either completed or was\r
755 not issued by Transmit() and Receive().\r
756\r
757**/\r
83cbd279 758EFI_STATUS\r
759EFIAPI\r
760MnpCancel (\r
779ae357 761 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
762 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL\r
83cbd279 763 );\r
764\r
b6c4ecad 765/**\r
766 Places an asynchronous receiving request into the receiving queue.\r
779ae357 767\r
768 The Receive() function places a completion token into the receive packet\r
b6c4ecad 769 queue. This function is always asynchronous.\r
770 The caller must fill in the Token.Event field in the completion token, and\r
771 this field cannot be NULL. When the receive operation completes, the MNP\r
772 updates the Token.Status and Token.RxData fields and the Token.Event is\r
773 signaled.\r
779ae357 774\r
6e4bac4d 775 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
776 @param[in] Token Pointer to a token associated with the receive\r
777 data descriptor. Type\r
778 EFI_MANAGED_NETWORK_COMPLETION_TOKEN is defined in\r
779 EFI_MANAGED_NETWORK_PROTOCOL.Transmit().\r
b6c4ecad 780\r
781 @retval EFI_SUCCESS The receive completion token was cached.\r
782 @retval EFI_NOT_STARTED This MNP child driver instance has not been\r
783 configured.\r
784 @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r
785 TRUE:\r
786 * This is NULL.\r
787 * Token is NULL.\r
788 * Token.Event is NULL\r
789 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a\r
790 lack of system resources (usually memory).\r
791 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
792 The MNP child driver instance has been reset to\r
793 startup defaults.\r
794 @retval EFI_ACCESS_DENIED The receive completion token was already in the\r
795 receive queue.\r
796 @retval EFI_NOT_READY The receive request could not be queued because\r
797 the receive queue is full.\r
798\r
799**/\r
83cbd279 800EFI_STATUS\r
801EFIAPI\r
802MnpReceive (\r
779ae357 803 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
804 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r
83cbd279 805 );\r
806\r
b6c4ecad 807/**\r
779ae357 808 Polls for incoming data packets and processes outgoing data packets.\r
809\r
810 The Poll() function can be used by network drivers and applications to\r
b6c4ecad 811 increase the rate that data packets are moved between the communications\r
812 device and the transmit and receive queues.\r
813 Normally, a periodic timer event internally calls the Poll() function. But, in\r
814 some systems, the periodic timer event may not call Poll() fast enough to\r
815 transmit and/or receive all data packets without missing packets. Drivers and\r
816 applications that are experiencing packet loss should try calling the Poll()\r
817 function more often.\r
818\r
6e4bac4d 819 @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
b6c4ecad 820\r
821 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
822 @retval EFI_NOT_STARTED This MNP child driver instance has not been\r
823 configured.\r
824 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The\r
825 MNP child driver instance has been reset to startup\r
826 defaults.\r
827 @retval EFI_NOT_READY No incoming or outgoing data was processed. Consider\r
828 increasing the polling rate.\r
829 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive\r
830 queue. Consider increasing the polling rate.\r
831\r
832**/\r
83cbd279 833EFI_STATUS\r
834EFIAPI\r
835MnpPoll (\r
779ae357 836 IN EFI_MANAGED_NETWORK_PROTOCOL *This\r
83cbd279 837 );\r
838\r
aeddd425 839/**\r
840 Configure the Snp receive filters according to the instances' receive filter\r
841 settings.\r
842\r
779ae357 843 @param[in] MnpDeviceData Pointer to the mnp device context data.\r
aeddd425 844\r
845 @retval EFI_SUCCESS The receive filters is configured.\r
779ae357 846 @retval EFI_OUT_OF_RESOURCES The receive filters can't be configured due\r
aeddd425 847 to lack of memory resource.\r
848\r
849**/\r
850EFI_STATUS\r
851MnpConfigReceiveFilters (\r
779ae357 852 IN MNP_DEVICE_DATA *MnpDeviceData\r
aeddd425 853 );\r
854\r
83cbd279 855#endif\r