From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web09.6981.1644475880726751158 for ; Wed, 09 Feb 2022 22:51:20 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=jjaOusHt; spf=pass (domain: intel.com, ip: 192.55.52.151, 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=1644475880; x=1676011880; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ax0XHR+JrSIz21B6nw4lA5hfCdq4aoo89Yoh5kuCsnQ=; b=jjaOusHtXknDm8wuOadXbM1VLh1fhKrkAkUsHDl+TUx6keOOEArse7tt zsg+WHBth0RUkxcCUJi886sa1EplHR222VVbR/r4p5dUUGBC946e8z7F3 Hk/t7qtlNQf1lUlQQagBcNvz2jM3EpzNuJq3CE5eTbRGjoOsQQ5r2/bwq gjNL3nUsJV+cibSaqXOlBLtu7XdN97qbkOmHCocl3Elt7RI6TcfrhPsmk xIG3c63qvK7dCk1LOVzh5YwqKryCaj9Ussg8NWYjOkTdsukK1/yNJKQIZ T1A78oK9czl+XqJG8bjczWxK55JD9nPPOyFcUTeAKWm2DzHNsFQxTLyIi g==; X-IronPort-AV: E=McAfee;i="6200,9189,10253"; a="230071842" X-IronPort-AV: E=Sophos;i="5.88,358,1635231600"; d="scan'208";a="230071842" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 22:51:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,358,1635231600"; d="scan'208";a="679047127" Received: from babios003.gar.corp.intel.com ([10.66.244.222]) by fmsmga001.fm.intel.com with ESMTP; 09 Feb 2022 22:51:18 -0800 From: "MohammedX Rehan" To: devel@edk2.groups.io, kathappan.esakkithevar@intel.com, zhichao.gao@intel.com, ray.ni@intel.com, madhan.pethaiyan@intel.com Cc: madhavix.thirupugal@intel.com, MohammedX Rehan Subject: [PATCH V2 1/1] ShellPkg: Fix Ping GetTimerPeriod API failure Date: Thu, 10 Feb 2022 12:21:14 +0530 Message-Id: <12a69cc925bcd95320cf9a62c88f961b13203bf2.1644475548.git.mohammedx.rehan@intel.com> X-Mailer: git-send-email 2.30.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [edk2-devel] [Patch V2 1/1] 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 Signed-off-by: MohammedX Rehan Change-Id: I4458577c921b3748102da385d2f48a21680f5687 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..6a002b15e5 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 !=3D 0) {=0D + return TimerPeriod;=0D + } else {=0D + return 1;=0D + }=0D }=0D =0D /**=0D --=20 2.30.0.windows.2