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 <[email protected]>; [email protected]
> Cc: Fu, Siyuan <[email protected]>; Karunakar P
> <[email protected]>
> 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: [email protected]
> Cc: Ye, Ting <[email protected]>; Fu, Siyuan <[email protected]>;
> Karunakar P <[email protected]>; Wu, Jiaxin <[email protected]>
> Subject: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before
> starting DHCP process.
> 
> Cc: Ye Ting <[email protected]>
> Cc: Fu Siyuan <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Karunakar P <[email protected]>
> Signed-off-by: Wu Jiaxin <[email protected]>
> ---
>  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

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to