From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=fan.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 77F62221E06B0 for ; Thu, 14 Dec 2017 01:49:09 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Dec 2017 01:53:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,400,1508828400"; d="scan'208";a="18149675" Received: from fanwang2-hp.ccr.corp.intel.com ([10.239.9.33]) by orsmga002.jf.intel.com with ESMTP; 14 Dec 2017 01:53:49 -0800 From: fanwang2 To: edk2-devel@lists.01.org Cc: Wang Fan , Ye Ting , Fu Siyuan , Wu Jiaxin Date: Thu, 14 Dec 2017 17:53:10 +0800 Message-Id: <1513245190-8172-4-git-send-email-fan.wang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1513245190-8172-1-git-send-email-fan.wang@intel.com> References: <1513245190-8172-1-git-send-email-fan.wang@intel.com> Subject: [Patch 3/3 V2] ShellPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2017 09:49:09 -0000 From: Wang Fan V2: *Define time period in a macro instead of hard code. Cc: Ye Ting Cc: Fu Siyuan Cc: Wu Jiaxin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan --- ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 8 ++++---- ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c | 8 ++++---- ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c index 082ab72..ab6ab8b 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c @@ -548,15 +548,15 @@ IfConfigShowInterfaceInfo ( ) { LIST_ENTRY *Entry; LIST_ENTRY *Next; IFCONFIG_INTERFACE_CB *IfCb; - BOOLEAN MediaPresent; + EFI_STATUS MediaStatus; EFI_IPv4_ADDRESS Gateway; UINT32 Index; - MediaPresent = TRUE; + MediaStatus = EFI_SUCCESS; if (IsListEmpty (IfList)) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle); } @@ -574,12 +574,12 @@ IfConfigShowInterfaceInfo ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_IF_NAME), gShellNetwork1HiiHandle, IfCb->IfInfo->Name); // // Get Media State. // - if (EFI_SUCCESS == NetLibDetectMedia (IfCb->NicHandle, &MediaPresent)) { - if (!MediaPresent) { + if (EFI_SUCCESS == NetLibDetectMediaWaitTimeout (IfCb->NicHandle, 0, &MediaStatus)) { + if (MediaStatus != EFI_SUCCESS) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media disconnected"); } else { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media present"); } } else { diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c index 10d291c..bec9535 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c @@ -964,11 +964,11 @@ PingCreateIpInstance ( EFI_STATUS Status; UINTN HandleIndex; UINTN HandleNum; EFI_HANDLE *HandleBuffer; BOOLEAN UnspecifiedSrc; - BOOLEAN MediaPresent; + EFI_STATUS MediaStatus; EFI_SERVICE_BINDING_PROTOCOL *EfiSb; VOID *IpXCfg; EFI_IP6_CONFIG_DATA Ip6Config; EFI_IP4_CONFIG_DATA Ip4Config; VOID *IpXInterfaceInfo; @@ -976,11 +976,11 @@ PingCreateIpInstance ( EFI_IPv6_ADDRESS *Addr; UINTN AddrIndex; HandleBuffer = NULL; UnspecifiedSrc = FALSE; - MediaPresent = TRUE; + MediaStatus = EFI_SUCCESS; EfiSb = NULL; IpXInterfaceInfo = NULL; IfInfoSize = 0; // @@ -1033,12 +1033,12 @@ PingCreateIpInstance ( if (UnspecifiedSrc) { // // Check media. // - NetLibDetectMedia (HandleBuffer[HandleIndex], &MediaPresent); - if (!MediaPresent) { + NetLibDetectMediaWaitTimeout (HandleBuffer[HandleIndex], 0, &MediaStatus); + if (MediaStatus != EFI_SUCCESS) { // // Skip this one. // continue; } diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c index b784696..fa27c82 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c @@ -753,22 +753,22 @@ Ping6CreateIpInstance ( EFI_STATUS Status; UINTN HandleIndex; UINTN HandleNum; EFI_HANDLE *HandleBuffer; BOOLEAN UnspecifiedSrc; - BOOLEAN MediaPresent; + EFI_STATUS MediaStatus; EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb; EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg; EFI_IP6_CONFIG_DATA Ip6Config; EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo; UINTN IfInfoSize; EFI_IPv6_ADDRESS *Addr; UINTN AddrIndex; HandleBuffer = NULL; UnspecifiedSrc = FALSE; - MediaPresent = TRUE; + MediaStatus = EFI_SUCCESS Ip6Sb = NULL; IfInfo = NULL; IfInfoSize = 0; // @@ -812,12 +812,12 @@ Ping6CreateIpInstance ( if (UnspecifiedSrc) { // // Check media. // - NetLibDetectMedia (HandleBuffer[HandleIndex], &MediaPresent); - if (!MediaPresent) { + NetLibDetectMediaWaitTimeout (HandleBuffer[HandleIndex], 0, &MediaStatus); + if (MediaStatus != EFI_SUCCESS) { // // Skip this one. // continue; } -- 1.9.5.msysgit.1