public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/2] Check Media status before starting DHCP process.
@ 2017-12-01  8:38 Jiaxin Wu
  2017-12-01  8:38 ` [Patch 1/2] MdeModulePkg/Dhcp4Dxe: " Jiaxin Wu
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Jiaxin Wu @ 2017-12-01  8:38 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Fu Siyuan, Karunakar P, Wu Jiaxin

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>

Jiaxin Wu (2):
  MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP
    process.
  NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.

 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 13 ++++++++++++-
 NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c                     | 14 +++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

-- 
1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.
  2017-12-01  8:38 [Patch 0/2] Check Media status before starting DHCP process Jiaxin Wu
@ 2017-12-01  8:38 ` Jiaxin Wu
  2017-12-13  3:32   ` Ye, Ting
  2017-12-01  8:38 ` [Patch 2/2] NetworkPkg/Dhcp6Dxe: " Jiaxin Wu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Jiaxin Wu @ 2017-12-01  8:38 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Fu Siyuan, Karunakar P, Wu Jiaxin

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



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Patch 2/2] NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.
  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-01  8:38 ` Jiaxin Wu
  2017-12-13  1:39   ` Fu, Siyuan
  2017-12-01 11:53 ` [Patch 0/2] " Laszlo Ersek
  2017-12-04  1:53 ` Fu, Siyuan
  3 siblings, 1 reply; 11+ messages in thread
From: Jiaxin Wu @ 2017-12-01  8:38 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Fu Siyuan, Karunakar P, Wu Jiaxin

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>
---
 NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
