* [Patch 0/3 V2] Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
@ 2017-12-14 9:53 fanwang2
2017-12-14 9:53 ` [Patch 1/3 V2] MdeModulePkg: " fanwang2
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: fanwang2 @ 2017-12-14 9:53 UTC (permalink / raw)
To: edk2-devel; +Cc: Wang Fan
From: Wang Fan <fan.wang@intel.com>
V2: *Define time period in a macro instead of hard code.
Wang Fan (3):
MdeModulePkg: Update Api from NetLibDetectMedia to
NetLibDetectMediaWaitTimeout.
NetworkPkg: Update Api from NetLibDetectMedia to
NetLibDetectMediaWaitTimeout.
ShellPkg: Update Api from NetLibDetectMedia to
NetLibDetectMediaWaitTimeout.
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 8 ++++----
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h | 1 +
MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c | 8 ++++----
MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c | 8 ++++----
MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h | 3 +++
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 8 ++++----
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h | 1 +
NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 8 ++++----
NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h | 2 ++
NetworkPkg/DnsDxe/DnsDhcp.c | 16 ++++++++--------
NetworkPkg/DnsDxe/DnsDhcp.h | 2 ++
NetworkPkg/HttpBootDxe/HttpBootImpl.c | 8 ++++----
NetworkPkg/HttpBootDxe/HttpBootImpl.h | 2 ++
NetworkPkg/IScsiDxe/IScsiDhcp.c | 9 +++++----
NetworkPkg/IScsiDxe/IScsiDhcp6.c | 9 +++++----
NetworkPkg/IScsiDxe/IScsiProto.c | 8 ++++----
NetworkPkg/IScsiDxe/IScsiProto.h | 3 +++
NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 8 ++++----
NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h | 2 ++
ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 8 ++++----
ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c | 8 ++++----
ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c | 8 ++++----
22 files changed, 78 insertions(+), 60 deletions(-)
--
1.9.5.msysgit.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Patch 1/3 V2] MdeModulePkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
2017-12-14 9:53 [Patch 0/3 V2] Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout fanwang2
@ 2017-12-14 9:53 ` fanwang2
2017-12-15 0:33 ` Fu, Siyuan
2017-12-14 9:53 ` [Patch 2/3 V2] NetworkPkg: " fanwang2
2017-12-14 9:53 ` [Patch 3/3 V2] ShellPkg: " fanwang2
2 siblings, 1 reply; 5+ messages in thread
From: fanwang2 @ 2017-12-14 9:53 UTC (permalink / raw)
To: edk2-devel; +Cc: Wang Fan, Ye Ting, Fu Siyuan, Wu Jiaxin
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>
---
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 8 ++++----
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h | 1 +
MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c | 8 ++++----
MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c | 8 ++++----
MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h | 3 +++
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 8 ++++----
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h | 1 +
7 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
index 8780414..aad6674 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
@@ -778,13 +778,13 @@ EfiDhcp4Start (
IN EFI_EVENT CompletionEvent OPTIONAL
)
{
DHCP_PROTOCOL *Instance;
DHCP_SERVICE *DhcpSb;
- BOOLEAN MediaPresent;
EFI_STATUS Status;
EFI_TPL OldTpl;
+ EFI_STATUS MediaStatus;
//
// First validate the parameters
//
if (This == NULL) {
@@ -811,13 +811,13 @@ EfiDhcp4Start (
}
//
// Check Media Satus.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (DhcpSb->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (DhcpSb->Controller, DHCP_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
Status = EFI_NO_MEDIA;
goto ON_ERROR;
}
DhcpSb->IoStatus = EFI_ALREADY_STARTED;
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
index e546a08..2d66afe 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
@@ -41,10 +41,11 @@ typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;
#include "Dhcp4Io.h"
#define DHCP_SERVICE_SIGNATURE SIGNATURE_32 ('D', 'H', 'C', 'P')
#define DHCP_PROTOCOL_SIGNATURE SIGNATURE_32 ('d', 'h', 'c', 'p')
+#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
//
// The state of the DHCP service. It starts as UNCONFIGED. If
// and active child configures the service successfully, it
// goes to CONFIGED. If the active child configures NULL, it
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c
index 869a56a..976fe5d 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c
@@ -358,23 +358,23 @@ IScsiDoDhcp (
EFI_HANDLE Dhcp4Handle;
EFI_DHCP4_PROTOCOL *Dhcp4;
EFI_STATUS Status;
EFI_DHCP4_PACKET_OPTION *ParaList;
EFI_DHCP4_CONFIG_DATA Dhcp4ConfigData;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
UINT8 *Data;
Dhcp4Handle = NULL;
Dhcp4 = NULL;
ParaList = NULL;
//
// Check media status before do DHCP
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Controller, ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
//
// Create a DHCP4 child instance and get the protocol.
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
index 14f13f8..4317de2 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
@@ -287,20 +287,20 @@ IScsiSessionLogin (
{
EFI_STATUS Status;
ISCSI_SESSION *Session;
ISCSI_CONNECTION *Conn;
EFI_TCP4_PROTOCOL *Tcp4;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
Session = &Private->Session;
//
// Check media status before session login
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Private->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Private->Controller, ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
//
// Set session identifier
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h
index 48b4e72..2f95323 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h
@@ -40,10 +40,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define DEFAULT_MAX_OUTSTANDING_R2T 1
#define ISCSI_VERSION_MAX 0x00
#define ISCSI_VERSION_MIN 0x00
+#define ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+#define ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
#define ISCSI_KEY_AUTH_METHOD "AuthMethod"
#define ISCSI_KEY_HEADER_DIGEST "HeaderDigest"
#define ISCSI_KEY_DATA_DIGEST "DataDigest"
#define ISCSI_KEY_MAX_CONNECTIONS "MaxConnections"
#define ISCSI_KEY_TARGET_NAME "TargetName"
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index 4bfeaf3..825a22c 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -2799,11 +2799,11 @@ EfiPxeLoadFile (
PXEBC_PRIVATE_DATA *Private;
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
BOOLEAN NewMakeCallback;
EFI_STATUS Status;
UINT64 TmpBufSize;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
if (FilePath == NULL || !IsDevicePathEnd (FilePath)) {
return EFI_INVALID_PARAMETER;
}
@@ -2825,13 +2825,13 @@ EfiPxeLoadFile (
}
//
// Check media status before PXE start
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Private->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Private->Controller, PXEBC_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
Status = PxeBc->Start (PxeBc, FALSE);
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
index 834c0d0..e96b6f2 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
@@ -55,10 +55,11 @@ typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA;
#define PXEBC_MTFTP_RETRIES 6
#define PXEBC_DEFAULT_UDP_OVERHEAD_SIZE 8
#define PXEBC_DEFAULT_TFTP_OVERHEAD_SIZE 4
#define PXEBC_DEFAULT_PACKET_SIZE 1480
#define PXEBC_DEFAULT_LIFETIME 50000 // 50ms, unit is microsecond
+#define PXEBC_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
struct _PXEBC_PRIVATE_DATA {
UINT32 Signature;
EFI_HANDLE Controller;
EFI_HANDLE Image;
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Patch 2/3 V2] NetworkPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
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-14 9:53 ` fanwang2
2017-12-14 9:53 ` [Patch 3/3 V2] ShellPkg: " fanwang2
2 siblings, 0 replies; 5+ messages in thread
From: fanwang2 @ 2017-12-14 9:53 UTC (permalink / raw)
To: edk2-devel; +Cc: Wang Fan, Ye Ting, Fu Siyuan, Wu Jiaxin
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>
---
NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 8 ++++----
NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h | 2 ++
NetworkPkg/DnsDxe/DnsDhcp.c | 16 ++++++++--------
NetworkPkg/DnsDxe/DnsDhcp.h | 2 ++
NetworkPkg/HttpBootDxe/HttpBootImpl.c | 8 ++++----
NetworkPkg/HttpBootDxe/HttpBootImpl.h | 2 ++
NetworkPkg/IScsiDxe/IScsiDhcp.c | 9 +++++----
NetworkPkg/IScsiDxe/IScsiDhcp6.c | 9 +++++----
NetworkPkg/IScsiDxe/IScsiProto.c | 8 ++++----
NetworkPkg/IScsiDxe/IScsiProto.h | 3 +++
NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 8 ++++----
NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h | 2 ++
12 files changed, 45 insertions(+), 32 deletions(-)
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
index 1107865..b479421 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
@@ -74,11 +74,11 @@ EfiDhcp6Start (
{
EFI_STATUS Status;
EFI_TPL OldTpl;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -104,13 +104,13 @@ EfiDhcp6Start (
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
//
// Check Media Satus.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Service->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Service->Controller, DHCP_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
Status = EFI_NO_MEDIA;
goto ON_ERROR;
}
Instance->UdpSts = EFI_ALREADY_STARTED;
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
index 06780b6..7110bf8 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
@@ -60,10 +60,12 @@ typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE;
#define DHCP6_BASE_PACKET_SIZE 1024
#define DHCP6_PORT_CLIENT 546
#define DHCP6_PORT_SERVER 547
+#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
#define DHCP6_INSTANCE_FROM_THIS(Instance) CR ((Instance), DHCP6_INSTANCE, Dhcp6, DHCP6_INSTANCE_SIGNATURE)
#define DHCP6_SERVICE_FROM_THIS(Service) CR ((Service), DHCP6_SERVICE, ServiceBinding, DHCP6_SERVICE_SIGNATURE)
extern EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress;
extern EFI_IPv6_ADDRESS mAllDhcpServersAddress;
diff --git a/NetworkPkg/DnsDxe/DnsDhcp.c b/NetworkPkg/DnsDxe/DnsDhcp.c
index 93779be..951477b 100644
--- a/NetworkPkg/DnsDxe/DnsDhcp.c
+++ b/NetworkPkg/DnsDxe/DnsDhcp.c
@@ -267,11 +267,11 @@ GetDns4ServerFromDhcp4 (
)
{
EFI_STATUS Status;
EFI_HANDLE Image;
EFI_HANDLE Controller;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
EFI_HANDLE MnpChildHandle;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
EFI_HANDLE Dhcp4Handle;
EFI_DHCP4_PROTOCOL *Dhcp4;
@@ -314,13 +314,13 @@ GetDns4ServerFromDhcp4 (
IsDone = FALSE;
//
// Check media.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Controller, DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
//
// Create a Mnp child instance, get the protocol and config for it.
@@ -618,11 +618,11 @@ GetDns6ServerFromDhcp6 (
EFI_STATUS Status;
EFI_STATUS TimerStatus;
EFI_DHCP6_PACKET_OPTION *Oro;
EFI_DHCP6_RETRANSMISSION InfoReqReXmit;
EFI_EVENT Timer;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
DNS6_SERVER_INFOR DnsServerInfor;
Dhcp6Handle = NULL;
Dhcp6 = NULL;
Oro = NULL;
@@ -633,13 +633,13 @@ GetDns6ServerFromDhcp6 (
DnsServerInfor.ServerCount = DnsServerCount;
//
// Check media status before doing DHCP.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Controller, DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
//
// Create a DHCP6 child instance and get the protocol.
diff --git a/NetworkPkg/DnsDxe/DnsDhcp.h b/NetworkPkg/DnsDxe/DnsDhcp.h
index 62bf717..9c61f84 100644
--- a/NetworkPkg/DnsDxe/DnsDhcp.h
+++ b/NetworkPkg/DnsDxe/DnsDhcp.h
@@ -35,10 +35,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define DHCP6_TAG_DNS_REQUEST 6
#define DHCP6_TAG_DNS_SERVER 23
+#define DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
//
// The required Dns4 server information.
//
typedef struct {
UINT32 *ServerCount;
diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index d591db5..7f0616d 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -546,11 +546,11 @@ HttpBootDxeLoadFile (
IN VOID *Buffer OPTIONAL
)
{
HTTP_BOOT_PRIVATE_DATA *Private;
HTTP_BOOT_VIRTUAL_NIC *VirtualNic;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
BOOLEAN UsingIpv6;
EFI_STATUS Status;
HTTP_BOOT_IMAGE_TYPE ImageType;
if (This == NULL || BufferSize == NULL || FilePath == NULL) {
@@ -568,13 +568,13 @@ HttpBootDxeLoadFile (
Private = VirtualNic->Private;
//
// Check media status before HTTP boot start
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Private->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Private->Controller, HTTP_BOOT_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
AsciiPrint ("\n Error: Could not detect network connection.\n");
return EFI_NO_MEDIA;
}
//
diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.h b/NetworkPkg/HttpBootDxe/HttpBootImpl.h
index da58bb6..5316035 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.h
@@ -12,10 +12,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __EFI_HTTP_BOOT_IMPL_H__
#define __EFI_HTTP_BOOT_IMPL_H__
+#define HTTP_BOOT_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
/**
Attempt to complete a DHCPv4 D.O.R.A or DHCPv6 S.R.A.A sequence to retrieve the boot resource information.
@param[in] Private The pointer to the driver's private data.
diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp.c b/NetworkPkg/IScsiDxe/IScsiDhcp.c
index 309ce0d..e6f6972 100644
--- a/NetworkPkg/IScsiDxe/IScsiDhcp.c
+++ b/NetworkPkg/IScsiDxe/IScsiDhcp.c
@@ -441,23 +441,24 @@ IScsiDoDhcp (
EFI_DHCP4_PROTOCOL *Dhcp4;
EFI_STATUS Status;
EFI_DHCP4_PACKET_OPTION *ParaList;
EFI_DHCP4_CONFIG_DATA Dhcp4ConfigData;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
Dhcp4Handle = NULL;
Ip4Config2 = NULL;
Dhcp4 = NULL;
ParaList = NULL;
//
// Check media status before doing DHCP.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Controller, ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
+ if (MediaStatus!= EFI_SUCCESS) {
+ AsciiPrint ("\n Error: Could not detect network connection.\n");
return EFI_NO_MEDIA;
}
//
// DHCP4 service allows only one of its children to be configured in
diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
index 06c634c..90acb94 100644
--- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c
+++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
@@ -399,18 +399,19 @@ IScsiDoDhcp6 (
EFI_STATUS Status;
EFI_STATUS TimerStatus;
EFI_DHCP6_PACKET_OPTION *Oro;
EFI_DHCP6_RETRANSMISSION InfoReqReXmit;
EFI_EVENT Timer;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
//
// Check media status before doing DHCP.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Controller, ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
+ AsciiPrint ("\n Error: Could not detect network connection.\n");
return EFI_NO_MEDIA;
}
//
// iSCSI will only request target info from DHCPv6 server.
diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c b/NetworkPkg/IScsiDxe/IScsiProto.c
index 1602a26..38e4af2 100644
--- a/NetworkPkg/IScsiDxe/IScsiProto.c
+++ b/NetworkPkg/IScsiDxe/IScsiProto.c
@@ -442,18 +442,18 @@ IScsiSessionLogin (
EFI_STATUS Status;
ISCSI_CONNECTION *Conn;
VOID *Tcp;
EFI_GUID *ProtocolGuid;
UINT8 RetryCount;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
//
// Check media status before session login.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Session->Private->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Session->Private->Controller, ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
//
// Set session identifier
diff --git a/NetworkPkg/IScsiDxe/IScsiProto.h b/NetworkPkg/IScsiDxe/IScsiProto.h
index 367914d..d57bda5 100644
--- a/NetworkPkg/IScsiDxe/IScsiProto.h
+++ b/NetworkPkg/IScsiDxe/IScsiProto.h
@@ -38,10 +38,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define DEFAULT_MAX_OUTSTANDING_R2T 1
#define ISCSI_VERSION_MAX 0x00
#define ISCSI_VERSION_MIN 0x00
+#define ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+#define ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
#define ISCSI_REDIRECT_ADDR_START_DELIMITER '['
#define ISCSI_REDIRECT_ADDR_END_DELIMITER ']'
#define ISCSI_KEY_AUTH_METHOD "AuthMethod"
#define ISCSI_KEY_HEADER_DIGEST "HeaderDigest"
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index ab9e494..5a0fb32 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -2345,11 +2345,11 @@ EfiPxeLoadFile (
PXEBC_PRIVATE_DATA *Private;
PXEBC_VIRTUAL_NIC *VirtualNic;
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
BOOLEAN UsingIpv6;
EFI_STATUS Status;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
if (FilePath == NULL || !IsDevicePathEnd (FilePath)) {
return EFI_INVALID_PARAMETER;
}
@@ -2371,13 +2371,13 @@ EfiPxeLoadFile (
}
//
// Check media status before PXE start
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Private->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Private->Controller, PXEBC_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
//
// Check whether the virtual nic is using IPv6 or not.
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
index 2cdc8bf..7f1ecfb 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
@@ -74,10 +74,12 @@ typedef struct _PXEBC_VIRTUAL_NIC PXEBC_VIRTUAL_NIC;
#define PXEBC_MTFTP_RETRIES 6
#define PXEBC_DHCP_RETRIES 4 // refers to mPxeDhcpTimeout, also by PXE2.1 spec.
#define PXEBC_MENU_MAX_NUM 24
#define PXEBC_OFFER_MAX_NUM 16
+#define PXEBC_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
#define PXEBC_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'P')
#define PXEBC_VIRTUAL_NIC_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'V')
#define PXEBC_PRIVATE_DATA_FROM_PXEBC(a) CR (a, PXEBC_PRIVATE_DATA, PxeBc, PXEBC_PRIVATE_DATA_SIGNATURE)
#define PXEBC_PRIVATE_DATA_FROM_ID(a) CR (a, PXEBC_PRIVATE_DATA, Id, PXEBC_PRIVATE_DATA_SIGNATURE)
#define PXEBC_VIRTUAL_NIC_FROM_LOADFILE(a) CR (a, PXEBC_VIRTUAL_NIC, LoadFile, PXEBC_VIRTUAL_NIC_SIGNATURE)
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Patch 3/3 V2] ShellPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
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-14 9:53 ` [Patch 2/3 V2] NetworkPkg: " fanwang2
@ 2017-12-14 9:53 ` fanwang2
2 siblings, 0 replies; 5+ messages in thread
From: fanwang2 @ 2017-12-14 9:53 UTC (permalink / raw)
To: edk2-devel; +Cc: Wang Fan, Ye Ting, Fu Siyuan, Wu Jiaxin
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Patch 1/3 V2] MdeModulePkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
2017-12-14 9:53 ` [Patch 1/3 V2] MdeModulePkg: " fanwang2
@ 2017-12-15 0:33 ` Fu, Siyuan
0 siblings, 0 replies; 5+ messages in thread
From: Fu, Siyuan @ 2017-12-15 0:33 UTC (permalink / raw)
To: Wang, Fan, edk2-devel@lists.01.org; +Cc: Ye, Ting, Wang, Fan, Wu, Jiaxin
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> fanwang2
> Sent: Thursday, December 14, 2017 5:53 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Wang, Fan <fan.wang@intel.com>; Fu,
> Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [Patch 1/3 V2] MdeModulePkg: Update Api from
> NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
>
> 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>
> ---
> MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 8 ++++----
> MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h | 1 +
> MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c | 8 ++++----
> MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c | 8 ++++----
> MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h | 3 +++
> MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 8 ++++----
> MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h | 1 +
> 7 files changed, 21 insertions(+), 16 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
> b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
> index 8780414..aad6674 100644
> --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
> +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
> @@ -778,13 +778,13 @@ EfiDhcp4Start (
> IN EFI_EVENT CompletionEvent OPTIONAL
> )
> {
> DHCP_PROTOCOL *Instance;
> DHCP_SERVICE *DhcpSb;
> - BOOLEAN MediaPresent;
> EFI_STATUS Status;
> EFI_TPL OldTpl;
> + EFI_STATUS MediaStatus;
>
> //
> // First validate the parameters
> //
> if (This == NULL) {
> @@ -811,13 +811,13 @@ EfiDhcp4Start (
> }
>
> //
> // Check Media Satus.
> //
> - MediaPresent = TRUE;
> - NetLibDetectMedia (DhcpSb->Controller, &MediaPresent);
> - if (!MediaPresent) {
> + MediaStatus = EFI_SUCCESS;
> + NetLibDetectMediaWaitTimeout (DhcpSb->Controller,
> DHCP_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
> + if (MediaStatus != EFI_SUCCESS) {
> Status = EFI_NO_MEDIA;
> goto ON_ERROR;
> }
>
> DhcpSb->IoStatus = EFI_ALREADY_STARTED;
> diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
> b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
> index e546a08..2d66afe 100644
> --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
> +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
> @@ -41,10 +41,11 @@ typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;
> #include "Dhcp4Io.h"
>
> #define DHCP_SERVICE_SIGNATURE SIGNATURE_32 ('D', 'H', 'C', 'P')
> #define DHCP_PROTOCOL_SIGNATURE SIGNATURE_32 ('d', 'h', 'c', 'p')
>
> +#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
>
> //
> // The state of the DHCP service. It starts as UNCONFIGED. If
> // and active child configures the service successfully, it
> // goes to CONFIGED. If the active child configures NULL, it
> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c
> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c
> index 869a56a..976fe5d 100644
> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c
> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c
> @@ -358,23 +358,23 @@ IScsiDoDhcp (
> EFI_HANDLE Dhcp4Handle;
> EFI_DHCP4_PROTOCOL *Dhcp4;
> EFI_STATUS Status;
> EFI_DHCP4_PACKET_OPTION *ParaList;
> EFI_DHCP4_CONFIG_DATA Dhcp4ConfigData;
> - BOOLEAN MediaPresent;
> + EFI_STATUS MediaStatus;
> UINT8 *Data;
>
> Dhcp4Handle = NULL;
> Dhcp4 = NULL;
> ParaList = NULL;
>
> //
> // Check media status before do DHCP
> //
> - MediaPresent = TRUE;
> - NetLibDetectMedia (Controller, &MediaPresent);
> - if (!MediaPresent) {
> + MediaStatus = EFI_SUCCESS;
> + NetLibDetectMediaWaitTimeout (Controller,
> ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
> + if (MediaStatus != EFI_SUCCESS) {
> return EFI_NO_MEDIA;
> }
>
> //
> // Create a DHCP4 child instance and get the protocol.
> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
> index 14f13f8..4317de2 100644
> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
> @@ -287,20 +287,20 @@ IScsiSessionLogin (
> {
> EFI_STATUS Status;
> ISCSI_SESSION *Session;
> ISCSI_CONNECTION *Conn;
> EFI_TCP4_PROTOCOL *Tcp4;
> - BOOLEAN MediaPresent;
> + EFI_STATUS MediaStatus;
>
> Session = &Private->Session;
>
> //
> // Check media status before session login
> //
> - MediaPresent = TRUE;
> - NetLibDetectMedia (Private->Controller, &MediaPresent);
> - if (!MediaPresent) {
> + MediaStatus = EFI_SUCCESS;
> + NetLibDetectMediaWaitTimeout (Private->Controller,
> ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME, &MediaStatus);
> + if (MediaStatus != EFI_SUCCESS) {
> return EFI_NO_MEDIA;
> }
>
> //
> // Set session identifier
> diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h
> b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h
> index 48b4e72..2f95323 100644
> --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h
> +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h
> @@ -40,10 +40,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> EITHER EXPRESS OR IMPLIED.
> #define DEFAULT_MAX_OUTSTANDING_R2T 1
>
> #define ISCSI_VERSION_MAX 0x00
> #define ISCSI_VERSION_MIN 0x00
>
> +#define ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME
> EFI_TIMER_PERIOD_SECONDS(20)
> +#define ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME
> EFI_TIMER_PERIOD_SECONDS(20)
> +
> #define ISCSI_KEY_AUTH_METHOD "AuthMethod"
> #define ISCSI_KEY_HEADER_DIGEST "HeaderDigest"
> #define ISCSI_KEY_DATA_DIGEST "DataDigest"
> #define ISCSI_KEY_MAX_CONNECTIONS "MaxConnections"
> #define ISCSI_KEY_TARGET_NAME "TargetName"
> diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
> b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
> index 4bfeaf3..825a22c 100644
> --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
> +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
> @@ -2799,11 +2799,11 @@ EfiPxeLoadFile (
> PXEBC_PRIVATE_DATA *Private;
> EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
> BOOLEAN NewMakeCallback;
> EFI_STATUS Status;
> UINT64 TmpBufSize;
> - BOOLEAN MediaPresent;
> + EFI_STATUS MediaStatus;
>
> if (FilePath == NULL || !IsDevicePathEnd (FilePath)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -2825,13 +2825,13 @@ EfiPxeLoadFile (
> }
>
> //
> // Check media status before PXE start
> //
> - MediaPresent = TRUE;
> - NetLibDetectMedia (Private->Controller, &MediaPresent);
> - if (!MediaPresent) {
> + MediaStatus = EFI_SUCCESS;
> + NetLibDetectMediaWaitTimeout (Private->Controller,
> PXEBC_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
> + if (MediaStatus != EFI_SUCCESS) {
> return EFI_NO_MEDIA;
> }
>
> Status = PxeBc->Start (PxeBc, FALSE);
> if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
> diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
> b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
> index 834c0d0..e96b6f2 100644
> --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
> +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
> @@ -55,10 +55,11 @@ typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA;
> #define PXEBC_MTFTP_RETRIES 6
> #define PXEBC_DEFAULT_UDP_OVERHEAD_SIZE 8
> #define PXEBC_DEFAULT_TFTP_OVERHEAD_SIZE 4
> #define PXEBC_DEFAULT_PACKET_SIZE 1480
> #define PXEBC_DEFAULT_LIFETIME 50000 // 50ms, unit is
> microsecond
> +#define PXEBC_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
>
> struct _PXEBC_PRIVATE_DATA {
> UINT32 Signature;
> EFI_HANDLE Controller;
> EFI_HANDLE Image;
> --
> 1.9.5.msysgit.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-12-15 0:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [Patch 3/3 V2] ShellPkg: " fanwang2
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox