From 3c06e6a9e28c5c1057ecf3b097a76e77474266c7 Mon Sep 17 00:00:00 2001 From: Fu Siyuan Date: Thu, 21 Dec 2017 15:19:26 +0800 Subject: 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 Reviewed-by: Jiaxin Wu --- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c index 7202875..47bb7c5 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c @@ -257,8 +257,7 @@ PxeBcIcmpErrorDpcHandle ( // // The return status should be recognized as EFI_ICMP_ERROR. // - gBS->SignalEvent (RxData->RecycleSignal); - goto ON_EXIT; + goto ON_RECYCLE; } 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. // - gBS->SignalEvent (RxData->RecycleSignal); - goto ON_EXIT; + goto ON_RECYCLE; } if (!EFI_IP4_EQUAL (&RxData->Header->DestinationAddress, &Mode->StationIp.v4)) { // // The destination address of the received packet should be equal to the host address. // - gBS->SignalEvent (RxData->RecycleSignal); - goto ON_EXIT; + goto ON_RECYCLE; } // @@ -295,8 +292,7 @@ PxeBcIcmpErrorDpcHandle ( // // The type of the receveid ICMP message should be ICMP_ERROR_MESSAGE. // - gBS->SignalEvent (RxData->RecycleSignal); - goto ON_EXIT; + goto ON_RECYCLE; } // @@ -323,6 +319,9 @@ PxeBcIcmpErrorDpcHandle ( IcmpError += CopiedLen; } +ON_RECYCLE: + gBS->SignalEvent (RxData->RecycleSignal); + ON_EXIT: Private->IcmpToken.Status = EFI_NOT_READY; Ip4->Receive (Ip4, &Private->IcmpToken); @@ -392,16 +391,14 @@ PxeBcIcmp6ErrorDpcHandle ( // // The return status should be recognized as EFI_ICMP_ERROR. // - gBS->SignalEvent (RxData->RecycleSignal); - goto ON_EXIT; + goto ON_RECYCLE; } if (!NetIp6IsValidUnicast (&RxData->Header->SourceAddress)) { // // The source address of the received packet should be a valid unicast address. // - gBS->SignalEvent (RxData->RecycleSignal); - goto ON_EXIT; + goto ON_RECYCLE; } if (!NetIp6IsUnspecifiedAddr (&Mode->StationIp.v6) && @@ -409,8 +406,7 @@ PxeBcIcmp6ErrorDpcHandle ( // // The destination address of the received packet should be equal to the host address. // - gBS->SignalEvent (RxData->RecycleSignal); - goto ON_EXIT; + goto ON_RECYCLE; } // @@ -427,8 +423,7 @@ PxeBcIcmp6ErrorDpcHandle ( // // The type of the receveid packet should be an ICMP6 error message. // - gBS->SignalEvent (RxData->RecycleSignal); - goto ON_EXIT; + goto ON_RECYCLE; } // @@ -455,6 +450,9 @@ PxeBcIcmp6ErrorDpcHandle ( Icmp6Error += CopiedLen; } +ON_RECYCLE: + gBS->SignalEvent (RxData->RecycleSignal); + ON_EXIT: Private->Icmp6Token.Status = EFI_NOT_READY; Ip6->Receive (Ip6, &Private->Icmp6Token); -- cgit v1.1