]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking
authorWang Fan <fan.wang@intel.com>
Thu, 11 Jan 2018 07:28:41 +0000 (15:28 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Fri, 12 Jan 2018 03:08:50 +0000 (11:08 +0800)
* Since wireless network can switch at very short time, the time interval
  of reconfig event checking is too long for this case. To achieve better
  performance and scalability, separate this task from Ip4 tick timer.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h

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
index ac48ad25841054a7b8e41e40520314be36c3abd7..b5cd7b7d393202364999fe3a3d45340664bc4a63 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -2249,18 +2249,10 @@ Ip4SentPacketTicking (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  There are two steps for this the heart beat timer of IP4 service instance. \r
-  First, it times out all of its IP4 children's received-but-not-delivered \r
-  and transmitted-but-not-recycle packets, and provides time input for its \r
-  IGMP protocol.\r
-  Second, a dedicated timer is used to poll underlying media status. In case \r
-  of cable swap, a new round auto configuration will be initiated. The timer \r
-  will signal the IP4 to run DHCP configuration again. IP4 driver will free\r
-  old IP address related resource, such as route table and Interface, then\r
-  initiate a DHCP process to acquire new IP, eventually create route table \r
-  for new IP address.\r
+  This heart beat timer of IP4 service instance times out all of its IP4 children's \r
+  received-but-not-delivered and transmitted-but-not-recycle packets, and provides \r
+  time input for its IGMP protocol.\r
 \r
   @param[in]  Event                  The IP4 service instance's heart beat timer.\r
   @param[in]  Context                The IP4 service instance.\r
@@ -2274,6 +2266,34 @@ Ip4TimerTicking (
   )\r
 {\r
   IP4_SERVICE               *IpSb;\r
+\r
+  IpSb = (IP4_SERVICE *) Context;\r
+  NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);\r
+  \r
+  Ip4PacketTimerTicking (IpSb);\r
+  Ip4IgmpTicking (IpSb);\r
+}\r
+\r
+/**\r
+  This dedicated timer is used to poll underlying network media status. In case \r
+  of cable swap or wireless network switch, a new round auto configuration will \r
+  be initiated. The timer will signal the IP4 to run DHCP configuration again. \r
+  IP4 driver will free old IP address related resource, such as route table and \r
+  Interface, then initiate a DHCP process to acquire new IP, eventually create \r
+  route table for new IP address.\r
+\r
+  @param[in]  Event                  The IP4 service instance's heart beat timer.\r
+  @param[in]  Context                The IP4 service instance.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+Ip4TimerReconfigChecking (\r
+  IN EFI_EVENT              Event,\r
+  IN VOID                   *Context\r
+  )\r
+{\r
+  IP4_SERVICE               *IpSb;\r
   BOOLEAN                   OldMediaPresent;\r
   EFI_STATUS                Status;\r
   EFI_SIMPLE_NETWORK_MODE   SnpModeData;\r
@@ -2283,9 +2303,6 @@ Ip4TimerTicking (
   \r
   OldMediaPresent = IpSb->MediaPresent;\r
 \r
-  Ip4PacketTimerTicking (IpSb);\r
-  Ip4IgmpTicking (IpSb);\r
-\r
   //\r
   // Get fresh mode data from MNP, since underlying media status may change. \r
   // Here, it needs to mention that the MediaPresent can also be checked even if \r
index f6b4047941eb374f33fb0120fad29079a813a9fd..8bdc39a3f10aa8ba333a2864f087c52f4df16e28 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Ip4 internal functions and type defintions.\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
@@ -206,7 +206,7 @@ struct _IP4_SERVICE {
   EFI_SIMPLE_NETWORK_MODE         SnpMode;\r
 \r
   EFI_EVENT                       Timer;\r
-\r
+  EFI_EVENT                       ReconfigCheckTimer;\r
   EFI_EVENT                       ReconfigEvent;\r
 \r
   BOOLEAN                         Reconfig;\r
@@ -334,10 +334,9 @@ Ip4Groups (
   );\r
 \r
 /**\r
-  The heart beat timer of IP4 service instance. It times out\r
-  all of its IP4 children's received-but-not-delivered and\r
-  transmitted-but-not-recycle packets, and provides time input\r
-  for its IGMP protocol.\r
+  This heart beat timer of IP4 service instance times out all of its IP4 children's \r
+  received-but-not-delivered and transmitted-but-not-recycle packets, and provides \r
+  time input for its IGMP protocol.\r
 \r
   @param[in]  Event                  The IP4 service instance's heart beat timer.\r
   @param[in]  Context                The IP4 service instance.\r
@@ -350,6 +349,25 @@ Ip4TimerTicking (
   IN VOID                   *Context\r
   );\r
 \r
+/**\r
+  This dedicated timer is used to poll underlying network media status. In case \r
+  of cable swap or wireless network switch, a new round auto configuration will \r
+  be initiated. The timer will signal the IP4 to run DHCP configuration again. \r
+  IP4 driver will free old IP address related resource, such as route table and \r
+  Interface, then initiate a DHCP process to acquire new IP, eventually create \r
+  route table for new IP address.\r
+\r
+  @param[in]  Event                  The IP4 service instance's heart beat timer.\r
+  @param[in]  Context                The IP4 service instance.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+Ip4TimerReconfigChecking (\r
+  IN EFI_EVENT              Event,\r
+  IN VOID                   *Context\r
+  );\r
+\r
 /**\r
   Decrease the life of the transmitted packets. If it is\r
   decreased to zero, cancel the packet. This function is\r