NetworkPkg: Recycle the ICMP error message in PXE driver.

This patch updates PxeBcIcmpErrorDpcHandle() and PxeBcIcmp6ErrorDpcHandle() to
recycle the ICMP packet after copy it to PXE mode data.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
Fu Siyuan 2017-12-21 15:19:26 +08:00
parent 673abfb749
commit 3c06e6a9e2
1 changed files with 14 additions and 16 deletions

View File

@ -257,8 +257,7 @@ PxeBcIcmpErrorDpcHandle (
// //
// The return status should be recognized as EFI_ICMP_ERROR. // The return status should be recognized as EFI_ICMP_ERROR.
// //
gBS->SignalEvent (RxData->RecycleSignal); goto ON_RECYCLE;
goto ON_EXIT;
} }
if (EFI_IP4 (RxData->Header->SourceAddress) != 0 && if (EFI_IP4 (RxData->Header->SourceAddress) != 0 &&
@ -268,16 +267,14 @@ PxeBcIcmpErrorDpcHandle (
// //
// The source address of the received packet should be a valid unicast address. // The source address of the received packet should be a valid unicast address.
// //
gBS->SignalEvent (RxData->RecycleSignal); goto ON_RECYCLE;
goto ON_EXIT;
} }
if (!EFI_IP4_EQUAL (&RxData->Header->DestinationAddress, &Mode->StationIp.v4)) { if (!EFI_IP4_EQUAL (&RxData->Header->DestinationAddress, &Mode->StationIp.v4)) {
// //
// The destination address of the received packet should be equal to the host address. // The destination address of the received packet should be equal to the host address.
// //
gBS->SignalEvent (RxData->RecycleSignal); goto ON_RECYCLE;
goto ON_EXIT;
} }
// //
@ -295,8 +292,7 @@ PxeBcIcmpErrorDpcHandle (
// //
// The type of the receveid ICMP message should be ICMP_ERROR_MESSAGE. // The type of the receveid ICMP message should be ICMP_ERROR_MESSAGE.
// //
gBS->SignalEvent (RxData->RecycleSignal); goto ON_RECYCLE;
goto ON_EXIT;
} }
// //
@ -323,6 +319,9 @@ PxeBcIcmpErrorDpcHandle (
IcmpError += CopiedLen; IcmpError += CopiedLen;
} }
ON_RECYCLE:
gBS->SignalEvent (RxData->RecycleSignal);
ON_EXIT: ON_EXIT:
Private->IcmpToken.Status = EFI_NOT_READY; Private->IcmpToken.Status = EFI_NOT_READY;
Ip4->Receive (Ip4, &Private->IcmpToken); Ip4->Receive (Ip4, &Private->IcmpToken);
@ -392,16 +391,14 @@ PxeBcIcmp6ErrorDpcHandle (
// //
// The return status should be recognized as EFI_ICMP_ERROR. // The return status should be recognized as EFI_ICMP_ERROR.
// //
gBS->SignalEvent (RxData->RecycleSignal); goto ON_RECYCLE;
goto ON_EXIT;
} }
if (!NetIp6IsValidUnicast (&RxData->Header->SourceAddress)) { if (!NetIp6IsValidUnicast (&RxData->Header->SourceAddress)) {
// //
// The source address of the received packet should be a valid unicast address. // The source address of the received packet should be a valid unicast address.
// //
gBS->SignalEvent (RxData->RecycleSignal); goto ON_RECYCLE;
goto ON_EXIT;
} }
if (!NetIp6IsUnspecifiedAddr (&Mode->StationIp.v6) && if (!NetIp6IsUnspecifiedAddr (&Mode->StationIp.v6) &&
@ -409,8 +406,7 @@ PxeBcIcmp6ErrorDpcHandle (
// //
// The destination address of the received packet should be equal to the host address. // The destination address of the received packet should be equal to the host address.
// //
gBS->SignalEvent (RxData->RecycleSignal); goto ON_RECYCLE;
goto ON_EXIT;
} }
// //
@ -427,8 +423,7 @@ PxeBcIcmp6ErrorDpcHandle (
// //
// The type of the receveid packet should be an ICMP6 error message. // The type of the receveid packet should be an ICMP6 error message.
// //
gBS->SignalEvent (RxData->RecycleSignal); goto ON_RECYCLE;
goto ON_EXIT;
} }
// //
@ -455,6 +450,9 @@ PxeBcIcmp6ErrorDpcHandle (
Icmp6Error += CopiedLen; Icmp6Error += CopiedLen;
} }
ON_RECYCLE:
gBS->SignalEvent (RxData->RecycleSignal);
ON_EXIT: ON_EXIT:
Private->Icmp6Token.Status = EFI_NOT_READY; Private->Icmp6Token.Status = EFI_NOT_READY;
Ip6->Receive (Ip6, &Private->Icmp6Token); Ip6->Receive (Ip6, &Private->Icmp6Token);