]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Driver.c
index 49b7dc55d5da3feed2b40ee57bc963542ae549c8..552c4e190b40cde75a6b74e1e4ca9bcb5ecb572c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The driver binding and service binding protocol for IP4 driver.\r
 \r
-Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
 \r
 This program and the accompanying materials\r
@@ -253,6 +253,7 @@ Ip4CreateService (
   ZeroMem (&IpSb->SnpMode, sizeof (EFI_SIMPLE_NETWORK_MODE));\r
 \r
   IpSb->Timer = NULL;\r
+  IpSb->ReconfigCheckTimer = NULL;\r
 \r
   IpSb->ReconfigEvent = NULL;\r
 \r
@@ -284,6 +285,18 @@ Ip4CreateService (
     goto ON_ERROR;\r
   }\r
 \r
+  Status = gBS->CreateEvent (\r
+                  EVT_NOTIFY_SIGNAL | EVT_TIMER,\r
+                  TPL_CALLBACK,\r
+                  Ip4TimerReconfigChecking,\r
+                  IpSb,\r
+                  &IpSb->ReconfigCheckTimer\r
+                  );\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    goto ON_ERROR;\r
+  }\r
+\r
   Status = gBS->CreateEvent (\r
                   EVT_NOTIFY_SIGNAL,\r
                   TPL_NOTIFY,\r
@@ -410,6 +423,13 @@ Ip4CleanService (
     IpSb->Timer = NULL;\r
   }\r
 \r
+  if (IpSb->ReconfigCheckTimer != NULL) {\r
+    gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerCancel, 0);\r
+    gBS->CloseEvent (IpSb->ReconfigCheckTimer);\r
+\r
+    IpSb->ReconfigCheckTimer = NULL;\r
+  }\r
+\r
   if (IpSb->DefaultInterface != NULL) {\r
     Status = Ip4FreeInterface (IpSb->DefaultInterface, NULL);\r
 \r
@@ -630,6 +650,12 @@ Ip4DriverBindingStart (
     goto UNINSTALL_PROTOCOL;\r
   }\r
 \r
+  Status = gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerPeriodic, 500 * TICKS_PER_MS);\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    goto UNINSTALL_PROTOCOL;\r
+  }\r
+\r
   //\r
   // Initialize the IP4 ID\r
   //\r