From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web09.3830.1644038399934169309 for ; Fri, 04 Feb 2022 21:20:01 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=OdjFKBZJ; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: mohammedx.rehan@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644038400; x=1675574400; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=xstYd60fr4gmg68TIq2LPgxNYjgYdgrneYl/GeP/3io=; b=OdjFKBZJlCmWkMS9CHng53ypnwGQZNKWvMBWzNqWdJ90vWLaZ+EU9+h/ z38l1TXsJxETysxtohbGISktBismbgp8GwJuX0y3v7lqxdH7O7ve0N3Cf EkQPiO7K0UVzBw7N0pLATSSqCokpItQd8W3LEGjcRWhBpmYeolPe2ZPO3 toLAdzmEqnZBuoUj0Bx35KmeZ875vGncqLiSnlDweZf8bdtxIB2GqEdhl pZsGP+NzyVyb8DF2b4JzN23CjxOpg2foXAysx3N/jvbJsdWSEecujlI4A 9eGWfB/5ihfi5wUzezDErYYiQyLvhEfZmpRuazYPm660sCkuB39yTyALA A==; X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="235888996" X-IronPort-AV: E=Sophos;i="5.88,344,1635231600"; d="scan'208";a="235888996" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 21:19:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,344,1635231600"; d="scan'208";a="600422894" Received: from babios003.gar.corp.intel.com ([10.66.244.222]) by fmsmga004.fm.intel.com with ESMTP; 04 Feb 2022 21:19:57 -0800 From: mohammedx.rehan@intel.com To: devel@edk2.groups.io Cc: MohammedX Rehan Subject: [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure Date: Sat, 5 Feb 2022 10:49:54 +0530 Message-Id: X-Mailer: git-send-email 2.30.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3819 Ping GetTimerPeriod API returns sometime zero value when StallCounter has smaller value than RttTimerTick (divide by zero) which results some failure at ping UEFI shell command Change-Id: I1d84fa1614278c77535b92255f875718b0376aef Signed-off-by: MohammedX Rehan --- ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/ShellPk= g/Library/UefiShellNetwork1CommandsLib/Ping.c index ec1e0a188b..93656e67c1 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c @@ -259,9 +259,11 @@ GetTimerPeriod ( EFI_EVENT TimerEvent;=0D UINT32 StallCounter;=0D EFI_TPL OldTpl;=0D + UINT32 TimerPeriod;=0D =0D RttTimerTick =3D 0;=0D StallCounter =3D 0;=0D + TimerPeriod =3D 0;=0D =0D Status =3D gBS->CreateEvent (=0D EVT_TIMER | EVT_NOTIFY_SIGNAL,=0D @@ -295,7 +297,12 @@ GetTimerPeriod ( gBS->SetTimer (TimerEvent, TimerCancel, 0);=0D gBS->CloseEvent (TimerEvent);=0D =0D - return StallCounter / RttTimerTick;=0D + TimerPeriod =3D StallCounter / RttTimerTick;=0D + if (TimerPeriod) {=0D + return TimerPeriod;=0D + } else {=0D + return 1;=0D + }=0D }=0D =0D /**=0D --=20 2.30.0.windows.2