public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ye, Ting" <ting.ye@intel.com>
To: "Wu, Jiaxin" <jiaxin.wu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Fu, Siyuan" <siyuan.fu@intel.com>,
	Karunakar P <karunakarp@amiindia.co.in>
Subject: Re: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.
Date: Wed, 13 Dec 2017 03:32:56 +0000	[thread overview]
Message-ID: <BC0C045B0E2A584CA4575E779FA2C12A1A98239B@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1512117526-11308-2-git-send-email-jiaxin.wu@intel.com>

Hi Jiaxin,

I think the patch need be revised since it does not check the returned status of NetLibDetectMedia.  If NetLibDetectMedia failed to detect the media status due to some error conditions, MediaPresent is still TRUE and DHCP will be trigged later even no media is available.

Thanks,
Ting


-----Original Message-----
From: Wu, Jiaxin 
Sent: Friday, December 1, 2017 4:39 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Karunakar P <karunakarp@amiindia.co.in>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Karunakar P <karunakarp@amiindia.co.in>
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
index 1db4c66..8780414 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
@@ -1,9 +1,9 @@
 /** @file
   This file implement the EFI_DHCP4_PROTOCOL interface.
 
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials  are licensed and made available under the terms and conditions of the BSD License  which accompanies this distribution.  The full text of the license may be found at  http://opensource.org/licenses/bsd-license.php
 
@@ -778,10 +778,11 @@ EfiDhcp4Start (
   IN EFI_EVENT              CompletionEvent   OPTIONAL
   )
 {
   DHCP_PROTOCOL             *Instance;
   DHCP_SERVICE              *DhcpSb;
+  BOOLEAN                   MediaPresent;
   EFI_STATUS                Status;
   EFI_TPL                   OldTpl;
 
   //
   // First validate the parameters
@@ -807,10 +808,20 @@ EfiDhcp4Start (
   if ((DhcpSb->DhcpState != Dhcp4Init) && (DhcpSb->DhcpState != Dhcp4InitReboot)) {
     Status = EFI_ALREADY_STARTED;
     goto ON_ERROR;
   }
 
+  //
+  // Check Media Satus.
+  //
+  MediaPresent = TRUE;
+  NetLibDetectMedia (DhcpSb->Controller, &MediaPresent);  if 
+ (!MediaPresent) {
+    Status = EFI_NO_MEDIA;
+    goto ON_ERROR;
+  }
+
   DhcpSb->IoStatus = EFI_ALREADY_STARTED;
 
   if (EFI_ERROR (Status = DhcpInitRequest (DhcpSb))) {
     goto ON_ERROR;
   }
--
1.9.5.msysgit.1



  reply	other threads:[~2017-12-13  3:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01  8:38 [Patch 0/2] Check Media status before starting DHCP process Jiaxin Wu
2017-12-01  8:38 ` [Patch 1/2] MdeModulePkg/Dhcp4Dxe: " Jiaxin Wu
2017-12-13  3:32   ` Ye, Ting [this message]
2017-12-13  5:16     ` Wu, Jiaxin
2017-12-13  6:30       ` Ye, Ting
2017-12-01  8:38 ` [Patch 2/2] NetworkPkg/Dhcp6Dxe: " Jiaxin Wu
2017-12-13  1:39   ` Fu, Siyuan
2017-12-01 11:53 ` [Patch 0/2] " Laszlo Ersek
2017-12-04  1:21   ` Wu, Jiaxin
2017-12-04  1:53 ` Fu, Siyuan
2017-12-04  2:00   ` Wu, Jiaxin

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=BC0C045B0E2A584CA4575E779FA2C12A1A98239B@SHSMSX103.ccr.corp.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