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
This commit is contained in:
vanjeff
2007-11-20 05:42:23 +00:00
parent 04e12c2147
commit 36ee91ca36
48 changed files with 1835 additions and 543 deletions

View File

@@ -71,6 +71,13 @@ STATIC ICMP_ERROR_INFO mIcmpErrMap[10] = {
{FALSE, TRUE}
};
STATIC
VOID
EFIAPI
IpIoTransmitHandlerDpc (
IN VOID *Context
);
STATIC
VOID
EFIAPI
@@ -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,71 @@ 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.
**/
STATIC
VOID
EFIAPI
IpIoDummyHandlerDpc (
IN VOID *Context
)
{
IP_IO_IP_INFO *IpInfo;
EFI_IP4_COMPLETION_TOKEN *DummyToken;
IpInfo = (IP_IO_IP_INFO *) Context;
DummyToken = &(IpInfo->DummyRcvToken);
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);
}
IpInfo->Ip->Receive (IpInfo->Ip, DummyToken);
}
/**
Request IpIoDummyHandlerDpc as a DPC at TPL_CALLBACK.
@param Event The event signaled.
@param Context The context passed in by the event notifier.
@return None.
@@ -574,21 +639,10 @@ IpIoDummyHandler (
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) {
ASSERT (DummyToken->Packet.RxData);
gBS->SignalEvent (DummyToken->Packet.RxData->RecycleSignal);
}
IpInfo->Ip->Receive (IpInfo->Ip, DummyToken);
//
// Request IpIoDummyHandlerDpc as a DPC at TPL_CALLBACK
//
NetLibQueueDpc (TPL_CALLBACK, IpIoDummyHandlerDpc, Context);
}
@@ -596,7 +650,6 @@ IpIoDummyHandler (
Notify function for the IP receive token, used to process
the received IP packets.
@param Event The event signaled.
@param Context The context passed in by the event notifier.
@return None.
@@ -605,8 +658,7 @@ IpIoDummyHandler (
STATIC
VOID
EFIAPI
IpIoListenHandler (
IN EFI_EVENT Event,
IpIoListenHandlerDpc (
IN VOID *Context
)
{
@@ -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
@@ -689,6 +748,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.