public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Rehan, MohammedX" <mohammedx.rehan@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Esakkithevar, Kathappan" <kathappan.esakkithevar@intel.com>,
	"Gao, Zhichao" <zhichao.gao@intel.com>,
	"Pethaiyan, Madhan" <madhan.pethaiyan@intel.com>
Cc: "Thirupugal, MadhaviX" <madhavix.thirupugal@intel.com>
Subject: Re: [PATCH V2 1/1] ShellPkg: Fix Ping GetTimerPeriod API failure
Date: Fri, 11 Feb 2022 07:28:50 +0000	[thread overview]
Message-ID: <MWHPR11MB1631B87B202C5BD3297E4F938C309@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <12a69cc925bcd95320cf9a62c88f961b13203bf2.1644475548.git.mohammedx.rehan@intel.com>

Reviewed-by: Ray Ni <ray.ni@intel.com>

-----Original Message-----
From: Rehan, MohammedX <mohammedx.rehan@intel.com> 
Sent: Thursday, February 10, 2022 2:51 PM
To: devel@edk2.groups.io; Esakkithevar, Kathappan <kathappan.esakkithevar@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Ni, Ray <ray.ni@intel.com>; Pethaiyan, Madhan <madhan.pethaiyan@intel.com>
Cc: Thirupugal, MadhaviX <madhavix.thirupugal@intel.com>; Rehan, MohammedX <mohammedx.rehan@intel.com>
Subject: [PATCH V2 1/1] ShellPkg: Fix Ping GetTimerPeriod API failure

[edk2-devel] [Patch V2 1/1]
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3819

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

Signed-off-by: MohammedX Rehan <mohammedx.rehan@intel.com>
Change-Id: I4458577c921b3748102da385d2f48a21680f5687
Signed-off-by: MohammedX Rehan <mohammedx.rehan@intel.com>
---
 ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
index ec1e0a188b..6a002b15e5 100644
--- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
@@ -259,9 +259,11 @@ GetTimerPeriod (
   EFI_EVENT   TimerEvent;

   UINT32      StallCounter;

   EFI_TPL     OldTpl;

+  UINT32      TimerPeriod;

 

   RttTimerTick = 0;

   StallCounter = 0;

+  TimerPeriod  = 0;

 

   Status = gBS->CreateEvent (

                   EVT_TIMER | EVT_NOTIFY_SIGNAL,

@@ -295,7 +297,12 @@ GetTimerPeriod (
   gBS->SetTimer (TimerEvent, TimerCancel, 0);

   gBS->CloseEvent (TimerEvent);

 

-  return StallCounter / RttTimerTick;

+  TimerPeriod = StallCounter / RttTimerTick;

+  if (TimerPeriod != 0) {

+    return TimerPeriod;

+  } else {

+    return 1;

+  }

 }

 

 /**

-- 
2.30.0.windows.2


  reply	other threads:[~2022-02-11  7:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10  6:51 [PATCH V2 1/1] ShellPkg: Fix Ping GetTimerPeriod API failure MohammedX Rehan
2022-02-11  7:28 ` Ni, Ray [this message]
2022-02-11  7:33   ` Gao, Zhichao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR11MB1631B87B202C5BD3297E4F938C309@MWHPR11MB1631.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox