From nobody Fri May 17 04:49:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+86679+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+86679+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1644912452900313.8819038082961; Tue, 15 Feb 2022 00:07:32 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id S8sqYY1788612xQzsLPxaVbb; Tue, 15 Feb 2022 00:07:33 -0800 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web08.7078.1644912451911117398 for ; Tue, 15 Feb 2022 00:07:32 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10258"; a="250482770" X-IronPort-AV: E=Sophos;i="5.88,370,1635231600"; d="scan'208";a="250482770" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 00:07:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,370,1635231600"; d="scan'208";a="632608860" X-Received: from babios003.gar.corp.intel.com ([10.66.244.222]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2022 00:07:06 -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: [edk2-devel] [PATCH] ShellPkg: Fix Ping GetTimerPeriod API failure Date: Tue, 15 Feb 2022 13:37:03 +0530 Message-Id: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mohammedx.rehan@intel.com X-Gm-Message-State: VKNZloJSplIfqpFBwDRzuZzfx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1644912453; bh=EyKvP2eVb9RybYj28IUCZrUFfOoYR9GOKa2DA4DoiqI=; h=Cc:Date:From:Reply-To:Subject:To; b=ny8qo0gIviWXdGj3CWeBojoW+eKfXskuu6svGyyhHlYoXLEalt05romaXsJf8NFKKx/ PQQsVpQXmWjC2v+LtBFWYJl68QFYsIcVQo1JN0KyTphVYeP3sEgOj34jmSQV8/cDRD/O/ ZomSv6C0UTx16LuN9e8KEonkAKAMTBXv7ZA= X-ZohoMail-DKIM: fail (Signature date is -1 seconds in the future.) X-ZM-MESSAGEID: 1644912456308100001 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Ray Ni Reviewed-by: Zhichao Gao --- 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; UINT32 StallCounter; EFI_TPL OldTpl; + UINT32 TimerPeriod; =20 RttTimerTick =3D 0; StallCounter =3D 0; + TimerPeriod =3D 0; =20 Status =3D gBS->CreateEvent ( EVT_TIMER | EVT_NOTIFY_SIGNAL, @@ -295,7 +297,12 @@ GetTimerPeriod ( gBS->SetTimer (TimerEvent, TimerCancel, 0); gBS->CloseEvent (TimerEvent); =20 - return StallCounter / RttTimerTick; + TimerPeriod =3D StallCounter / RttTimerTick; + if (TimerPeriod !=3D 0) { + return TimerPeriod; + } else { + return 1; + } } =20 /** --=20 2.30.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86679): https://edk2.groups.io/g/devel/message/86679 Mute This Topic: https://groups.io/mt/89156648/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-