From: fanwang2 <fan.wang@intel.com>
To: edk2-devel@lists.01.org
Cc: Wang Fan <fan.wang@intel.com>, Ye Ting <ting.ye@intel.com>,
Fu Siyuan <siyuan.fu@intel.com>, Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [Patch 3/3 V2] ShellPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
Date: Thu, 14 Dec 2017 17:53:10 +0800 [thread overview]
Message-ID: <1513245190-8172-4-git-send-email-fan.wang@intel.com> (raw)
In-Reply-To: <1513245190-8172-1-git-send-email-fan.wang@intel.com>
From: Wang Fan <fan.wang@intel.com>
V2:
*Define time period in a macro instead of hard code.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
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
prev parent reply other threads:[~2017-12-14 9:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-14 9:53 [Patch 0/3 V2] Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout fanwang2
2017-12-14 9:53 ` [Patch 1/3 V2] MdeModulePkg: " fanwang2
2017-12-15 0:33 ` Fu, Siyuan
2017-12-14 9:53 ` [Patch 2/3 V2] NetworkPkg: " fanwang2
2017-12-14 9:53 ` fanwang2 [this message]
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=1513245190-8172-4-git-send-email-fan.wang@intel.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