0\r
};\r
\r
+STATIC ICMP_ERROR_INFO mIcmpErrMap[10] = {\r
+ {FALSE, TRUE},\r
+ {FALSE, TRUE},\r
+ {TRUE, TRUE},\r
+ {TRUE, TRUE},\r
+ {TRUE, TRUE},\r
+ {FALSE, TRUE},\r
+ {FALSE, TRUE},\r
+ {FALSE, TRUE},\r
+ {FALSE, FALSE},\r
+ {FALSE, TRUE}\r
+};\r
+\r
+STATIC\r
+VOID\r
+EFIAPI\r
+IpIoTransmitHandlerDpc (\r
+ IN VOID *Context\r
+ );\r
+\r
STATIC\r
VOID\r
EFIAPI\r
//\r
// Set the fields of OverrideData\r
//\r
- NetCopyMem (OverrideData, Override, sizeof (*OverrideData));\r
+ CopyMem (OverrideData, Override, sizeof (*OverrideData));\r
}\r
\r
//\r
/**\r
Notify function for IP transmit token.\r
\r
- @param Event The event signaled.\r
@param Context The context passed in by the event notifier.\r
\r
@return None.\r
STATIC\r
VOID\r
EFIAPI\r
-IpIoTransmitHandler (\r
- IN EFI_EVENT Event,\r
+IpIoTransmitHandlerDpc (\r
IN VOID *Context\r
)\r
{\r
IpIoDestroySndEntry (SndEntry);\r
}\r
\r
+/**\r
+ Notify function for IP transmit token.\r
+\r
+ @param Event The event signaled.\r
+ @param Context The context passed in by the event notifier.\r
+\r
+ @return None.\r
+\r
+**/\r
+\r
+STATIC\r
+VOID\r
+EFIAPI\r
+IpIoTransmitHandler (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ //\r
+ // Request IpIoTransmitHandlerDpc as a DPC at TPL_CALLBACK\r
+ //\r
+ NetLibQueueDpc (TPL_CALLBACK, IpIoTransmitHandlerDpc, Context);\r
+}\r
+\r
\r
/**\r
The dummy handler for the dummy IP receive token.\r
\r
- @param Evt The event signaled.\r
@param Context The context passed in by the event notifier.\r
\r
@return None.\r
STATIC\r
VOID\r
EFIAPI\r
-IpIoDummyHandler (\r
- IN EFI_EVENT Event,\r
+IpIoDummyHandlerDpc (\r
IN VOID *Context\r
)\r
{\r
IP_IO_IP_INFO *IpInfo;\r
EFI_IP4_COMPLETION_TOKEN *DummyToken;\r
\r
- ASSERT (Event && Context);\r
-\r
IpInfo = (IP_IO_IP_INFO *) Context;\r
DummyToken = &(IpInfo->DummyRcvToken);\r
\r
- if (EFI_SUCCESS == DummyToken->Status) {\r
+ if (EFI_ABORTED == DummyToken->Status) {\r
+ //\r
+ // The reception is actively aborted by the consumer, directly return.\r
+ //\r
+ return;\r
+ } else if (EFI_SUCCESS == DummyToken->Status) {\r
ASSERT (DummyToken->Packet.RxData);\r
\r
gBS->SignalEvent (DummyToken->Packet.RxData->RecycleSignal);\r
\r
\r
/**\r
- Notify function for the IP receive token, used to process\r
- the received IP packets.\r
+ Request IpIoDummyHandlerDpc as a DPC at TPL_CALLBACK.\r
\r
@param Event The event signaled.\r
@param Context The context passed in by the event notifier.\r
STATIC\r
VOID\r
EFIAPI\r
-IpIoListenHandler (\r
+IpIoDummyHandler (\r
IN EFI_EVENT Event,\r
IN VOID *Context\r
)\r
+{\r
+ //\r
+ // Request IpIoDummyHandlerDpc as a DPC at TPL_CALLBACK\r
+ //\r
+ NetLibQueueDpc (TPL_CALLBACK, IpIoDummyHandlerDpc, Context);\r
+}\r
+\r
+\r
+/**\r
+ Notify function for the IP receive token, used to process\r
+ the received IP packets.\r
+\r
+ @param Context The context passed in by the event notifier.\r
+\r
+ @return None.\r
+\r
+**/\r
+STATIC\r
+VOID\r
+EFIAPI\r
+IpIoListenHandlerDpc (\r
+ IN VOID *Context\r
+ )\r
{\r
IP_IO *IpIo;\r
EFI_STATUS Status;\r
Status = IpIo->RcvToken.Status;\r
RxData = IpIo->RcvToken.Packet.RxData;\r
\r
+ if (EFI_ABORTED == Status) {\r
+ //\r
+ // The reception is actively aborted by the consumer, directly return.\r
+ //\r
+ return;\r
+ }\r
+\r
if (((EFI_SUCCESS != Status) && (EFI_ICMP_ERROR != Status)) || (NULL == RxData)) {\r
//\r
// Only process the normal packets and the icmp error packets, if RxData is NULL\r
}\r
\r
\r
+/**\r
+ Request IpIoListenHandlerDpc as a DPC at TPL_CALLBACK\r
+\r
+ @param Event The event signaled.\r
+ @param Context The context passed in by the event notifier.\r
+\r
+ @return None.\r
+\r
+**/\r
+STATIC\r
+VOID\r
+EFIAPI\r
+IpIoListenHandler (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ //\r
+ // Request IpIoListenHandlerDpc as a DPC at TPL_CALLBACK\r
+ //\r
+ NetLibQueueDpc (TPL_CALLBACK, IpIoListenHandlerDpc, Context);\r
+}\r
+\r
+\r
/**\r
Create a new IP_IO instance.\r
\r
Ip = SndEntry->Ip;\r
Ip->Cancel (Ip, SndEntry->SndToken);\r
\r
- //\r
- // Abort the user token.\r
- //\r
- SndEntry->SndToken->Status = EFI_ABORTED;\r
- IpIoTransmitHandler (NULL, SndEntry);\r
-\r
break;\r
}\r
}\r
OUT BOOLEAN *Notify OPTIONAL\r
)\r
{\r
- ICMP_ERROR_INFO IcmpErrMap[10];\r
-\r
- IcmpErrMap[0].Error = EFI_NETWORK_UNREACHABLE;\r
- IcmpErrMap[0].IsHard = FALSE;\r
- IcmpErrMap[0].Notify = TRUE;\r
-\r
- IcmpErrMap[1].Error = EFI_HOST_UNREACHABLE;\r
- IcmpErrMap[1].IsHard = FALSE;\r
- IcmpErrMap[1].Notify = TRUE;\r
-\r
- IcmpErrMap[2].Error = EFI_PROTOCOL_UNREACHABLE;\r
- IcmpErrMap[2].IsHard = TRUE;\r
- IcmpErrMap[2].Notify = TRUE;\r
-\r
- IcmpErrMap[3].Error = EFI_PORT_UNREACHABLE;\r
- IcmpErrMap[3].IsHard = TRUE;\r
- IcmpErrMap[3].Notify = TRUE;\r
-\r
- IcmpErrMap[4].Error = EFI_ICMP_ERROR;\r
- IcmpErrMap[4].IsHard = TRUE;\r
- IcmpErrMap[4].Notify = TRUE;\r
+ ASSERT ((IcmpError >= ICMP_ERR_UNREACH_NET) && (IcmpError <= ICMP_ERR_PARAMPROB));\r
\r
- IcmpErrMap[5].Error = EFI_ICMP_ERROR;\r
- IcmpErrMap[5].IsHard = FALSE;\r
- IcmpErrMap[5].Notify = TRUE;\r
+ if (IsHard != NULL) {\r
+ *IsHard = mIcmpErrMap[IcmpError].IsHard;\r
+ }\r
\r
- IcmpErrMap[6].Error = EFI_HOST_UNREACHABLE;\r
- IcmpErrMap[6].IsHard = FALSE;\r
- IcmpErrMap[6].Notify = TRUE;\r
+ if (Notify != NULL) {\r
+ *Notify = mIcmpErrMap[IcmpError].Notify;\r
+ }\r
\r
- IcmpErrMap[7].Error = EFI_HOST_UNREACHABLE;\r
- IcmpErrMap[7].IsHard = FALSE;\r
- IcmpErrMap[7].Notify = TRUE;\r
+ switch (IcmpError) {\r
+ case ICMP_ERR_UNREACH_NET:\r
+ return EFI_NETWORK_UNREACHABLE;\r
\r
- IcmpErrMap[8].Error = EFI_ICMP_ERROR;\r
- IcmpErrMap[8].IsHard = FALSE;\r
- IcmpErrMap[8].Notify = FALSE;\r
+ case ICMP_ERR_TIMXCEED_INTRANS:\r
+ case ICMP_ERR_TIMXCEED_REASS:\r
+ case ICMP_ERR_UNREACH_HOST:\r
+ return EFI_HOST_UNREACHABLE;\r
\r
- IcmpErrMap[9].Error = EFI_ICMP_ERROR;\r
- IcmpErrMap[9].IsHard = FALSE;\r
- IcmpErrMap[9].Notify = TRUE;\r
+ case ICMP_ERR_UNREACH_PROTOCOL:\r
+ return EFI_PROTOCOL_UNREACHABLE;\r
\r
- ASSERT ((IcmpError >= ICMP_ERR_UNREACH_NET) && (IcmpError <= ICMP_ERR_PARAMPROB));\r
+ case ICMP_ERR_UNREACH_PORT:\r
+ return EFI_PORT_UNREACHABLE;\r
\r
- if (IsHard != NULL) {\r
- *IsHard = IcmpErrMap[IcmpError].IsHard;\r
- }\r
-\r
- if (Notify != NULL) {\r
- *Notify = IcmpErrMap[IcmpError].Notify;\r
+ case ICMP_ERR_MSGSIZE:\r
+ case ICMP_ERR_UNREACH_SRCFAIL:\r
+ case ICMP_ERR_QUENCH:\r
+ case ICMP_ERR_PARAMPROB:\r
+ return EFI_ICMP_ERROR;\r
}\r
\r
- return IcmpErrMap[IcmpError].Error;\r
+ //\r
+ // will never run here!\r
+ //\r
+ ASSERT (FALSE);\r
+ return EFI_UNSUPPORTED;\r
}\r
\r