Hi, Lubo Since the Private->FilePathUri is extracted from the URI device path node in the FilePath, the (Private->FilePathUri != NULL) implied that the FilePath is not end device path node. So I thinke the whole change could be simplified to if ((UsingIpv6 != Private->UsingIpv6) || ((Private->FilePathUri != NULL) && (AsciiStrCmp (Private->BootFileUri, Private->FilePathUri) != 0))) { // stop and restart driver }
Best Regards Siyuan > -----Original Message----- > From: Zhang, Lubo > Sent: Thursday, March 17, 2016 5:19 PM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [patch] NetworkPkg:Fix Http boot download issue. > > When http boot download the second time without return > to the boot manager, the DHCP process will start twice > wiht the same Boot file uri and print the information twice > which we not expected. This is caused by wrong logic > of handling the device path of the boot file when loading it. > > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > --- > NetworkPkg/HttpBootDxe/HttpBootImpl.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c > b/NetworkPkg/HttpBootDxe/HttpBootImpl.c > index 3adb08d..487a01e 100644 > --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c > +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c > @@ -385,10 +385,11 @@ HttpBootDxeLoadFile ( > { > HTTP_BOOT_PRIVATE_DATA *Private; > HTTP_BOOT_VIRTUAL_NIC *VirtualNic; > BOOLEAN MediaPresent; > BOOLEAN UsingIpv6; > + BOOLEAN IsFilePathUriEqual; > EFI_STATUS Status; > > if (This == NULL || BufferSize == NULL || FilePath == NULL) { > return EFI_INVALID_PARAMETER; > } > @@ -428,12 +429,18 @@ HttpBootDxeLoadFile ( > // > // Restart the HTTP boot driver in 2 cases: > // 1. Http boot Driver has already been started but not on the required > IP > version. > // 2. The required boot FilePath is different with the one we produced in > the device path > // protocol. > - // > - if ((UsingIpv6 != Private->UsingIpv6) || !IsDevicePathEnd(FilePath)) { > + IsFilePathUriEqual = FALSE; > + if (!IsDevicePathEnd (FilePath)) { > + if ((Private->FilePathUri != NULL) && (AsciiStrCmp > (Private->BootFileUri, > Private->FilePathUri) == 0)) { > + IsFilePathUriEqual =TRUE; > + } > + } > + > + if ((UsingIpv6 != Private->UsingIpv6) || ((Private->FilePathUri != NULL) > && !IsFilePathUriEqual)) { > Status = HttpBootStop (Private); > if (!EFI_ERROR (Status)) { > Status = HttpBootStart (Private, UsingIpv6, FilePath); > } > } > -- > 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel