From 36ee91ca3661d3d020a7841aacbf858d885c4728 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Tue, 20 Nov 2007 05:42:23 +0000 Subject: 1. Add DPC protocol and DpcLib library in MdeModulePkg. 2. Add DpcDxe module and DxeDpcLib module in MdeModulePkg 3. Port network stack module to use DPC. 4. Use MIN, and MAX defined in MdePkg to replace NET_MIN and NET_MAX. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4307 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 109 +++++++++++++++++++++++---- 1 file changed, 96 insertions(+), 13 deletions(-) (limited to 'MdeModulePkg/Library/DxeIpIoLib') diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c index 608bdd2..279ada7 100644 --- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c +++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c @@ -74,6 +74,13 @@ STATIC ICMP_ERROR_INFO mIcmpErrMap[10] = { STATIC VOID EFIAPI +IpIoTransmitHandlerDpc ( + IN VOID *Context + ); + +STATIC +VOID +EFIAPI IpIoTransmitHandler ( IN EFI_EVENT Event, IN VOID *Context @@ -430,7 +437,7 @@ IpIoCreateSndEntry ( // // Set the fields of OverrideData // - NetCopyMem (OverrideData, Override, sizeof (*OverrideData)); + CopyMem (OverrideData, Override, sizeof (*OverrideData)); } // @@ -523,7 +530,6 @@ IpIoDestroySndEntry ( /** Notify function for IP transmit token. - @param Event The event signaled. @param Context The context passed in by the event notifier. @return None. @@ -532,8 +538,7 @@ IpIoDestroySndEntry ( STATIC VOID EFIAPI -IpIoTransmitHandler ( - IN EFI_EVENT Event, +IpIoTransmitHandlerDpc ( IN VOID *Context ) { @@ -556,11 +561,34 @@ IpIoTransmitHandler ( IpIoDestroySndEntry (SndEntry); } +/** + Notify function for IP transmit token. + + @param Event The event signaled. + @param Context The context passed in by the event notifier. + + @return None. + +**/ + +STATIC +VOID +EFIAPI +IpIoTransmitHandler ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // + // Request IpIoTransmitHandlerDpc as a DPC at TPL_CALLBACK + // + NetLibQueueDpc (TPL_CALLBACK, IpIoTransmitHandlerDpc, Context); +} + /** The dummy handler for the dummy IP receive token. - @param Evt The event signaled. @param Context The context passed in by the event notifier. @return None. @@ -569,20 +597,22 @@ IpIoTransmitHandler ( STATIC VOID EFIAPI -IpIoDummyHandler ( - IN EFI_EVENT Event, +IpIoDummyHandlerDpc ( IN VOID *Context ) { IP_IO_IP_INFO *IpInfo; EFI_IP4_COMPLETION_TOKEN *DummyToken; - ASSERT (Event && Context); - IpInfo = (IP_IO_IP_INFO *) Context; DummyToken = &(IpInfo->DummyRcvToken); - if (EFI_SUCCESS == DummyToken->Status) { + if (EFI_ABORTED == DummyToken->Status) { + // + // The reception is actively aborted by the consumer, directly return. + // + return; + } else if (EFI_SUCCESS == DummyToken->Status) { ASSERT (DummyToken->Packet.RxData); gBS->SignalEvent (DummyToken->Packet.RxData->RecycleSignal); @@ -593,8 +623,7 @@ IpIoDummyHandler ( /** - Notify function for the IP receive token, used to process - the received IP packets. + Request IpIoDummyHandlerDpc as a DPC at TPL_CALLBACK. @param Event The event signaled. @param Context The context passed in by the event notifier. @@ -605,11 +634,34 @@ IpIoDummyHandler ( STATIC VOID EFIAPI -IpIoListenHandler ( +IpIoDummyHandler ( IN EFI_EVENT Event, IN VOID *Context ) { + // + // Request IpIoDummyHandlerDpc as a DPC at TPL_CALLBACK + // + NetLibQueueDpc (TPL_CALLBACK, IpIoDummyHandlerDpc, Context); +} + + +/** + Notify function for the IP receive token, used to process + the received IP packets. + + @param Context The context passed in by the event notifier. + + @return None. + +**/ +STATIC +VOID +EFIAPI +IpIoListenHandlerDpc ( + IN VOID *Context + ) +{ IP_IO *IpIo; EFI_STATUS Status; EFI_IP4_RECEIVE_DATA *RxData; @@ -623,6 +675,13 @@ IpIoListenHandler ( Status = IpIo->RcvToken.Status; RxData = IpIo->RcvToken.Packet.RxData; + if (EFI_ABORTED == Status) { + // + // The reception is actively aborted by the consumer, directly return. + // + return; + } + if (((EFI_SUCCESS != Status) && (EFI_ICMP_ERROR != Status)) || (NULL == RxData)) { // // Only process the normal packets and the icmp error packets, if RxData is NULL @@ -690,6 +749,30 @@ Resume: /** + Request IpIoListenHandlerDpc as a DPC at TPL_CALLBACK + + @param Event The event signaled. + @param Context The context passed in by the event notifier. + + @return None. + +**/ +STATIC +VOID +EFIAPI +IpIoListenHandler ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // + // Request IpIoListenHandlerDpc as a DPC at TPL_CALLBACK + // + NetLibQueueDpc (TPL_CALLBACK, IpIoListenHandlerDpc, Context); +} + + +/** Create a new IP_IO instance. @param Image The image handle of an IP_IO consumer protocol. -- cgit v1.1