diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-11-20 05:42:23 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-11-20 05:42:23 +0000 |
commit | 36ee91ca3661d3d020a7841aacbf858d885c4728 (patch) | |
tree | 418e7a4d4a84d86a78d4b260acab20877be5bd45 /MdeModulePkg/Library | |
parent | 04e12c21476db29e8f92030ed00122fa4e1e56cc (diff) | |
download | edk2-platforms-36ee91ca3661d3d020a7841aacbf858d885c4728.tar.xz |
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
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r-- | MdeModulePkg/Library/DxeDpcLib/DpcLib.c | 104 | ||||
-rw-r--r-- | MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf | 46 | ||||
-rw-r--r-- | MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 109 | ||||
-rw-r--r-- | MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 72 | ||||
-rw-r--r-- | MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf | 3 | ||||
-rw-r--r-- | MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c | 117 |
6 files changed, 409 insertions, 42 deletions
diff --git a/MdeModulePkg/Library/DxeDpcLib/DpcLib.c b/MdeModulePkg/Library/DxeDpcLib/DpcLib.c new file mode 100644 index 0000000000..bc834f7a3e --- /dev/null +++ b/MdeModulePkg/Library/DxeDpcLib/DpcLib.c @@ -0,0 +1,104 @@ +/** @file
+
+Copyright (c) 2007, 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:
+
+ DpcLib.c
+
+Abstract:
+
+**/
+
+#include <PiDxe.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/Dpc.h>
+
+//
+// Pointer to the DPC Protocol
+//
+EFI_DPC_PROTOCOL *mDpc;
+
+/**
+ This constructor function caches the EFI_DPC_PROTOCOL pointer.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always return EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+DpcLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Locate the EFI_DPC_PROTOCOL in the handle database
+ //
+ Status = gBS->LocateProtocol (&gEfiDpcProtocolGuid, NULL, (VOID **)&mDpc);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Add a Deferred Procedure Call to the end of the DPC queue.
+
+ @param DpcTpl The EFI_TPL that the DPC should be invoked.
+ @param DpcProcedure Pointer to the DPC's function.
+ @param DpcContext Pointer to the DPC's context. Passed to DpcProcedure
+ when DpcProcedure is invoked.
+
+ @retval EFI_SUCCESS The DPC was queued.
+ @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.
+ @retval EFI_INVALID_PARAMETER DpcProcedure is NULL.
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to
+ add the DPC to the queue.
+
+**/
+EFI_STATUS
+QueueDpc (
+ IN EFI_TPL DpcTpl,
+ IN EFI_DPC_PROCEDURE DpcProcedure,
+ IN VOID *DpcContext
+ )
+{
+ //
+ // Call the EFI_DPC_PROTOCOL to queue the DPC
+ //
+ return mDpc->QueueDpc (mDpc, DpcTpl, DpcProcedure, DpcContext);
+}
+
+/**
+ Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl
+ value greater than or equal to the current TPL are invoked in the order that
+ they were queued. DPCs with higher DpcTpl values are invoked before DPCs with
+ lower DpcTpl values.
+
+ @retval EFI_SUCCESS One or more DPCs were invoked.
+ @retval EFI_NOT_FOUND No DPCs were invoked.
+
+**/
+EFI_STATUS
+DispatchDpc (
+ VOID
+ )
+{
+ //
+ // Call the EFI_DPC_PROTOCOL to dispatch previously queued DPCs
+ //
+ return mDpc->DispatchDpc (mDpc);
+}
diff --git a/MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf b/MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf new file mode 100644 index 0000000000..9268837ffe --- /dev/null +++ b/MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf @@ -0,0 +1,46 @@ +#/** @file
+# Component name for module DxeDpcLib
+#
+# Copyright (c) 2007, 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.
+#
+#
+#**/
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DxeDpcLib
+ FILE_GUID = 38897D86-FF36-4472-AE64-1DB9AE715C81
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = DpcLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
+ EDK_RELEASE_VERSION = 0x00020000
+ EFI_SPECIFICATION_VERSION = 0x00020000
+ CONSTRUCTOR = DpcLibConstructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources.common]
+ DpcLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ DebugLib
+ UefiBootServicesTableLib
+
+[Protocols]
+ gEfiDpcProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c index 608bdd297e..279ada7b11 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.
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index 0eee6076f7..f65489e7ed 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -36,6 +36,8 @@ Abstract: #include <Library/MemoryAllocationLib.h>
+EFI_DPC_PROTOCOL *mDpc = NULL;
+
//
// All the supported IP4 maskes in host byte order.
//
@@ -227,7 +229,7 @@ NetRandomInitSeed ( UINT32 Seed;
gRT->GetTime (&Time, NULL);
- Seed = (~Time.Hour << 24 | Time.Second << 16 | Time.Minute << 8 | Time.Day);
+ Seed = (~Time.Hour << 24 | Time.Day << 16 | Time.Minute << 8 | Time.Second);
Seed ^= Time.Nanosecond;
Seed ^= Time.Year << 7;
@@ -1276,3 +1278,71 @@ NetLibGetNicHandle ( return Handle;
}
+/**
+ Add a Deferred Procedure Call to the end of the DPC queue.
+
+ @DpcTpl The EFI_TPL that the DPC should be invoked.
+ @DpcProcedure Pointer to the DPC's function.
+ @DpcContext Pointer to the DPC's context. Passed to DpcProcedure
+ when DpcProcedure is invoked.
+
+ @retval EFI_SUCCESS The DPC was queued.
+ @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.
+ DpcProcedure is NULL.
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to
+ add the DPC to the queue.
+
+**/
+EFI_STATUS
+NetLibQueueDpc (
+ IN EFI_TPL DpcTpl,
+ IN EFI_DPC_PROCEDURE DpcProcedure,
+ IN VOID *DpcContext OPTIONAL
+ )
+{
+ return mDpc->QueueDpc (mDpc, DpcTpl, DpcProcedure, DpcContext);
+}
+
+/**
+ Add a Deferred Procedure Call to the end of the DPC queue.
+
+ @retval EFI_SUCCESS One or more DPCs were invoked.
+ @retval EFI_NOT_FOUND No DPCs were invoked.
+
+**/
+EFI_STATUS
+NetLibDispatchDpc (
+ VOID
+ )
+{
+ return mDpc->DispatchDpc(mDpc);
+}
+
+
+/**
+ The constructor function caches the pointer to DPC protocol.
+
+ The constructor function locates DPC protocol from protocol database.
+ It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+NetLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (&gEfiDpcProtocolGuid, NULL, (VOID**) &mDpc);
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (mDpc != NULL);
+
+ return Status;
+}
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf index 2bd876e9a0..deb8949924 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf @@ -25,6 +25,7 @@ EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
+ CONSTRUCTOR = NetLibConstructor
#
# The following information is for reference only and not required by the build tools.
@@ -43,7 +44,6 @@ [LibraryClasses]
- NetLib
BaseLib
DebugLib
BaseMemoryLib
@@ -55,3 +55,4 @@ [Protocols]
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiNicIp4ConfigProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiDpcProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c index d56456afb2..b1329f8604 100644 --- a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c +++ b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c @@ -35,6 +35,13 @@ Abstract: STATIC
VOID
EFIAPI
+UdpIoOnDgramSentDpc (
+ IN VOID *Context
+ );
+
+STATIC
+VOID
+EFIAPI
UdpIoOnDgramSent (
IN EFI_EVENT Event,
IN VOID *Context
@@ -100,7 +107,7 @@ UdpIoWrapTx ( Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
+ NET_TPL_EVENT,
UdpIoOnDgramSent,
Token,
&UdpToken->Event
@@ -202,7 +209,7 @@ UdpIoCreateRxToken ( Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
+ NET_TPL_EVENT,
UdpIoOnDgramRcvd,
Token,
&Token->UdpToken.Event
@@ -364,10 +371,7 @@ UdpIoCancelDgrams ( Token = NET_LIST_USER_STRUCT (Entry, UDP_TX_TOKEN, Link);
if ((ToCancel == NULL) || (ToCancel (Token, Context))) {
- NetListRemoveEntry (Entry);
UdpIo->Udp->Cancel (UdpIo->Udp, &Token->UdpToken);
- Token->CallBack (Token->Packet, NULL, IoStatus, Token->Context);
- UdpIoFreeTxToken (Token);
}
}
}
@@ -400,9 +404,7 @@ UdpIoFreePort ( UdpIoCancelDgrams (UdpIo, EFI_ABORTED, NULL, NULL);
if ((RxToken = UdpIo->RecvRequest) != NULL) {
- UdpIo->RecvRequest = NULL;
UdpIo->Udp->Cancel (UdpIo->Udp, &RxToken->UdpToken);
- UdpIoFreeRxToken (RxToken);
}
//
@@ -454,9 +456,7 @@ UdpIoCleanPort ( UdpIoCancelDgrams (UdpIo, EFI_ABORTED, NULL, NULL);
if ((RxToken = UdpIo->RecvRequest) != NULL) {
- UdpIo->RecvRequest = NULL;
UdpIo->Udp->Cancel (UdpIo->Udp, &RxToken->UdpToken);
- UdpIoFreeRxToken (RxToken);
}
UdpIo->Udp->Configure (UdpIo->Udp, NULL);
@@ -468,7 +468,6 @@ UdpIoCleanPort ( It will remove the packet from the local list then call
the packet owner's callback function.
- @param Event The event signalled.
@param Context The UDP TX Token.
@return None
@@ -477,8 +476,7 @@ UdpIoCleanPort ( STATIC
VOID
EFIAPI
-UdpIoOnDgramSent (
- IN EFI_EVENT Event,
+UdpIoOnDgramSentDpc (
IN VOID *Context
)
{
@@ -493,6 +491,29 @@ UdpIoOnDgramSent ( UdpIoFreeTxToken (Token);
}
+/**
+ Request UdpIoOnDgramSentDpc as a DPC at TPL_CALLBACK.
+
+ @param Event The event signalled.
+ @param Context The UDP TX Token.
+
+ @return None
+
+**/
+STATIC
+VOID
+EFIAPI
+UdpIoOnDgramSent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // Request UdpIoOnDgramSentDpc as a DPC at TPL_CALLBACK
+ //
+ NetLibQueueDpc (TPL_CALLBACK, UdpIoOnDgramSentDpc, Context);
+}
+
/**
Send a packet through the UDP IO port.
@@ -529,14 +550,18 @@ UdpIoSendDatagram ( return EFI_OUT_OF_RESOURCES;
}
+ //
+ // Insert the tx token into SendDatagram list before transmitting it. Remove
+ // it from the list if the returned status is not EFI_SUCCESS.
+ //
+ NetListInsertHead (&UdpIo->SentDatagram, &Token->Link);
Status = UdpIo->Udp->Transmit (UdpIo->Udp, &Token->UdpToken);
-
if (EFI_ERROR (Status)) {
+ NetListRemoveEntry (&Token->Link);
UdpIoFreeTxToken (Token);
return Status;
}
- NetListInsertHead (&UdpIo->SentDatagram, &Token->Link);
return EFI_SUCCESS;
}
@@ -609,13 +634,11 @@ UdpIoRecycleDgram ( UdpIoFreeRxToken (Token);
}
-
/**
The event handle for UDP receive request. It will build
a NET_BUF from the recieved UDP data, then deliver it
to the receiver.
- @param Event The UDP receive request event
@param Context The UDP RX token.
@return None
@@ -624,8 +647,7 @@ UdpIoRecycleDgram ( STATIC
VOID
EFIAPI
-UdpIoOnDgramRcvd (
- IN EFI_EVENT Event,
+UdpIoOnDgramRcvdDpc (
IN VOID *Context
)
{
@@ -651,10 +673,15 @@ UdpIoOnDgramRcvd ( UdpRxData = UdpToken->Packet.RxData;
if (EFI_ERROR (UdpToken->Status) || (UdpRxData == NULL)) {
- Token->CallBack (NULL, NULL, UdpToken->Status, Token->Context);
- UdpIoFreeRxToken (Token);
+ if (UdpToken->Status != EFI_ABORTED) {
+ //
+ // Invoke the CallBack only if the reception is not actively aborted.
+ //
+ Token->CallBack (NULL, NULL, UdpToken->Status, Token->Context);
+ }
- goto ON_EXIT;
+ UdpIoFreeRxToken (Token);
+ return;
}
//
@@ -674,7 +701,7 @@ UdpIoOnDgramRcvd ( Token->CallBack (NULL, NULL, EFI_OUT_OF_RESOURCES, Token->Context);
UdpIoFreeRxToken (Token);
- goto ON_EXIT;
+ return;
}
UdpSession = &UdpRxData->UdpSession;
@@ -687,9 +714,45 @@ UdpIoOnDgramRcvd ( Points.RemoteAddr = NTOHL (Points.RemoteAddr);
Token->CallBack (Netbuf, &Points, EFI_SUCCESS, Token->Context);
+}
+
+/**
+ Request UdpIoOnDgramRcvdDpc as a DPC at TPL_CALLBACK.
+
+ @param Event The UDP receive request event.
+ @param Context The UDP RX token.
+
+ @return None
+
+**/
+STATIC
+VOID
+EFIAPI
+UdpIoOnDgramRcvd (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+
+Routine Description:
+
+ Request UdpIoOnDgramRcvdDpc as a DPC at TPL_CALLBACK
+
+Arguments:
+
+ Event - The UDP receive request event
+ Context - The UDP RX token.
+
+Returns:
-ON_EXIT:
- return;
+ None
+
+--*/
+{
+ //
+ // Request UdpIoOnDgramRcvdDpc as a DPC at TPL_CALLBACK
+ //
+ NetLibQueueDpc (TPL_CALLBACK, UdpIoOnDgramRcvdDpc, Context);
}
@@ -729,13 +792,13 @@ UdpIoRecvDatagram ( return EFI_OUT_OF_RESOURCES;
}
+ UdpIo->RecvRequest = Token;
Status = UdpIo->Udp->Receive (UdpIo->Udp, &Token->UdpToken);
if (EFI_ERROR (Status)) {
+ UdpIo->RecvRequest = NULL;
UdpIoFreeRxToken (Token);
- return Status;
}
- UdpIo->RecvRequest = Token;
- return EFI_SUCCESS;
+ return Status;
}
|