[edk2] [Patch] MdeModulePkg: Fix the wrong IpSb->State update

2016-06-22 Thread Jiaxin Wu
This patch is used to fix the wrong IpSb->State update issue.

Issue reproduce steps:
1 .First PXE boot, then boot to shell;
2. ifconfig -s eth0 dhcp (Success);
3. Reboot and do PXE, then boot to shell;
4. ifconfig -s eth0 dhcp (Platform failed to get IP address no matter
   how many times retried.)

Root cause:
On step3 reboot, policy is DHCP (Changed by step2). So, Ip4Dxe driver
will try to get one IP address from DHCP server automatically. Before
it get the IP address successfully, the IpSb->State will be always in
IP4_SERVICE_STARTED status until the Instance->Dhcp4Event is triggered,
then it can be changed to IP4_SERVICE_CONFIGED. But the DHCP process
will be interrupted by PXE boot, which will change the policy to static,
and the Instance->Dhcp4Event will be also closed directly. However,
current implementation doesn't update the IpSb->State to
IP4_SERVICE_UNSTARTED status in such case. So, failure happened.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Ryan Harkin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index d0fa132..10d7181 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -140,11 +140,11 @@ Ip4Config2OnPolicyChanged (
   IpSb->DefaultInterface  = IpIf;
   InsertHeadList (&IpSb->Interfaces, &IpIf->Link);
   IpSb->DefaultRouteTable = RouteTable;
   Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
 
-  if (IpSb->State == IP4_SERVICE_CONFIGED) {
+  if (IpSb->State == IP4_SERVICE_CONFIGED || IpSb->State == 
IP4_SERVICE_STARTED) {
 IpSb->State = IP4_SERVICE_UNSTARTED;
   }
 
   //
   // Start the dhcp configuration.
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] MdeModulePkg: Fix the wrong IpSb->State update

2016-06-22 Thread Ryan Harkin
On 22 June 2016 at 12:14, Jiaxin Wu  wrote:
> This patch is used to fix the wrong IpSb->State update issue.
>
> Issue reproduce steps:
> 1 .First PXE boot, then boot to shell;
> 2. ifconfig -s eth0 dhcp (Success);
> 3. Reboot and do PXE, then boot to shell;
> 4. ifconfig -s eth0 dhcp (Platform failed to get IP address no matter
>how many times retried.)
>
> Root cause:
> On step3 reboot, policy is DHCP (Changed by step2). So, Ip4Dxe driver
> will try to get one IP address from DHCP server automatically. Before
> it get the IP address successfully, the IpSb->State will be always in
> IP4_SERVICE_STARTED status until the Instance->Dhcp4Event is triggered,
> then it can be changed to IP4_SERVICE_CONFIGED. But the DHCP process
> will be interrupted by PXE boot, which will change the policy to static,
> and the Instance->Dhcp4Event will be also closed directly. However,
> current implementation doesn't update the IpSb->State to
> IP4_SERVICE_UNSTARTED status in such case. So, failure happened.
>
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Cc: Ryan Harkin 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiaxin Wu 

I tested this on Juno ARM Development Platform and it now works as expected.

I still have a problem with Versatile Express TC2 that is fixed by
reverting commit 7648748e99eeeadec38fda7568adb260c4acc861, however it
is a different problem than the one fixed in this patch.  I'll
investigate that further and report back if/when I find out more.

Reviewed-by: Ryan Harkin 
Tested-by: Ryan Harkin 

> ---
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> index d0fa132..10d7181 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> @@ -140,11 +140,11 @@ Ip4Config2OnPolicyChanged (
>IpSb->DefaultInterface  = IpIf;
>InsertHeadList (&IpSb->Interfaces, &IpIf->Link);
>IpSb->DefaultRouteTable = RouteTable;
>Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
>
> -  if (IpSb->State == IP4_SERVICE_CONFIGED) {
> +  if (IpSb->State == IP4_SERVICE_CONFIGED || IpSb->State == 
> IP4_SERVICE_STARTED) {
>  IpSb->State = IP4_SERVICE_UNSTARTED;
>}
>
>//
>// Start the dhcp configuration.
> --
> 1.9.5.msysgit.1
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] MdeModulePkg: Fix the wrong IpSb->State update

2016-06-22 Thread Wu, Jiaxin


> -Original Message-
> From: Ryan Harkin [mailto:ryan.har...@linaro.org]
> Sent: Wednesday, June 22, 2016 8:00 PM
> To: Wu, Jiaxin 
> Cc: edk2-devel-01 ; Ye, Ting ;
> Fu, Siyuan 
> Subject: Re: [Patch] MdeModulePkg: Fix the wrong IpSb->State update
> 
> On 22 June 2016 at 12:14, Jiaxin Wu  wrote:
> > This patch is used to fix the wrong IpSb->State update issue.
> >
> > Issue reproduce steps:
> > 1 .First PXE boot, then boot to shell; 2. ifconfig -s eth0 dhcp
> > (Success); 3. Reboot and do PXE, then boot to shell; 4. ifconfig -s
> > eth0 dhcp (Platform failed to get IP address no matter
> >how many times retried.)
> >
> > Root cause:
> > On step3 reboot, policy is DHCP (Changed by step2). So, Ip4Dxe driver
> > will try to get one IP address from DHCP server automatically. Before
> > it get the IP address successfully, the IpSb->State will be always in
> > IP4_SERVICE_STARTED status until the Instance->Dhcp4Event is
> > triggered, then it can be changed to IP4_SERVICE_CONFIGED. But the
> > DHCP process will be interrupted by PXE boot, which will change the
> > policy to static, and the Instance->Dhcp4Event will be also closed
> > directly. However, current implementation doesn't update the
> > IpSb->State to IP4_SERVICE_UNSTARTED status in such case. So, failure
> happened.
> >
> > Cc: Ye Ting 
> > Cc: Fu Siyuan 
> > Cc: Ryan Harkin 
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Jiaxin Wu 
> 
> I tested this on Juno ARM Development Platform and it now works as
> expected.

Thanks your verification.


> 
> I still have a problem with Versatile Express TC2 that is fixed by reverting
> commit 7648748e99eeeadec38fda7568adb260c4acc861, however it is a
> different problem than the one fixed in this patch.  I'll investigate that 
> further
> and report back if/when I find out more.

Welcome your any feedback:).


> 
> Reviewed-by: Ryan Harkin 
> Tested-by: Ryan Harkin 
> 
> > ---
> >  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> > b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> > index d0fa132..10d7181 100644
> > --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> > +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> > @@ -140,11 +140,11 @@ Ip4Config2OnPolicyChanged (
> >IpSb->DefaultInterface  = IpIf;
> >InsertHeadList (&IpSb->Interfaces, &IpIf->Link);
> >IpSb->DefaultRouteTable = RouteTable;
> >Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
> >
> > -  if (IpSb->State == IP4_SERVICE_CONFIGED) {
> > +  if (IpSb->State == IP4_SERVICE_CONFIGED || IpSb->State ==
> > + IP4_SERVICE_STARTED) {
> >  IpSb->State = IP4_SERVICE_UNSTARTED;
> >}
> >
> >//
> >// Start the dhcp configuration.
> > --
> > 1.9.5.msysgit.1
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] MdeModulePkg: Fix the wrong IpSb->State update

2016-06-22 Thread Fu, Siyuan
Reviewed-by: Fu Siyuan 

> -Original Message-
> From: Wu, Jiaxin
> Sent: Wednesday, June 22, 2016 7:14 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting ; Fu, Siyuan ; Ryan
> Harkin 
> Subject: [Patch] MdeModulePkg: Fix the wrong IpSb->State update
> 
> This patch is used to fix the wrong IpSb->State update issue.
> 
> Issue reproduce steps:
> 1 .First PXE boot, then boot to shell;
> 2. ifconfig -s eth0 dhcp (Success);
> 3. Reboot and do PXE, then boot to shell;
> 4. ifconfig -s eth0 dhcp (Platform failed to get IP address no matter
>how many times retried.)
> 
> Root cause:
> On step3 reboot, policy is DHCP (Changed by step2). So, Ip4Dxe driver
> will try to get one IP address from DHCP server automatically. Before
> it get the IP address successfully, the IpSb->State will be always in
> IP4_SERVICE_STARTED status until the Instance->Dhcp4Event is triggered,
> then it can be changed to IP4_SERVICE_CONFIGED. But the DHCP process
> will be interrupted by PXE boot, which will change the policy to static,
> and the Instance->Dhcp4Event will be also closed directly. However,
> current implementation doesn't update the IpSb->State to
> IP4_SERVICE_UNSTARTED status in such case. So, failure happened.
> 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Cc: Ryan Harkin 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiaxin Wu 
> ---
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> index d0fa132..10d7181 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> @@ -140,11 +140,11 @@ Ip4Config2OnPolicyChanged (
>IpSb->DefaultInterface  = IpIf;
>InsertHeadList (&IpSb->Interfaces, &IpIf->Link);
>IpSb->DefaultRouteTable = RouteTable;
>Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
> 
> -  if (IpSb->State == IP4_SERVICE_CONFIGED) {
> +  if (IpSb->State == IP4_SERVICE_CONFIGED || IpSb->State ==
> IP4_SERVICE_STARTED) {
>  IpSb->State = IP4_SERVICE_UNSTARTED;
>}
> 
>//
>// Start the dhcp configuration.
> --
> 1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] MdeModulePkg: Fix the wrong IpSb->State update

2016-06-22 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Wednesday, June 22, 2016 7:14 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Ryan Harkin 

Subject: [Patch] MdeModulePkg: Fix the wrong IpSb->State update

This patch is used to fix the wrong IpSb->State update issue.

Issue reproduce steps:
1 .First PXE boot, then boot to shell;
2. ifconfig -s eth0 dhcp (Success);
3. Reboot and do PXE, then boot to shell; 4. ifconfig -s eth0 dhcp (Platform 
failed to get IP address no matter
   how many times retried.)

Root cause:
On step3 reboot, policy is DHCP (Changed by step2). So, Ip4Dxe driver will try 
to get one IP address from DHCP server automatically. Before it get the IP 
address successfully, the IpSb->State will be always in IP4_SERVICE_STARTED 
status until the Instance->Dhcp4Event is triggered, then it can be changed to 
IP4_SERVICE_CONFIGED. But the DHCP process will be interrupted by PXE boot, 
which will change the policy to static, and the Instance->Dhcp4Event will be 
also closed directly. However, current implementation doesn't update the 
IpSb->State to IP4_SERVICE_UNSTARTED status in such case. So, failure happened.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Ryan Harkin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index d0fa132..10d7181 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -140,11 +140,11 @@ Ip4Config2OnPolicyChanged (
   IpSb->DefaultInterface  = IpIf;
   InsertHeadList (&IpSb->Interfaces, &IpIf->Link);
   IpSb->DefaultRouteTable = RouteTable;
   Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
 
-  if (IpSb->State == IP4_SERVICE_CONFIGED) {
+  if (IpSb->State == IP4_SERVICE_CONFIGED || IpSb->State == 
+ IP4_SERVICE_STARTED) {
 IpSb->State = IP4_SERVICE_UNSTARTED;
   }
 
   //
   // Start the dhcp configuration.
--
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel