ShellPkg/Ping: fix loss of first packet
authorMeenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Fri, 16 Feb 2018 08:45:11 +0000 (14:15 +0530)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 23 Feb 2018 11:46:04 +0000 (12:46 +0100)
Issue:
Reply for first ping packet was getting dropped.

Cause:
Sometimes reply message comes even before trasmit
function returns, hence missing 1st reply

Fix:
Prepare the TxList before calling Transmit function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c

index bec9535..46ba701 100644 (file)
@@ -784,14 +784,17 @@ PingSendEchoRequest (
   }\r
 \r
   ASSERT(Private->ProtocolPointers.Transmit != NULL);\r
+\r
+  InsertTailList (&Private->TxList, &TxInfo->Link);\r
+\r
   Status = Private->ProtocolPointers.Transmit (Private->IpProtocol, TxInfo->Token);\r
 \r
   if (EFI_ERROR (Status)) {\r
+    RemoveEntryList (&TxInfo->Link);\r
     PingDestroyTxInfo (TxInfo, Private->IpChoice);\r
     return Status;\r
   }\r
 \r
-  InsertTailList (&Private->TxList, &TxInfo->Link);\r
   Private->TxCount++;\r
 \r
   return EFI_SUCCESS;\r