* [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure
@ 2022-02-15 8:07 MohammedX Rehan
2022-02-15 8:09 ` Gao, Zhichao
0 siblings, 1 reply; 6+ messages in thread
From: MohammedX Rehan @ 2022-02-15 8:07 UTC (permalink / raw)
To: devel, kathappan.esakkithevar, zhichao.gao, ray.ni,
madhan.pethaiyan
Cc: madhavix.thirupugal, MohammedX Rehan
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>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure
2022-02-15 8:07 [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure MohammedX Rehan
@ 2022-02-15 8:09 ` Gao, Zhichao
2022-02-16 6:34 ` Ni, Ray
0 siblings, 1 reply; 6+ messages in thread
From: Gao, Zhichao @ 2022-02-15 8:09 UTC (permalink / raw)
To: Rehan, MohammedX, devel@edk2.groups.io, Esakkithevar, Kathappan,
Ni, Ray, Pethaiyan, Madhan
Cc: Thirupugal, MadhaviX
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Thanks,
Zhichao
> -----Original Message-----
> From: Rehan, MohammedX <mohammedx.rehan@intel.com>
> Sent: Tuesday, February 15, 2022 4:07 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] ShellPkg: Fix Ping GetTimerPeriod API failure
>
> 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>
> ---
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure
2022-02-15 8:09 ` Gao, Zhichao
@ 2022-02-16 6:34 ` Ni, Ray
0 siblings, 0 replies; 6+ messages in thread
From: Ni, Ray @ 2022-02-16 6:34 UTC (permalink / raw)
To: Gao, Zhichao, Rehan, MohammedX, devel@edk2.groups.io,
Esakkithevar, Kathappan, Pethaiyan, Madhan
Cc: Thirupugal, MadhaviX
Reviewed-by: Ray Ni <ray.ni@intel.com>
-----Original Message-----
From: Gao, Zhichao <zhichao.gao@intel.com>
Sent: Tuesday, February 15, 2022 4:10 PM
To: Rehan, MohammedX <mohammedx.rehan@intel.com>; devel@edk2.groups.io; Esakkithevar, Kathappan <kathappan.esakkithevar@intel.com>; Ni, Ray <ray.ni@intel.com>; Pethaiyan, Madhan <madhan.pethaiyan@intel.com>
Cc: Thirupugal, MadhaviX <madhavix.thirupugal@intel.com>
Subject: RE: [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Thanks,
Zhichao
> -----Original Message-----
> From: Rehan, MohammedX <mohammedx.rehan@intel.com>
> Sent: Tuesday, February 15, 2022 4:07 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] ShellPkg: Fix Ping GetTimerPeriod API failure
>
> 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>
> ---
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure
@ 2022-02-05 5:19 mohammedx.rehan
2022-02-10 2:46 ` Ni, Ray
0 siblings, 1 reply; 6+ messages in thread
From: mohammedx.rehan @ 2022-02-05 5:19 UTC (permalink / raw)
To: devel; +Cc: MohammedX Rehan
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
Change-Id: I1d84fa1614278c77535b92255f875718b0376aef
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..93656e67c1 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) {
+ return TimerPeriod;
+ } else {
+ return 1;
+ }
}
/**
--
2.30.0.windows.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure
2022-02-05 5:19 mohammedx.rehan
@ 2022-02-10 2:46 ` Ni, Ray
2022-02-10 6:59 ` MohammedX Rehan
0 siblings, 1 reply; 6+ messages in thread
From: Ni, Ray @ 2022-02-10 2:46 UTC (permalink / raw)
To: Rehan, MohammedX, devel@edk2.groups.io, Gao, Zhichao,
Esakkithevar, Kathappan, Pethaiyan, Madhan
Cc: Thirupugal, MadhaviX
+ if (TimerPeriod) {
Please use "if (TimerPeriod != 0)"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure
2022-02-10 2:46 ` Ni, Ray
@ 2022-02-10 6:59 ` MohammedX Rehan
0 siblings, 0 replies; 6+ messages in thread
From: MohammedX Rehan @ 2022-02-10 6:59 UTC (permalink / raw)
To: Ni, Ray, devel@edk2.groups.io, Gao, Zhichao,
Esakkithevar, Kathappan, Pethaiyan, Madhan
Cc: Thirupugal, MadhaviX
Done the below changes and raise new patch.
-----Original Message-----
From: Ni, Ray <ray.ni@intel.com>
Sent: Thursday, February 10, 2022 8:17 AM
To: Rehan, MohammedX <mohammedx.rehan@intel.com>; devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Esakkithevar, Kathappan <kathappan.esakkithevar@intel.com>; Pethaiyan, Madhan <madhan.pethaiyan@intel.com>
Cc: Thirupugal, MadhaviX <madhavix.thirupugal@intel.com>
Subject: RE: [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure
+ if (TimerPeriod) {
Please use "if (TimerPeriod != 0)"
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-16 6:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-15 8:07 [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure MohammedX Rehan
2022-02-15 8:09 ` Gao, Zhichao
2022-02-16 6:34 ` Ni, Ray
-- strict thread matches above, loose matches on Subject: below --
2022-02-05 5:19 mohammedx.rehan
2022-02-10 2:46 ` Ni, Ray
2022-02-10 6:59 ` MohammedX Rehan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox