* [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking
@ 2018-01-11 10:20 Wang Fan
2018-01-12 0:47 ` Wu, Jiaxin
2018-01-12 0:50 ` Fu, Siyuan
0 siblings, 2 replies; 3+ messages in thread
From: Wang Fan @ 2018-01-11 10:20 UTC (permalink / raw)
To: edk2-devel; +Cc: Jiaxin Wu, Ye Ting, Fu Siyuan
* 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>
---
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 28 +++++++++++++-
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 47 +++++++++++++++--------
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h | 30 ++++++++++++---
3 files changed, 83 insertions(+), 22 deletions(-)
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index 49b7dc5..552c4e1 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -1,9 +1,9 @@
/** @file
The driver binding and service binding protocol for IP4 driver.
-Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -251,10 +251,11 @@ Ip4CreateService (
IpSb->MnpConfigData.DisableBackgroundPolling = FALSE;
ZeroMem (&IpSb->SnpMode, sizeof (EFI_SIMPLE_NETWORK_MODE));
IpSb->Timer = NULL;
+ IpSb->ReconfigCheckTimer = NULL;
IpSb->ReconfigEvent = NULL;
IpSb->Reconfig = FALSE;
@@ -283,10 +284,22 @@ Ip4CreateService (
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL | EVT_TIMER,
+ TPL_CALLBACK,
+ Ip4TimerReconfigChecking,
+ IpSb,
+ &IpSb->ReconfigCheckTimer
+ );
+
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
+
+ Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
Ip4AutoReconfigCallBack,
IpSb,
&IpSb->ReconfigEvent
@@ -408,10 +421,17 @@ Ip4CleanService (
gBS->CloseEvent (IpSb->Timer);
IpSb->Timer = NULL;
}
+ if (IpSb->ReconfigCheckTimer != NULL) {
+ gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerCancel, 0);
+ gBS->CloseEvent (IpSb->ReconfigCheckTimer);
+
+ IpSb->ReconfigCheckTimer = NULL;
+ }
+
if (IpSb->DefaultInterface != NULL) {
Status = Ip4FreeInterface (IpSb->DefaultInterface, NULL);
if (EFI_ERROR (Status)) {
return Status;
@@ -628,10 +648,16 @@ Ip4DriverBindingStart (
if (EFI_ERROR (Status)) {
goto UNINSTALL_PROTOCOL;
}
+ Status = gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerPeriodic, 500 * TICKS_PER_MS);
+
+ if (EFI_ERROR (Status)) {
+ goto UNINSTALL_PROTOCOL;
+ }
+
//
// Initialize the IP4 ID
//
mIp4Id = (UINT16)NET_RANDOM (NetRandomInitSeed ());
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index ac48ad2..b5cd7b7 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -1,8 +1,8 @@
/** @file
-Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
@@ -2247,22 +2247,14 @@ Ip4SentPacketTicking (
}
return EFI_SUCCESS;
}
-
/**
- There are two steps for this the heart beat timer of IP4 service instance.
- First, it times out all of its IP4 children's received-but-not-delivered
- and transmitted-but-not-recycle packets, and provides time input for its
- IGMP protocol.
- Second, a dedicated timer is used to poll underlying media status. In case
- of cable swap, a new round auto configuration will be initiated. The timer
- will signal the IP4 to run DHCP configuration again. IP4 driver will free
- old IP address related resource, such as route table and Interface, then
- initiate a DHCP process to acquire new IP, eventually create route table
- for new IP address.
+ This heart beat timer of IP4 service instance times out all of its IP4 children's
+ received-but-not-delivered and transmitted-but-not-recycle packets, and provides
+ time input for its IGMP protocol.
@param[in] Event The IP4 service instance's heart beat timer.
@param[in] Context The IP4 service instance.
**/
@@ -2272,22 +2264,47 @@ Ip4TimerTicking (
IN EFI_EVENT Event,
IN VOID *Context
)
{
IP4_SERVICE *IpSb;
+
+ IpSb = (IP4_SERVICE *) Context;
+ NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
+
+ Ip4PacketTimerTicking (IpSb);
+ Ip4IgmpTicking (IpSb);
+}
+
+/**
+ This dedicated timer is used to poll underlying network media status. In case
+ of cable swap or wireless network switch, a new round auto configuration will
+ be initiated. The timer will signal the IP4 to run DHCP configuration again.
+ IP4 driver will free old IP address related resource, such as route table and
+ Interface, then initiate a DHCP process to acquire new IP, eventually create
+ route table for new IP address.
+
+ @param[in] Event The IP4 service instance's heart beat timer.
+ @param[in] Context The IP4 service instance.
+
+**/
+VOID
+EFIAPI
+Ip4TimerReconfigChecking (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ IP4_SERVICE *IpSb;
BOOLEAN OldMediaPresent;
EFI_STATUS Status;
EFI_SIMPLE_NETWORK_MODE SnpModeData;
IpSb = (IP4_SERVICE *) Context;
NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
OldMediaPresent = IpSb->MediaPresent;
- Ip4PacketTimerTicking (IpSb);
- Ip4IgmpTicking (IpSb);
-
//
// Get fresh mode data from MNP, since underlying media status may change.
// Here, it needs to mention that the MediaPresent can also be checked even if
// EFI_NOT_STARTED returned while this MNP child driver instance isn't configured.
//
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
index f6b4047..8bdc39a 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
@@ -1,9 +1,9 @@
/** @file
Ip4 internal functions and type defintions.
-Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -204,11 +204,11 @@ struct _IP4_SERVICE {
EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
EFI_SIMPLE_NETWORK_MODE SnpMode;
EFI_EVENT Timer;
-
+ EFI_EVENT ReconfigCheckTimer;
EFI_EVENT ReconfigEvent;
BOOLEAN Reconfig;
//
@@ -332,14 +332,13 @@ Ip4Groups (
IN BOOLEAN JoinFlag,
IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
);
/**
- The heart beat timer of IP4 service instance. It times out
- all of its IP4 children's received-but-not-delivered and
- transmitted-but-not-recycle packets, and provides time input
- for its IGMP protocol.
+ This heart beat timer of IP4 service instance times out all of its IP4 children's
+ received-but-not-delivered and transmitted-but-not-recycle packets, and provides
+ time input for its IGMP protocol.
@param[in] Event The IP4 service instance's heart beat timer.
@param[in] Context The IP4 service instance.
**/
@@ -349,10 +348,29 @@ Ip4TimerTicking (
IN EFI_EVENT Event,
IN VOID *Context
);
/**
+ This dedicated timer is used to poll underlying network media status. In case
+ of cable swap or wireless network switch, a new round auto configuration will
+ be initiated. The timer will signal the IP4 to run DHCP configuration again.
+ IP4 driver will free old IP address related resource, such as route table and
+ Interface, then initiate a DHCP process to acquire new IP, eventually create
+ route table for new IP address.
+
+ @param[in] Event The IP4 service instance's heart beat timer.
+ @param[in] Context The IP4 service instance.
+
+**/
+VOID
+EFIAPI
+Ip4TimerReconfigChecking (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
Decrease the life of the transmitted packets. If it is
decreased to zero, cancel the packet. This function is
called by Ip4PacketTimerTicking which time out both the
received-but-not-delivered and transmitted-but-not-recycle
packets.
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking
2018-01-11 10:20 [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking Wang Fan
@ 2018-01-12 0:47 ` Wu, Jiaxin
2018-01-12 0:50 ` Fu, Siyuan
1 sibling, 0 replies; 3+ messages in thread
From: Wu, Jiaxin @ 2018-01-12 0:47 UTC (permalink / raw)
To: Wang, Fan, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
> -----Original Message-----
> From: Wang, Fan
> Sent: Thursday, January 11, 2018 6:20 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu,
> Siyuan <siyuan.fu@intel.com>
> Subject: [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for
> reconfig checking
>
> * 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>
> ---
> MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 28
> +++++++++++++-
> MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 47
> +++++++++++++++--------
> MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h | 30
> ++++++++++++---
> 3 files changed, 83 insertions(+), 22 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> index 49b7dc5..552c4e1 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> @@ -1,9 +1,9 @@
> /** @file
> The driver binding and service binding protocol for IP4 driver.
>
> -Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
> License
> which accompanies this distribution. The full text of the license may be
> found at
> @@ -251,10 +251,11 @@ Ip4CreateService (
> IpSb->MnpConfigData.DisableBackgroundPolling = FALSE;
>
> ZeroMem (&IpSb->SnpMode, sizeof (EFI_SIMPLE_NETWORK_MODE));
>
> IpSb->Timer = NULL;
> + IpSb->ReconfigCheckTimer = NULL;
>
> IpSb->ReconfigEvent = NULL;
>
> IpSb->Reconfig = FALSE;
>
> @@ -283,10 +284,22 @@ Ip4CreateService (
> if (EFI_ERROR (Status)) {
> goto ON_ERROR;
> }
>
> Status = gBS->CreateEvent (
> + EVT_NOTIFY_SIGNAL | EVT_TIMER,
> + TPL_CALLBACK,
> + Ip4TimerReconfigChecking,
> + IpSb,
> + &IpSb->ReconfigCheckTimer
> + );
> +
> + if (EFI_ERROR (Status)) {
> + goto ON_ERROR;
> + }
> +
> + Status = gBS->CreateEvent (
> EVT_NOTIFY_SIGNAL,
> TPL_NOTIFY,
> Ip4AutoReconfigCallBack,
> IpSb,
> &IpSb->ReconfigEvent
> @@ -408,10 +421,17 @@ Ip4CleanService (
> gBS->CloseEvent (IpSb->Timer);
>
> IpSb->Timer = NULL;
> }
>
> + if (IpSb->ReconfigCheckTimer != NULL) {
> + gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerCancel, 0);
> + gBS->CloseEvent (IpSb->ReconfigCheckTimer);
> +
> + IpSb->ReconfigCheckTimer = NULL;
> + }
> +
> if (IpSb->DefaultInterface != NULL) {
> Status = Ip4FreeInterface (IpSb->DefaultInterface, NULL);
>
> if (EFI_ERROR (Status)) {
> return Status;
> @@ -628,10 +648,16 @@ Ip4DriverBindingStart (
>
> if (EFI_ERROR (Status)) {
> goto UNINSTALL_PROTOCOL;
> }
>
> + Status = gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerPeriodic, 500 *
> TICKS_PER_MS);
> +
> + if (EFI_ERROR (Status)) {
> + goto UNINSTALL_PROTOCOL;
> + }
> +
> //
> // Initialize the IP4 ID
> //
> mIp4Id = (UINT16)NET_RANDOM (NetRandomInitSeed ());
>
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
> index ac48ad2..b5cd7b7 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
> @@ -1,8 +1,8 @@
> /** @file
>
> -Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
> License
> which accompanies this distribution. The full text of the license may be
> found at
> http://opensource.org/licenses/bsd-license.php
>
> @@ -2247,22 +2247,14 @@ Ip4SentPacketTicking (
> }
>
> return EFI_SUCCESS;
> }
>
> -
> /**
> - There are two steps for this the heart beat timer of IP4 service instance.
> - First, it times out all of its IP4 children's received-but-not-delivered
> - and transmitted-but-not-recycle packets, and provides time input for its
> - IGMP protocol.
> - Second, a dedicated timer is used to poll underlying media status. In case
> - of cable swap, a new round auto configuration will be initiated. The timer
> - will signal the IP4 to run DHCP configuration again. IP4 driver will free
> - old IP address related resource, such as route table and Interface, then
> - initiate a DHCP process to acquire new IP, eventually create route table
> - for new IP address.
> + This heart beat timer of IP4 service instance times out all of its IP4
> children's
> + received-but-not-delivered and transmitted-but-not-recycle packets, and
> provides
> + time input for its IGMP protocol.
>
> @param[in] Event The IP4 service instance's heart beat timer.
> @param[in] Context The IP4 service instance.
>
> **/
> @@ -2272,22 +2264,47 @@ Ip4TimerTicking (
> IN EFI_EVENT Event,
> IN VOID *Context
> )
> {
> IP4_SERVICE *IpSb;
> +
> + IpSb = (IP4_SERVICE *) Context;
> + NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
> +
> + Ip4PacketTimerTicking (IpSb);
> + Ip4IgmpTicking (IpSb);
> +}
> +
> +/**
> + This dedicated timer is used to poll underlying network media status. In
> case
> + of cable swap or wireless network switch, a new round auto configuration
> will
> + be initiated. The timer will signal the IP4 to run DHCP configuration again.
> + IP4 driver will free old IP address related resource, such as route table and
> + Interface, then initiate a DHCP process to acquire new IP, eventually create
> + route table for new IP address.
> +
> + @param[in] Event The IP4 service instance's heart beat timer.
> + @param[in] Context The IP4 service instance.
> +
> +**/
> +VOID
> +EFIAPI
> +Ip4TimerReconfigChecking (
> + IN EFI_EVENT Event,
> + IN VOID *Context
> + )
> +{
> + IP4_SERVICE *IpSb;
> BOOLEAN OldMediaPresent;
> EFI_STATUS Status;
> EFI_SIMPLE_NETWORK_MODE SnpModeData;
>
> IpSb = (IP4_SERVICE *) Context;
> NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
>
> OldMediaPresent = IpSb->MediaPresent;
>
> - Ip4PacketTimerTicking (IpSb);
> - Ip4IgmpTicking (IpSb);
> -
> //
> // Get fresh mode data from MNP, since underlying media status may
> change.
> // Here, it needs to mention that the MediaPresent can also be checked
> even if
> // EFI_NOT_STARTED returned while this MNP child driver instance isn't
> configured.
> //
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
> index f6b4047..8bdc39a 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
> @@ -1,9 +1,9 @@
> /** @file
> Ip4 internal functions and type defintions.
>
> -Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
> License
> which accompanies this distribution. The full text of the license may be
> found at
> @@ -204,11 +204,11 @@ struct _IP4_SERVICE {
>
> EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
> EFI_SIMPLE_NETWORK_MODE SnpMode;
>
> EFI_EVENT Timer;
> -
> + EFI_EVENT ReconfigCheckTimer;
> EFI_EVENT ReconfigEvent;
>
> BOOLEAN Reconfig;
>
> //
> @@ -332,14 +332,13 @@ Ip4Groups (
> IN BOOLEAN JoinFlag,
> IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
> );
>
> /**
> - The heart beat timer of IP4 service instance. It times out
> - all of its IP4 children's received-but-not-delivered and
> - transmitted-but-not-recycle packets, and provides time input
> - for its IGMP protocol.
> + This heart beat timer of IP4 service instance times out all of its IP4
> children's
> + received-but-not-delivered and transmitted-but-not-recycle packets, and
> provides
> + time input for its IGMP protocol.
>
> @param[in] Event The IP4 service instance's heart beat timer.
> @param[in] Context The IP4 service instance.
>
> **/
> @@ -349,10 +348,29 @@ Ip4TimerTicking (
> IN EFI_EVENT Event,
> IN VOID *Context
> );
>
> /**
> + This dedicated timer is used to poll underlying network media status. In
> case
> + of cable swap or wireless network switch, a new round auto configuration
> will
> + be initiated. The timer will signal the IP4 to run DHCP configuration again.
> + IP4 driver will free old IP address related resource, such as route table and
> + Interface, then initiate a DHCP process to acquire new IP, eventually create
> + route table for new IP address.
> +
> + @param[in] Event The IP4 service instance's heart beat timer.
> + @param[in] Context The IP4 service instance.
> +
> +**/
> +VOID
> +EFIAPI
> +Ip4TimerReconfigChecking (
> + IN EFI_EVENT Event,
> + IN VOID *Context
> + );
> +
> +/**
> Decrease the life of the transmitted packets. If it is
> decreased to zero, cancel the packet. This function is
> called by Ip4PacketTimerTicking which time out both the
> received-but-not-delivered and transmitted-but-not-recycle
> packets.
> --
> 1.9.5.msysgit.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking
2018-01-11 10:20 [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking Wang Fan
2018-01-12 0:47 ` Wu, Jiaxin
@ 2018-01-12 0:50 ` Fu, Siyuan
1 sibling, 0 replies; 3+ messages in thread
From: Fu, Siyuan @ 2018-01-12 0:50 UTC (permalink / raw)
To: Wang, Fan, edk2-devel@lists.01.org; +Cc: Ye, Ting, Wu, Jiaxin
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Wang Fan
> Sent: Thursday, January 11, 2018 6:20 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu,
> Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for
> reconfig checking
>
> * 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>
> ---
> MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 28 +++++++++++++-
> MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 47 +++++++++++++++---
> -----
> MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h | 30 ++++++++++++---
> 3 files changed, 83 insertions(+), 22 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> index 49b7dc5..552c4e1 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> @@ -1,9 +1,9 @@
> /** @file
> The driver binding and service binding protocol for IP4 driver.
>
> -Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
> License
> which accompanies this distribution. The full text of the license may be
> found at
> @@ -251,10 +251,11 @@ Ip4CreateService (
> IpSb->MnpConfigData.DisableBackgroundPolling = FALSE;
>
> ZeroMem (&IpSb->SnpMode, sizeof (EFI_SIMPLE_NETWORK_MODE));
>
> IpSb->Timer = NULL;
> + IpSb->ReconfigCheckTimer = NULL;
>
> IpSb->ReconfigEvent = NULL;
>
> IpSb->Reconfig = FALSE;
>
> @@ -283,10 +284,22 @@ Ip4CreateService (
> if (EFI_ERROR (Status)) {
> goto ON_ERROR;
> }
>
> Status = gBS->CreateEvent (
> + EVT_NOTIFY_SIGNAL | EVT_TIMER,
> + TPL_CALLBACK,
> + Ip4TimerReconfigChecking,
> + IpSb,
> + &IpSb->ReconfigCheckTimer
> + );
> +
> + if (EFI_ERROR (Status)) {
> + goto ON_ERROR;
> + }
> +
> + Status = gBS->CreateEvent (
> EVT_NOTIFY_SIGNAL,
> TPL_NOTIFY,
> Ip4AutoReconfigCallBack,
> IpSb,
> &IpSb->ReconfigEvent
> @@ -408,10 +421,17 @@ Ip4CleanService (
> gBS->CloseEvent (IpSb->Timer);
>
> IpSb->Timer = NULL;
> }
>
> + if (IpSb->ReconfigCheckTimer != NULL) {
> + gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerCancel, 0);
> + gBS->CloseEvent (IpSb->ReconfigCheckTimer);
> +
> + IpSb->ReconfigCheckTimer = NULL;
> + }
> +
> if (IpSb->DefaultInterface != NULL) {
> Status = Ip4FreeInterface (IpSb->DefaultInterface, NULL);
>
> if (EFI_ERROR (Status)) {
> return Status;
> @@ -628,10 +648,16 @@ Ip4DriverBindingStart (
>
> if (EFI_ERROR (Status)) {
> goto UNINSTALL_PROTOCOL;
> }
>
> + Status = gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerPeriodic, 500 *
> TICKS_PER_MS);
> +
> + if (EFI_ERROR (Status)) {
> + goto UNINSTALL_PROTOCOL;
> + }
> +
> //
> // Initialize the IP4 ID
> //
> mIp4Id = (UINT16)NET_RANDOM (NetRandomInitSeed ());
>
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
> index ac48ad2..b5cd7b7 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
> @@ -1,8 +1,8 @@
> /** @file
>
> -Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
> License
> which accompanies this distribution. The full text of the license may be
> found at
> http://opensource.org/licenses/bsd-license.php
>
> @@ -2247,22 +2247,14 @@ Ip4SentPacketTicking (
> }
>
> return EFI_SUCCESS;
> }
>
> -
> /**
> - There are two steps for this the heart beat timer of IP4 service
> instance.
> - First, it times out all of its IP4 children's received-but-not-
> delivered
> - and transmitted-but-not-recycle packets, and provides time input for
> its
> - IGMP protocol.
> - Second, a dedicated timer is used to poll underlying media status. In
> case
> - of cable swap, a new round auto configuration will be initiated. The
> timer
> - will signal the IP4 to run DHCP configuration again. IP4 driver will
> free
> - old IP address related resource, such as route table and Interface,
> then
> - initiate a DHCP process to acquire new IP, eventually create route
> table
> - for new IP address.
> + This heart beat timer of IP4 service instance times out all of its IP4
> children's
> + received-but-not-delivered and transmitted-but-not-recycle packets, and
> provides
> + time input for its IGMP protocol.
>
> @param[in] Event The IP4 service instance's heart
> beat timer.
> @param[in] Context The IP4 service instance.
>
> **/
> @@ -2272,22 +2264,47 @@ Ip4TimerTicking (
> IN EFI_EVENT Event,
> IN VOID *Context
> )
> {
> IP4_SERVICE *IpSb;
> +
> + IpSb = (IP4_SERVICE *) Context;
> + NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
> +
> + Ip4PacketTimerTicking (IpSb);
> + Ip4IgmpTicking (IpSb);
> +}
> +
> +/**
> + This dedicated timer is used to poll underlying network media status.
> In case
> + of cable swap or wireless network switch, a new round auto
> configuration will
> + be initiated. The timer will signal the IP4 to run DHCP configuration
> again.
> + IP4 driver will free old IP address related resource, such as route
> table and
> + Interface, then initiate a DHCP process to acquire new IP, eventually
> create
> + route table for new IP address.
> +
> + @param[in] Event The IP4 service instance's heart
> beat timer.
> + @param[in] Context The IP4 service instance.
> +
> +**/
> +VOID
> +EFIAPI
> +Ip4TimerReconfigChecking (
> + IN EFI_EVENT Event,
> + IN VOID *Context
> + )
> +{
> + IP4_SERVICE *IpSb;
> BOOLEAN OldMediaPresent;
> EFI_STATUS Status;
> EFI_SIMPLE_NETWORK_MODE SnpModeData;
>
> IpSb = (IP4_SERVICE *) Context;
> NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
>
> OldMediaPresent = IpSb->MediaPresent;
>
> - Ip4PacketTimerTicking (IpSb);
> - Ip4IgmpTicking (IpSb);
> -
> //
> // Get fresh mode data from MNP, since underlying media status may
> change.
> // Here, it needs to mention that the MediaPresent can also be checked
> even if
> // EFI_NOT_STARTED returned while this MNP child driver instance isn't
> configured.
> //
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
> index f6b4047..8bdc39a 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
> @@ -1,9 +1,9 @@
> /** @file
> Ip4 internal functions and type defintions.
>
> -Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
> (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
> License
> which accompanies this distribution. The full text of the license may be
> found at
> @@ -204,11 +204,11 @@ struct _IP4_SERVICE {
>
> EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
> EFI_SIMPLE_NETWORK_MODE SnpMode;
>
> EFI_EVENT Timer;
> -
> + EFI_EVENT ReconfigCheckTimer;
> EFI_EVENT ReconfigEvent;
>
> BOOLEAN Reconfig;
>
> //
> @@ -332,14 +332,13 @@ Ip4Groups (
> IN BOOLEAN JoinFlag,
> IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
> );
>
> /**
> - The heart beat timer of IP4 service instance. It times out
> - all of its IP4 children's received-but-not-delivered and
> - transmitted-but-not-recycle packets, and provides time input
> - for its IGMP protocol.
> + This heart beat timer of IP4 service instance times out all of its IP4
> children's
> + received-but-not-delivered and transmitted-but-not-recycle packets, and
> provides
> + time input for its IGMP protocol.
>
> @param[in] Event The IP4 service instance's heart
> beat timer.
> @param[in] Context The IP4 service instance.
>
> **/
> @@ -349,10 +348,29 @@ Ip4TimerTicking (
> IN EFI_EVENT Event,
> IN VOID *Context
> );
>
> /**
> + This dedicated timer is used to poll underlying network media status.
> In case
> + of cable swap or wireless network switch, a new round auto
> configuration will
> + be initiated. The timer will signal the IP4 to run DHCP configuration
> again.
> + IP4 driver will free old IP address related resource, such as route
> table and
> + Interface, then initiate a DHCP process to acquire new IP, eventually
> create
> + route table for new IP address.
> +
> + @param[in] Event The IP4 service instance's heart
> beat timer.
> + @param[in] Context The IP4 service instance.
> +
> +**/
> +VOID
> +EFIAPI
> +Ip4TimerReconfigChecking (
> + IN EFI_EVENT Event,
> + IN VOID *Context
> + );
> +
> +/**
> Decrease the life of the transmitted packets. If it is
> decreased to zero, cancel the packet. This function is
> called by Ip4PacketTimerTicking which time out both the
> received-but-not-delivered and transmitted-but-not-recycle
> packets.
> --
> 1.9.5.msysgit.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-12 0:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11 10:20 [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking Wang Fan
2018-01-12 0:47 ` Wu, Jiaxin
2018-01-12 0:50 ` Fu, Siyuan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox