X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FMnpDxe%2FMnpIo.c;h=a7b703f8a8828837d8c833c6c84c14164563e19f;hb=87f89c0840a042a683b966d2be8ecb015886cb39;hp=0347dc7f1f4f8719e6aa835535afc3587bcaf96d;hpb=48bd50c5a1e4c31818bba1d2ce88f9270b2f2440;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c index 0347dc7f1f..a7b703f8a8 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c @@ -1,6 +1,7 @@ /** @file - -Copyright (c) 2005 - 2007, Intel Corporation + Implementation of Managed Network Protocol I/O functions. + +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 @@ -9,29 +10,15 @@ 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: - - MnpIo.c - -Abstract: - - Implementation of Managed Network Protocol I/O functions. - - **/ #include "MnpImpl.h" -#include -#include -#include -#include - /** Validates the Mnp transmit token. - @param Instance Pointer to the Mnp instance context data. - @param Token Pointer to the transmit token to check. + @param[in] Instance Pointer to the Mnp instance context data. + @param[in] Token Pointer to the transmit token to check. @return The Token is valid or not. @@ -117,12 +104,12 @@ MnpIsValidTxToken ( /** Build the packet to transmit from the TxData passed in. - @param MnpServiceData Pointer to the mnp service context data. - @param TxData Pointer to the transmit data containing the - information to build the packet. - @param PktBuf Pointer to record the address of the packet. - @param PktLen Pointer to a UINT32 variable used to record the - packet's length. + @param[in] MnpServiceData Pointer to the mnp service context data. + @param[in] TxData Pointer to the transmit data containing the information + to build the packet. + @param[out] PktBuf Pointer to record the address of the packet. + @param[out] PktLen Pointer to a UINT32 variable used to record the packet's + length. **/ VOID @@ -187,22 +174,22 @@ MnpBuildTxPacket ( /** Synchronously send out the packet. - @param MnpServiceData Pointer to the mnp service context data. - @param Packet Pointer to the pakcet buffer. - @param Length The length of the packet. - @param Token Pointer to the token the packet generated from. + @param[in] MnpServiceData Pointer to the mnp service context data. + @param[in] Packet Pointer to the pakcet buffer. + @param[in] Length The length of the packet. + @param[in, out] Token Pointer to the token the packet generated from. - @retval EFI_SUCCESS The packet is sent out. - @retval EFI_TIMEOUT Time out occurs, the packet isn't sent. - @retval EFI_DEVICE_ERROR An unexpected network error occurs. + @retval EFI_SUCCESS The packet is sent out. + @retval EFI_TIMEOUT Time out occurs, the packet isn't sent. + @retval EFI_DEVICE_ERROR An unexpected network error occurs. **/ EFI_STATUS MnpSyncSendPacket ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN UINT8 *Packet, - IN UINT32 Length, - IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token + IN MNP_SERVICE_DATA *MnpServiceData, + IN UINT8 *Packet, + IN UINT32 Length, + IN OUT EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token ) { EFI_STATUS Status; @@ -295,7 +282,7 @@ SIGNAL_TOKEN: // // Dispatch the DPC queued by the NotifyFunction of Token->Event. // - NetLibDispatchDpc (); + DispatchDpc (); return EFI_SUCCESS; } @@ -304,7 +291,7 @@ SIGNAL_TOKEN: /** Try to deliver the received packet to the instance. - @param Instance Pointer to the mnp instance context data. + @param[in, out] Instance Pointer to the mnp instance context data. @retval EFI_SUCCESS The received packet is delivered, or there is no packet to deliver, or there is no available receive @@ -314,7 +301,7 @@ SIGNAL_TOKEN: **/ EFI_STATUS MnpInstanceDeliverPacket ( - IN MNP_INSTANCE_DATA *Instance + IN OUT MNP_INSTANCE_DATA *Instance ) { MNP_SERVICE_DATA *MnpServiceData; @@ -398,9 +385,7 @@ MnpInstanceDeliverPacket ( /** Deliver the received packet for the instances belonging to the MnpServiceData. - @param MnpServiceData Pointer to the mnp service context data. - - @return None. + @param[in] MnpServiceData Pointer to the mnp service context data. **/ VOID @@ -429,8 +414,8 @@ MnpDeliverPacket ( Recycle the RxData and other resources used to hold and deliver the received packet. - @param Event The event this notify function registered to. - @param Context Pointer to the context data registerd to the Event. + @param[in] Event The event this notify function registered to. + @param[in] Context Pointer to the context data registerd to the Event. **/ VOID @@ -476,17 +461,14 @@ MnpRecycleRxData ( /** Queue the received packet into instance's receive queue. - @param Instance Pointer to the mnp instance context data. - @param RxDataWrap Pointer to the Wrap structure containing the - received data and other information. - - @return None. - + @param[in, out] Instance Pointer to the mnp instance context data. + @param[in, out] RxDataWrap Pointer to the Wrap structure containing the + received data and other information. **/ VOID MnpQueueRcvdPacket ( - IN MNP_INSTANCE_DATA *Instance, - IN MNP_RXDATA_WRAP *RxDataWrap + IN OUT MNP_INSTANCE_DATA *Instance, + IN OUT MNP_RXDATA_WRAP *RxDataWrap ) { MNP_RXDATA_WRAP *OldRxDataWrap; @@ -533,13 +515,13 @@ MnpQueueRcvdPacket ( /** Match the received packet with the instance receive filters. - @param Instance Pointer to the mnp instance context data. - @param RxData Pointer to the EFI_MANAGED_NETWORK_RECEIVE_DATA. - @param GroupAddress Pointer to the GroupAddress, the GroupAddress is + @param[in] Instance Pointer to the mnp instance context data. + @param[in] RxData Pointer to the EFI_MANAGED_NETWORK_RECEIVE_DATA. + @param[in] GroupAddress Pointer to the GroupAddress, the GroupAddress is non-NULL and it contains the destination multicast mac address of the received packet if the packet destinated to a multicast mac address. - @param PktAttr The received packets attribute. + @param[in] PktAttr The received packets attribute. @return The received packet matches the instance's receive filters or not. @@ -611,27 +593,25 @@ MnpMatchPacket ( /** Analyse the received packets. - @param MnpServiceData Pointer to the mnp service context data. - @param Nbuf Pointer to the net buffer holding the received - packet. - @param RxData Pointer to the buffer used to save the analysed - result in EFI_MANAGED_NETWORK_RECEIVE_DATA. - @param GroupAddress Pointer to pointer to a MNP_GROUP_ADDRESS used to - pass out the address of the multicast address the - received packet destinated to. - @param PktAttr Pointer to the buffer used to save the analysed - packet attribute. - - @return None. + @param[in] MnpServiceData Pointer to the mnp service context data. + @param[in] Nbuf Pointer to the net buffer holding the received + packet. + @param[in, out] RxData Pointer to the buffer used to save the analysed + result in EFI_MANAGED_NETWORK_RECEIVE_DATA. + @param[out] GroupAddress Pointer to pointer to a MNP_GROUP_ADDRESS used to + pass out the address of the multicast address the + received packet destinated to. + @param[out] PktAttr Pointer to the buffer used to save the analysed + packet attribute. **/ VOID MnpAnalysePacket ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN NET_BUF *Nbuf, - IN EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData, - OUT MNP_GROUP_ADDRESS **GroupAddress, - OUT UINT8 *PktAttr + IN MNP_SERVICE_DATA *MnpServiceData, + IN NET_BUF *Nbuf, + IN OUT EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData, + OUT MNP_GROUP_ADDRESS **GroupAddress, + OUT UINT8 *PktAttr ) { EFI_SIMPLE_NETWORK_MODE *SnpMode; @@ -715,8 +695,8 @@ MnpAnalysePacket ( /** Wrap the RxData. - @param Instance Pointer to the mnp instance context data. - @param RxData Pointer to the receive data to wrap. + @param[in] Instance Pointer to the mnp instance context data. + @param[in] RxData Pointer to the receive data to wrap. @return Pointer to a MNP_RXDATA_WRAP which wraps the RxData. @@ -771,12 +751,10 @@ MnpWrapRxData ( Enqueue the received the packets to the instances belonging to the MnpServiceData. - @param MnpServiceData Pointer to the mnp service context data. - @param Nbuf Pointer to the net buffer representing the received + @param[in] MnpServiceData Pointer to the mnp service context data. + @param[in] Nbuf Pointer to the net buffer representing the received packet. - @return None. - **/ VOID MnpEnqueuePacket ( @@ -848,7 +826,7 @@ MnpEnqueuePacket ( /** Try to receive a packet and deliver it. - @param MnpServiceData Pointer to the mnp service context data. + @param[in, out] MnpServiceData Pointer to the mnp service context data. @retval EFI_SUCCESS add return value to function comment @retval EFI_NOT_STARTED The simple network protocol is not started. @@ -858,7 +836,7 @@ MnpEnqueuePacket ( **/ EFI_STATUS MnpReceivePacket ( - IN MNP_SERVICE_DATA *MnpServiceData + IN OUT MNP_SERVICE_DATA *MnpServiceData ) { EFI_STATUS Status; @@ -984,11 +962,6 @@ MnpReceivePacket ( // MnpDeliverPacket (MnpServiceData); - // - // Dispatch the DPC queued by the NotifyFunction of rx token's events. - // - NetLibDispatchDpc (); - EXIT: ASSERT (Nbuf->TotalSize == MnpServiceData->BufferLength); @@ -1000,8 +973,8 @@ EXIT: /** Remove the received packets if timeout occurs. - @param Event The event this notify function registered to. - @param Context Pointer to the context data registered to the + @param[in] Event The event this notify function registered to. + @param[in] Context Pointer to the context data registered to the event. **/ @@ -1043,7 +1016,7 @@ MnpCheckPacketTimeout ( RxDataWrap = NET_LIST_USER_STRUCT (RxEntry, MNP_RXDATA_WRAP, WrapEntry); // - // TimeoutTick unit is ms, MNP_TIMEOUT_CHECK_INTERVAL unit is 100ns. + // TimeoutTick unit is microsecond, MNP_TIMEOUT_CHECK_INTERVAL unit is 100ns. // if (RxDataWrap->TimeoutTick >= (MNP_TIMEOUT_CHECK_INTERVAL / 10)) { @@ -1067,18 +1040,15 @@ MnpCheckPacketTimeout ( Poll to receive the packets from Snp. This function is either called by upperlayer protocols/applications or the system poll timer notify mechanism. - @param Event The event this notify function registered to. - @param Context Pointer to the context data registered to the - event. - - @return None. + @param[in] Event The event this notify function registered to. + @param[in, out] Context Pointer to the context data registered to the event. **/ VOID EFIAPI MnpSystemPoll ( IN EFI_EVENT Event, - IN VOID *Context + IN OUT VOID *Context ) { MNP_SERVICE_DATA *MnpServiceData; @@ -1091,5 +1061,8 @@ MnpSystemPoll ( // MnpReceivePacket (MnpServiceData); - NetLibDispatchDpc (); + // + // Dispatch the DPC queued by the NotifyFunction of rx token's events. + // + DispatchDpc (); }