From nobody Tue Jan 14 22:45:30 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1513068895072894.5334382072768; Tue, 12 Dec 2017 00:54:55 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BA296220EE10A; Tue, 12 Dec 2017 00:50:15 -0800 (PST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 30AE521B02825 for ; Tue, 12 Dec 2017 00:50:13 -0800 (PST) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2017 00:54:52 -0800 Received: from fanwang2-hp.ccr.corp.intel.com ([10.239.9.33]) by orsmga006.jf.intel.com with ESMTP; 12 Dec 2017 00:54:51 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=fan.wang@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,394,1508828400"; d="scan'208";a="2130318" From: fanwang2 To: edk2-devel@lists.01.org Date: Tue, 12 Dec 2017 16:54:00 +0800 Message-Id: <1513068842-4892-2-git-send-email-fan.wang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1513068842-4892-1-git-send-email-fan.wang@intel.com> References: <1513068842-4892-1-git-send-email-fan.wang@intel.com> Subject: [edk2] [Patch 1/3] NetworkPkg: 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: , Cc: Ye Ting , Wang Fan , Fu Siyuan , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since new Api NetLibDetectMediaWaitTimeout was involved to support connecti= ng state handling, and it is forward compatible. So apply this Api in Network. Cc: Ye Ting Cc: Fu Siyuan Cc: Wu Jiaxin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan --- NetworkPkg/DnsDxe/DnsDhcp.c | 20 ++++++++++---------- NetworkPkg/HttpBootDxe/HttpBootImpl.c | 10 +++++----- NetworkPkg/IScsiDxe/IScsiDhcp.c | 11 ++++++----- NetworkPkg/IScsiDxe/IScsiDhcp6.c | 11 ++++++----- NetworkPkg/IScsiDxe/IScsiProto.c | 8 ++++---- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 10 +++++----- 6 files changed, 36 insertions(+), 34 deletions(-) diff --git a/NetworkPkg/DnsDxe/DnsDhcp.c b/NetworkPkg/DnsDxe/DnsDhcp.c index 93779be..604047c 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; =20 EFI_MANAGED_NETWORK_PROTOCOL *Mnp; EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData; EFI_HANDLE Dhcp4Handle; =20 EFI_DHCP4_PROTOCOL *Dhcp4; @@ -312,15 +312,15 @@ GetDns4ServerFromDhcp4 ( DnsServerInfor.ServerCount =3D DnsServerCount; =20 IsDone =3D FALSE; =20 // - // Check media. + // Check media status, wait no more than 20 seconds // - MediaPresent =3D TRUE; - NetLibDetectMedia (Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus =3D EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Controller, EFI_TIMER_PERIOD_SECONDS(20), = &MediaStatus); + if (MediaStatus !=3D EFI_SUCCESS) { return EFI_NO_MEDIA; } =20 // // 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; =20 Dhcp6Handle =3D NULL; Dhcp6 =3D NULL; Oro =3D NULL; @@ -631,15 +631,15 @@ GetDns6ServerFromDhcp6 ( ZeroMem (&DnsServerInfor, sizeof (DNS6_SERVER_INFOR)); =20 DnsServerInfor.ServerCount =3D DnsServerCount; =20 // - // Check media status before doing DHCP. + // Check media, wait no more than 20 seconds // - MediaPresent =3D TRUE; - NetLibDetectMedia (Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus =3D EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Controller, EFI_TIMER_PERIOD_SECONDS(20), = &MediaStatus); + if (MediaStatus !=3D EFI_SUCCESS) { return EFI_NO_MEDIA; } =20 // // Create a DHCP6 child instance and get the protocol. diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe= /HttpBootImpl.c index d591db5..05fea28 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; =20 if (This =3D=3D NULL || BufferSize =3D=3D NULL || FilePath =3D=3D NULL) { @@ -566,15 +566,15 @@ HttpBootDxeLoadFile ( =20 VirtualNic =3D HTTP_BOOT_VIRTUAL_NIC_FROM_LOADFILE (This); Private =3D VirtualNic->Private; =20 // - // Check media status before HTTP boot start + // Check media status before HTTP boot start, wait no more than 20 secon= ds // - MediaPresent =3D TRUE; - NetLibDetectMedia (Private->Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus =3D EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Private->Controller, EFI_TIMER_PERIOD_SECO= NDS(20), &MediaStatus); + if (MediaStatus !=3D EFI_SUCCESS) { AsciiPrint ("\n Error: Could not detect network connection.\n"); return EFI_NO_MEDIA; } =20 // diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp.c b/NetworkPkg/IScsiDxe/IScsiDhc= p.c index 309ce0d..6d25cde 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; =20 Dhcp4Handle =3D NULL; Ip4Config2 =3D NULL; Dhcp4 =3D NULL; ParaList =3D NULL; =20 // - // Check media status before doing DHCP. + // Check media status, no more than 20 seconds // - MediaPresent =3D TRUE; - NetLibDetectMedia (Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus =3D EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Controller, EFI_TIMER_PERIOD_SECONDS(20), = &MediaStatus); + if (MediaStatus!=3D EFI_SUCCESS) { + AsciiPrint ("\n Error: Could not detect network connection.\n"); return EFI_NO_MEDIA; } =20 // // DHCP4 service allows only one of its children to be configured in =20 diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDh= cp6.c index 06c634c..0d57704 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; =20 // - // Check media status before doing DHCP. + // Check media status, no more than 20 seconds // - MediaPresent =3D TRUE; - NetLibDetectMedia (Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus =3D EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Controller, EFI_TIMER_PERIOD_SECONDS(20), = &MediaStatus); + if (MediaStatus !=3D EFI_SUCCESS) { + AsciiPrint ("\n Error: Could not detect network connection.\n"); return EFI_NO_MEDIA; } =20 // // iSCSI will only request target info from DHCPv6 server. diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c b/NetworkPkg/IScsiDxe/IScsiPr= oto.c index 1602a26..ccdd5df 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; =20 // // Check media status before session login. // - MediaPresent =3D TRUE; - NetLibDetectMedia (Session->Private->Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus =3D EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Session->Private->Controller, EFI_TIMER_PE= RIOD_SECONDS(20), &MediaStatus); + if (MediaStatus !=3D EFI_SUCCESS) { return EFI_NO_MEDIA; } =20 // // Set session identifier diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/= PxeBcImpl.c index ab9e494..7940cbe 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; =20 if (FilePath =3D=3D NULL || !IsDevicePathEnd (FilePath)) { return EFI_INVALID_PARAMETER; } =20 @@ -2369,15 +2369,15 @@ EfiPxeLoadFile ( if (!BootPolicy) { return EFI_UNSUPPORTED; } =20 // - // Check media status before PXE start + // Check media status before PXE start, wait no more than 20 seconds // - MediaPresent =3D TRUE; - NetLibDetectMedia (Private->Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus =3D EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Private->Controller, EFI_TIMER_PERIOD_SECO= NDS(20), &MediaStatus); + if (MediaStatus !=3D EFI_SUCCESS) { return EFI_NO_MEDIA; } =20 // // Check whether the virtual nic is using IPv6 or not. --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel