]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fixed the issue that IPv6 network stack assert infrequently – assert once every 300...
authorYe Ting <ting.ye@intel.com>
Fri, 14 Jun 2013 08:18:34 +0000 (08:18 +0000)
committertye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 14 Jun 2013 08:18:34 +0000 (08:18 +0000)
Signed-off-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ouyang Qian <qian.ouyang@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14422 6f19259b-4bc3-4df7-8a09-765794883524

NetworkPkg/Ip6Dxe/Ip6Driver.c

index 8095ed1ae20e15ecca540236122e581e7c0837bb..b9a64a80f8d3773363db1fb11c0af59045075d45 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The driver binding and service binding protocol for IP6 driver.\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -412,22 +412,21 @@ Ip6CreateService (
     goto ON_ERROR;\r
   }\r
 \r
-  //\r
-  // The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds.\r
-  //\r
-  Status = gBS->SetTimer (IpSb->FasterTimer, TimerPeriodic, TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS);\r
+  Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &IpSb->MacString);\r
   if (EFI_ERROR (Status)) {\r
     goto ON_ERROR;\r
   }\r
 \r
-  //\r
-  // The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds.\r
-  //\r
-  Status = gBS->SetTimer (IpSb->Timer, TimerPeriodic, TICKS_PER_MS * IP6_ONE_SECOND_IN_MS);\r
+  Status = Ip6ConfigInitInstance (&IpSb->Ip6ConfigInstance);\r
   if (EFI_ERROR (Status)) {\r
     goto ON_ERROR;\r
   }\r
 \r
+  IpSb->DefaultInterface = Ip6CreateInterface (IpSb, TRUE);\r
+  if (IpSb->DefaultInterface == NULL) {\r
+    Status = EFI_DEVICE_ERROR;\r
+    goto ON_ERROR;\r
+  }\r
 \r
   Status = gBS->CreateEvent (\r
                   EVT_NOTIFY_SIGNAL,\r
@@ -440,27 +439,6 @@ Ip6CreateService (
     goto ON_ERROR;\r
   }\r
 \r
-  Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);\r
-  if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
-  }\r
-\r
-  Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &IpSb->MacString);\r
-  if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
-  }\r
-\r
-  Status = Ip6ConfigInitInstance (&IpSb->Ip6ConfigInstance);\r
-  if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
-  }\r
-\r
-  IpSb->DefaultInterface = Ip6CreateInterface (IpSb, TRUE);\r
-  if (IpSb->DefaultInterface == NULL) {\r
-    Status = EFI_DEVICE_ERROR;\r
-    goto ON_ERROR;\r
-  }\r
-\r
   //\r
   // If there is any manual address, set it.\r
   //\r
@@ -557,19 +535,52 @@ Ip6DriverBindingStart (
                   NULL\r
                   );\r
 \r
-  if (EFI_ERROR (Status)) {\r
+  if (!EFI_ERROR (Status)) {\r
+    //\r
+    // ready to go: start the receiving and timer\r
+    //\r
+    Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);\r
+    if (EFI_ERROR (Status)) {\r
+      goto ON_ERROR;\r
+    }\r
+\r
+    //\r
+    // The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds.\r
+    //\r
+    Status = gBS->SetTimer (\r
+                    IpSb->FasterTimer,\r
+                    TimerPeriodic,\r
+                    TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      goto ON_ERROR;\r
+    }\r
+\r
+    //\r
+    // The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds.\r
+    //\r
+    Status = gBS->SetTimer (\r
+                    IpSb->Timer,\r
+                    TimerPeriodic,\r
+                    TICKS_PER_MS * IP6_ONE_SECOND_IN_MS\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      goto ON_ERROR;\r
+    }    \r
 \r
-    Ip6CleanService (IpSb);\r
-    FreePool (IpSb);\r
-  } else {\r
     //\r
     // Initialize the IP6 ID\r
     //\r
     mIp6Id = NET_RANDOM (NetRandomInitSeed ());\r
 \r
     Ip6SetVariableData (IpSb);\r
+\r
+    return EFI_SUCCESS;\r
   }\r
 \r
+ON_ERROR:\r
+  Ip6CleanService (IpSb);\r
+  FreePool (IpSb);\r
   return Status;\r
 }\r
 \r