index d8c0ad0..1107865 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
@@ -1,9 +1,9 @@
 /** @file
   This EFI_DHCP6_PROTOCOL interface implementation.
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 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.
@@ -74,10 +74,11 @@ EfiDhcp6Start (
 {
   EFI_STATUS                   Status;
   EFI_TPL                      OldTpl;
   DHCP6_INSTANCE               *Instance;
   DHCP6_SERVICE                *Service;
+  BOOLEAN                      MediaPresent;
 
   if (This == NULL) {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -99,10 +100,21 @@ EfiDhcp6Start (
   if (Instance->IaCb.Ia->State != Dhcp6Init) {
     return EFI_ALREADY_STARTED;
   }
 
   OldTpl           = gBS->RaiseTPL (TPL_CALLBACK);
+
+  //
+  // Check Media Satus.
+  //
+  MediaPresent = TRUE;
+  NetLibDetectMedia (Service->Controller, &MediaPresent);
+  if (!MediaPresent) {
+    Status = EFI_NO_MEDIA;
+    goto ON_ERROR;
+  }
+
   Instance->UdpSts = EFI_ALREADY_STARTED;
 
   //
   // Send the solicit message to start S.A.R.R process.
   //
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Patch 0/2] Check Media status before starting DHCP process.
  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-01  8:38 ` [Patch 2/2] NetworkPkg/Dhcp6Dxe: " Jiaxin Wu
@ 2017-12-01 11:53 ` Laszlo Ersek
  2017-12-04  1:21   ` Wu, Jiaxin
  2017-12-04  1:53 ` Fu, Siyuan
  3 siblings, 1 reply; 11+ messages in thread
From: Laszlo Ersek @ 2017-12-01 11:53 UTC (permalink / raw)
  To: Jiaxin Wu, edk2-devel; +Cc: Ye Ting, Karunakar P, Fu Siyuan

Hi Jiaxin,

On 12/01/17 09:38, Jiaxin Wu wrote:
> 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>
> 
> Jiaxin Wu (2):
>   MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP
>     process.
>   NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.
> 
>  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 13 ++++++++++++-
>  NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c                     | 14 +++++++++++++-
>  2 files changed, 25 insertions(+), 2 deletions(-)
> 

I assume this is to address
<https://bugzilla.tianocore.org/show_bug.cgi?id=804>. If that's the
case, can you please add the BZ reference to the commit messages?

(No need to repost just because of this.)

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Patch 0/2] Check Media status before starting DHCP process.
  2017-12-01 11:53 ` [Patch 0/2] " Laszlo Ersek
@ 2017-12-04  1:21   ` Wu, Jiaxin
  0 siblings, 0 replies; 11+ messages in thread
From: Wu, Jiaxin @ 2017-12-04  1:21 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel@lists.01.org; +Cc: Ye, Ting, Karunakar P, Fu, Siyuan

Thanks Laszlo, I will update the messages before committing the patches. 



> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Friday, December 1, 2017 7:53 PM
> To: Wu, Jiaxin <jiaxin.wu@intel.com>; edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Karunakar P <karunakarp@amiindia.co.in>;
> Fu, Siyuan <siyuan.fu@intel.com>
> Subject: Re: [edk2] [Patch 0/2] Check Media status before starting DHCP
> process.
> 
> Hi Jiaxin,
> 
> On 12/01/17 09:38, Jiaxin Wu wrote:
> > 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>
> >
> > Jiaxin Wu (2):
> >   MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP
> >     process.
> >   NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.
> >
> >  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 13
> ++++++++++++-
> >  NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c                     | 14 +++++++++++++-
> >  2 files changed, 25 insertions(+), 2 deletions(-)
> >
> 
> I assume this is to address
> <https://bugzilla.tianocore.org/show_bug.cgi?id=804>. If that's the
> case, can you please add the BZ reference to the commit messages?
> 
> (No need to repost just because of this.)
> 
> Thanks!
> Laszlo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Patch 0/2] Check Media status before starting DHCP process.
  2017-12-01  8:38 [Patch 0/2] Check Media status before starting DHCP process Jiaxin Wu
                   ` (2 preceding siblings ...)
  2017-12-01 11:53 ` [Patch 0/2] " Laszlo Ersek
@ 2017-12-04  1:53 ` Fu, Siyuan
  2017-12-04  2:00   ` Wu, Jiaxin
  3 siblings, 1 reply; 11+ messages in thread
From: Fu, Siyuan @ 2017-12-04  1:53 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Karunakar P

Hi, Jiaxin

If the network cable is plug-in after this error returned, will the IP/DHCP driver restart DHCP process to request an address automatically?


BestRegards
Fu Siyuan


> -----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 0/2] 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>
> 
> Jiaxin Wu (2):
>   MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP
>     process.
>   NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.
> 
>  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 13 ++++++++++++-
>  NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c                     | 14 +++++++++++++-
>  2 files changed, 25 insertions(+), 2 deletions(-)
> 
> --
> 1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Patch 0/2] Check Media status before starting DHCP process.
  2017-12-04  1:53 ` Fu, Siyuan
@ 2017-12-04  2:00   ` Wu, Jiaxin
  0 siblings, 0 replies; 11+ messages in thread
From: Wu, Jiaxin @ 2017-12-04  2:00 UTC (permalink / raw)
  To: Fu, Siyuan, edk2-devel@lists.01.org; +Cc: Ye, Ting, Karunakar P

Yes, IP driver will restart the DHCP process automatically when the user plug-in the cable. 

Thanks,
Jiaxin

> -----Original Message-----
> From: Fu, Siyuan
> Sent: Monday, December 4, 2017 9:54 AM
> To: Wu, Jiaxin <jiaxin.wu@intel.com>; edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Karunakar P <karunakarp@amiindia.co.in>
> Subject: RE: [Patch 0/2] Check Media status before starting DHCP process.
> 
> Hi, Jiaxin
> 
> If the network cable is plug-in after this error returned, will the IP/DHCP
> driver restart DHCP process to request an address automatically?
> 
> 
> BestRegards
> Fu Siyuan
> 
> 
> > -----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 0/2] 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>
> >
> > Jiaxin Wu (2):
> >   MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP
> >     process.
> >   NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.
> >
> >  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 13
> ++++++++++++-
> >  NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c                     | 14 +++++++++++++-
> >  2 files changed, 25 insertions(+), 2 deletions(-)
> >
> > --
> > 1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Patch 2/2] NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.
  2017-12-01  8:38 ` [Patch 2/2] NetworkPkg/Dhcp6Dxe: " Jiaxin Wu
@ 2017-12-13  1:39   ` Fu, Siyuan
  0 siblings, 0 replies; 11+ messages in thread
From: Fu, Siyuan @ 2017-12-13  1:39 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Karunakar P



Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>



> -----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 2/2] NetworkPkg/Dhcp6Dxe: 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>
> ---
>  NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
> b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
> index d8c0ad0..1107865 100644
> --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
> +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
> @@ -1,9 +1,9 @@
>  /** @file
>    This EFI_DHCP6_PROTOCOL interface implementation.
> 
> -  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 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.
> @@ -74,10 +74,11 @@ EfiDhcp6Start (
>  {
>    EFI_STATUS                   Status;
>    EFI_TPL                      OldTpl;
>    DHCP6_INSTANCE               *Instance;
>    DHCP6_SERVICE                *Service;
> +  BOOLEAN                      MediaPresent;
> 
>    if (This == NULL) {
>      return EFI_INVALID_PARAMETER;
>    }
> 
> @@ -99,10 +100,21 @@ EfiDhcp6Start (
>    if (Instance->IaCb.Ia->State != Dhcp6Init) {
>      return EFI_ALREADY_STARTED;
>    }
> 
>    OldTpl           = gBS->RaiseTPL (TPL_CALLBACK);
> +
> +  //
> +  // Check Media Satus.
> +  //
> +  MediaPresent = TRUE;
> +  NetLibDetectMedia (Service->Controller, &MediaPresent);
> +  if (!MediaPresent) {
> +    Status = EFI_NO_MEDIA;
> +    goto ON_ERROR;
> +  }
> +
>    Instance->UdpSts = EFI_ALREADY_STARTED;
> 
>    //
>    // Send the solicit message to start S.A.R.R process.
>    //
> --
> 1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.
  2017-12-01  8:38 ` [Patch 1/2] MdeModulePkg/Dhcp4Dxe: " Jiaxin Wu
@ 2017-12-13  3:32   ` Ye, Ting
  2017-12-13  5:16     ` Wu, Jiaxin
  0 siblings, 1 reply; 11+ messages in thread
From: Ye, Ting @ 2017-12-13  3:32 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Fu, Siyuan, Karunakar P

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



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.
  2017-12-13  3:32   ` Ye, Ting
@ 2017-12-13  5:16     ` Wu, Jiaxin
  2017-12-13  6:30       ` Ye, Ting
  0 siblings, 1 reply; 11+ messages in thread
From: Wu, Jiaxin @ 2017-12-13  5:16 UTC (permalink / raw)
  To: Ye, Ting, edk2-devel@lists.01.org; +Cc: Fu, Siyuan, Karunakar P

Hi Ting,

In such a case, DHCP process should also be trigged since DHCP doesn't have the knowledge of media status. We can't return directly since the media may be available. what do you think?

Thanks,
Jiaxin



> -----Original Message-----
> From: Ye, Ting
> Sent: Wednesday, December 13, 2017 11:33 AM
> To: Wu, Jiaxin <jiaxin.wu@intel.com>; 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.
> 
> 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



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.
  2017-12-13  5:16     ` Wu, Jiaxin
@ 2017-12-13  6:30       ` Ye, Ting
  0 siblings, 0 replies; 11+ messages in thread
From: Ye, Ting @ 2017-12-13  6:30 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Fu, Siyuan, Karunakar P

Hi Jiaxin,

Thanks for the clarification. I agree with your solution to try DHCP process when upper layer don't know the media status. However, we might need add some comments there to indicate such case, that MediaPresent is TRUE does not mean media is available. 
Others are good to me. Reviewed-by: Ye Ting <ting.ye@intel.com> 

Thanks,
Ting

-----Original Message-----
From: Wu, Jiaxin 
Sent: Wednesday, December 13, 2017 1:16 PM
To: Ye, Ting <ting.ye@intel.com>; 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.

Hi Ting,

In such a case, DHCP process should also be trigged since DHCP doesn't have the knowledge of media status. We can't return directly since the media may be available. what do you think?

Thanks,
Jiaxin



> -----Original Message-----
> From: Ye, Ting
> Sent: Wednesday, December 13, 2017 11:33 AM
> To: Wu, Jiaxin <jiaxin.wu@intel.com>; 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.
> 
> 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



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-12-13  6:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox