X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FMnpDxe%2FMnpConfig.c;h=381f8b87b8bc68ba3cf48bfc27e8288041763a46;hp=fd03ed54170bdb00984eb2e26af89afbcdad6e60;hb=87f89c0840a042a683b966d2be8ecb015886cb39;hpb=fe1e36e550c6ffcd2561903d434683d3939e1942 diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c index fd03ed5417..381f8b87b8 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c @@ -1,23 +1,15 @@ /** @file + Implementation of Managed Network Protocol private services. -Copyright (c) 2005 - 2008, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php +Copyright (c) 2005 - 2009, Intel Corporation.
+All rights reserved. This program and the accompanying materials are licensed +and made available under the terms and conditions of the BSD License which +accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -Module Name: - - MnpConfig.c - -Abstract: - - Implementation of Managed Network Protocol private services. - - **/ @@ -40,8 +32,8 @@ EFI_MANAGED_NETWORK_PROTOCOL mMnpProtocolTemplate = { }; EFI_MANAGED_NETWORK_CONFIG_DATA mMnpDefaultConfigData = { - 10000, - 10000, + 10000000, + 10000000, 0, FALSE, FALSE, @@ -52,71 +44,23 @@ EFI_MANAGED_NETWORK_CONFIG_DATA mMnpDefaultConfigData = { FALSE }; -EFI_STATUS -MnpAddFreeNbuf ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN UINTN Count - ); - -EFI_STATUS -MnpStartSnp ( - IN EFI_SIMPLE_NETWORK_PROTOCOL *Snp - ); - -EFI_STATUS -MnpStopSnp ( - IN EFI_SIMPLE_NETWORK_PROTOCOL *Snp - ); - -EFI_STATUS -MnpStart ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN BOOLEAN IsConfigUpdate, - IN BOOLEAN EnableSystemPoll - ); - -EFI_STATUS -MnpStop ( - IN MNP_SERVICE_DATA *MnpServiceData - ); - -EFI_STATUS -MnpConfigReceiveFilters ( - IN MNP_SERVICE_DATA *MnpServiceData - ); - -EFI_STATUS -MnpGroupOpAddCtrlBlk ( - IN MNP_INSTANCE_DATA *Instance, - IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk, - IN MNP_GROUP_ADDRESS *GroupAddress OPTIONAL, - IN EFI_MAC_ADDRESS *MacAddress, - IN UINT32 HwAddressSize - ); - -BOOLEAN -MnpGroupOpDelCtrlBlk ( - IN MNP_INSTANCE_DATA *Instance, - IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk - ); - /** - Add some NET_BUF into MnpServiceData->FreeNbufQue. The buffer length of - the NET_BUF is specified by MnpServiceData->BufferLength. + Add Count of net buffers to MnpServiceData->FreeNbufQue. The length of the net + buffer is specified by MnpServiceData->BufferLength. - @param MnpServiceData Pointer to the MNP_SERVICE_DATA. - @param Count Number of NET_BUFFERs to add. + @param[in, out] MnpServiceData Pointer to the MNP_SERVICE_DATA. + @param[in] Count Number of NET_BUFFERs to add. - @retval EFI_SUCCESS The specified amount of NET_BUFs are allocated and - added into MnpServiceData->FreeNbufQue. + @retval EFI_SUCCESS The specified amount of NET_BUFs are allocated + and added to MnpServiceData->FreeNbufQue. @retval EFI_OUT_OF_RESOURCES Failed to allocate a NET_BUF structure. **/ EFI_STATUS MnpAddFreeNbuf ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN UINTN Count + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN UINTN Count ) { EFI_STATUS Status; @@ -160,14 +104,15 @@ MnpAddFreeNbuf ( in the queue, first try to allocate some and add them into the queue, then fetch the NET_BUF from the updated FreeNbufQue. - @param MnpServiceData Pointer to the MNP_SERVICE_DATA. + @param[in, out] MnpServiceData Pointer to the MNP_SERVICE_DATA. - @return Pointer to the allocated free NET_BUF structure, if NULL the operation is failed. + @return Pointer to the allocated free NET_BUF structure, if NULL the + operation is failed. **/ NET_BUF * MnpAllocNbuf ( - IN MNP_SERVICE_DATA *MnpServiceData + IN OUT MNP_SERVICE_DATA *MnpServiceData ) { EFI_STATUS Status; @@ -232,16 +177,14 @@ ON_EXIT: /** Try to reclaim the Nbuf into the buffer pool. - @param MnpServiceData Pointer to the mnp service context data. - @param Nbuf Pointer to the NET_BUF to free. - - @return None. + @param[in, out] MnpServiceData Pointer to the mnp service context data. + @param[in, out] Nbuf Pointer to the NET_BUF to free. **/ VOID MnpFreeNbuf ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN NET_BUF *Nbuf + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN OUT NET_BUF *Nbuf ) { EFI_TPL OldTpl; @@ -268,18 +211,20 @@ MnpFreeNbuf ( /** Initialize the mnp service context data. - @param MnpServiceData Pointer to the mnp service context data. - @param Snp Pointer to the simple network protocol. + @param[in, out] MnpServiceData Pointer to the mnp service context data. + @param[in] ImageHandle The driver image handle. + @param[in] ControllerHandle Handle of device to bind driver to. @retval EFI_SUCCESS The mnp service context is initialized. - @retval Other Some error occurs. + @retval EFI_UNSUPPORTED ControllerHandle does not support Simple Network Protocol. + @retval Others Other errors as indicated. **/ EFI_STATUS MnpInitializeServiceData ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN EFI_HANDLE ImageHandle, - IN EFI_HANDLE ControllerHandle + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN EFI_HANDLE ImageHandle, + IN EFI_HANDLE ControllerHandle ) { EFI_STATUS Status; @@ -453,15 +398,14 @@ ERROR: /** Flush the mnp service context data. - @param MnpServiceData Pointer to the mnp service context data. - - @return None. + @param[in, out] MnpServiceData Pointer to the mnp service context data. + @param[in] ImageHandle The driver image handle. **/ VOID MnpFlushServiceData ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN EFI_HANDLE ImageHandle + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN EFI_HANDLE ImageHandle ) { NET_CHECK_SIGNATURE (MnpServiceData, MNP_SERVICE_DATA_SIGNATURE); @@ -517,17 +461,15 @@ MnpFlushServiceData ( /** Initialize the mnp instance context data. - @param MnpServiceData Pointer to the mnp service context data. - @param Instance Pointer to the mnp instance context data to - initialize. - - @return None. + @param[in] MnpServiceData Pointer to the mnp service context data. + @param[in, out] Instance Pointer to the mnp instance context data + to initialize. **/ VOID MnpInitializeInstanceData ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN MNP_INSTANCE_DATA *Instance + IN MNP_SERVICE_DATA *MnpServiceData, + IN OUT MNP_INSTANCE_DATA *Instance ) { NET_CHECK_SIGNATURE (MnpServiceData, MNP_SERVICE_DATA_SIGNATURE); @@ -568,11 +510,11 @@ MnpInitializeInstanceData ( /** - Check whether the token specified by Arg maches the token in Item. + Check whether the token specified by Arg matches the token in Item. - @param Map Pointer to the NET_MAP. - @param Item Pointer to the NET_MAP_ITEM - @param Arg Pointer to the Arg, it's a pointer to the token to + @param[in] Map Pointer to the NET_MAP. + @param[in] Item Pointer to the NET_MAP_ITEM. + @param[in] Arg Pointer to the Arg, it's a pointer to the token to check. @retval EFI_SUCCESS The token specified by Arg is different from the @@ -605,27 +547,26 @@ MnpTokenExist ( return EFI_SUCCESS; } - /** Cancel the token specified by Arg if it matches the token in Item. - @param Map Pointer to the NET_MAP. - @param Item Pointer to the NET_MAP_ITEM - @param Arg Pointer to the Arg, it's a pointer to the token to - cancel. + @param[in, out] Map Pointer to the NET_MAP. + @param[in, out] Item Pointer to the NET_MAP_ITEM. + @param[in] Arg Pointer to the Arg, it's a pointer to the + token to cancel. - @retval EFI_SUCCESS The Arg is NULL, and the token in Item is - cancelled, or the Arg isn't NULL, and the token in - Item is different from the Arg. - @retval EFI_ABORTED The Arg isn't NULL, the token in Item mathces the - Arg, and the token is cancelled. + @retval EFI_SUCCESS The Arg is NULL, and the token in Item is cancelled, + or the Arg isn't NULL, and the token in Item is + different from the Arg. + @retval EFI_ABORTED The Arg isn't NULL, the token in Item mathces the + Arg, and the token is cancelled. **/ EFI_STATUS MnpCancelTokens ( - IN NET_MAP *Map, - IN NET_MAP_ITEM *Item, - IN VOID *Arg + IN OUT NET_MAP *Map, + IN OUT NET_MAP_ITEM *Item, + IN VOID *Arg ) { EFI_MANAGED_NETWORK_COMPLETION_TOKEN *TokenToCancel; @@ -664,10 +605,10 @@ MnpCancelTokens ( /** Start and initialize the simple network. - @param Snp Pointer to the simple network protocol. + @param[in] Snp Pointer to the simple network protocol. @retval EFI_SUCCESS The simple network protocol is started. - @retval Other Some error occurs. + @retval Others Other errors as indicated. **/ EFI_STATUS @@ -698,10 +639,10 @@ MnpStartSnp ( /** Stop the simple network. - @param Snp Pointer to the simple network protocol. + @param[in] Snp Pointer to the simple network protocol. @retval EFI_SUCCESS The simple network is stopped. - @retval Other Some error occurs. + @retval Others Other errors as indicated. **/ EFI_STATUS @@ -733,21 +674,21 @@ MnpStopSnp ( Start the managed network, this function is called when one instance is configured or reconfigured. - @param MnpServiceData Pointer to the mnp service context data. - @param IsConfigUpdate The instance is reconfigured or it's the first time - the instanced is configured. - @param EnableSystemPoll Enable the system polling or not. + @param[in, out] MnpServiceData Pointer to the mnp service context data. + @param[in] IsConfigUpdate The instance is reconfigured or it's the first + time the instanced is configured. + @param[in] EnableSystemPoll Enable the system polling or not. - @retval EFI_SUCCESS The managed network is started and some - configuration is updated. - @retval Other Some error occurs. + @retval EFI_SUCCESS The managed network is started and some + configuration is updated. + @retval Others Other errors as indicated. **/ EFI_STATUS MnpStart ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN BOOLEAN IsConfigUpdate, - IN BOOLEAN EnableSystemPoll + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN BOOLEAN IsConfigUpdate, + IN BOOLEAN EnableSystemPoll ) { EFI_STATUS Status; @@ -825,15 +766,15 @@ ErrorExit: /** Stop the managed network. - @param MnpServiceData Pointer to the mnp service context data. + @param[in, out] MnpServiceData Pointer to the mnp service context data. - @retval EFI_SUCCESS The managed network is stopped. - @retval Other Some error occurs. + @retval EFI_SUCCESS The managed network is stopped. + @retval Others Other errors as indicated. **/ EFI_STATUS MnpStop ( - IN MNP_SERVICE_DATA *MnpServiceData + IN OUT MNP_SERVICE_DATA *MnpServiceData ) { EFI_STATUS Status; @@ -888,14 +829,12 @@ MnpStop ( /** Flush the instance's received data. - @param Instance Pointer to the mnp instance context data. - - @return None. + @param[in, out] Instance Pointer to the mnp instance context data. **/ VOID MnpFlushRcvdDataQueue ( - IN MNP_INSTANCE_DATA *Instance + IN OUT MNP_INSTANCE_DATA *Instance ) { EFI_TPL OldTpl; @@ -927,20 +866,20 @@ MnpFlushRcvdDataQueue ( /** Configure the Instance using ConfigData. - @param Instance Pointer to the mnp instance context data. - @param ConfigData Pointer to the configuration data used to configure + @param[in, out] Instance Pointer to the mnp instance context data. + @param[in] ConfigData Pointer to the configuration data used to configure the isntance. @retval EFI_SUCCESS The Instance is configured. @retval EFI_UNSUPPORTED EnableReceiveTimestamps is on and the implementation doesn't support it. - @retval Other Some error occurs. + @retval Others Other errors as indicated. **/ EFI_STATUS MnpConfigureInstance ( - IN MNP_INSTANCE_DATA *Instance, - IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL + IN OUT MNP_INSTANCE_DATA *Instance, + IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL ) { EFI_STATUS Status; @@ -1062,16 +1001,15 @@ MnpConfigureInstance ( return Status; } - /** Configure the Snp receive filters according to the instances' receive filter settings. - @param MnpServiceData Pointer to the mnp service context data. + @param[in] MnpServiceData Pointer to the mnp service context data. - @retval EFI_SUCCESS The receive filters is configured. - @retval EFI_OUT_OF_RESOURCES The receive filters can't be configured due to lack - of memory resource. + @retval EFI_SUCCESS The receive filters is configured. + @retval EFI_OUT_OF_RESOURCES The receive filters can't be configured due + to lack of memory resource. **/ EFI_STATUS @@ -1163,7 +1101,7 @@ MnpConfigReceiveFilters ( // multicast. // - if (Snp->Mode->ReceiveFilterMask & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) { + if ((Snp->Mode->ReceiveFilterMask & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) != 0) { EnableFilterBits |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST; } else { // @@ -1225,23 +1163,23 @@ MnpConfigReceiveFilters ( Add a group address control block which controls the MacAddress for this instance. - @param Instance Pointer to the mnp instance context data. - @param CtrlBlk Pointer to the group address control block. - @param GroupAddress Pointer to the group adress. - @param MacAddress Pointer to the mac address. - @param HwAddressSize The hardware address size. + @param[in, out] Instance Pointer to the mnp instance context data. + @param[in, out] CtrlBlk Pointer to the group address control block. + @param[in, out] GroupAddress Pointer to the group adress. + @param[in] MacAddress Pointer to the mac address. + @param[in] HwAddressSize The hardware address size. - @retval EFI_SUCCESS The group address control block is added. - @retval EFI_OUT_OF_RESOURCE Failed due to lack of memory resources. + @retval EFI_SUCCESS The group address control block is added. + @retval EFI_OUT_OF_RESOURCES Failed due to lack of memory resources. **/ EFI_STATUS MnpGroupOpAddCtrlBlk ( - IN MNP_INSTANCE_DATA *Instance, - IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk, - IN MNP_GROUP_ADDRESS *GroupAddress OPTIONAL, - IN EFI_MAC_ADDRESS *MacAddress, - IN UINT32 HwAddressSize + IN OUT MNP_INSTANCE_DATA *Instance, + IN OUT MNP_GROUP_CONTROL_BLOCK *CtrlBlk, + IN OUT MNP_GROUP_ADDRESS *GroupAddress OPTIONAL, + IN EFI_MAC_ADDRESS *MacAddress, + IN UINT32 HwAddressSize ) { MNP_SERVICE_DATA *MnpServiceData; @@ -1294,8 +1232,8 @@ MnpGroupOpAddCtrlBlk ( Delete a group control block from the instance. If the controlled group address's reference count reaches zero, the group address is removed too. - @param Instance Pointer to the instance context data. - @param CtrlBlk Pointer to the group control block to delete. + @param[in] Instance Pointer to the instance context data. + @param[in] CtrlBlk Pointer to the group control block to delete. @return The group address controlled by the control block is no longer used or not. @@ -1346,20 +1284,21 @@ MnpGroupOpDelCtrlBlk ( /** Do the group operations for this instance. - @param Instance Pointer to the instance context data. - @param JoinFlag Set to TRUE to join a group. Set to TRUE to leave a - group/groups. - @param MacAddress Pointer to the group address to join or leave. - @param CtrlBlk Pointer to the group control block if JoinFlag if - FALSE. + @param[in, out] Instance Pointer to the instance context data. + @param[in] JoinFlag Set to TRUE to join a group. Set to TRUE to + leave a group/groups. + @param[in] MacAddress Pointer to the group address to join or leave. + @param[in] CtrlBlk Pointer to the group control block if JoinFlag + is FALSE. - @retval EFI_SUCCESS The group operation finished. - @retval Other Some error occurs. + @retval EFI_SUCCESS The group operation finished. + @retval EFI_OUT_OF_RESOURCES Failed due to lack of memory resources. + @retval Others Other errors as indicated. **/ EFI_STATUS MnpGroupOp ( - IN MNP_INSTANCE_DATA *Instance, + IN OUT MNP_INSTANCE_DATA *Instance, IN BOOLEAN JoinFlag, IN EFI_MAC_ADDRESS *MacAddress OPTIONAL, IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL