From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EBC8521F833A9 for ; Thu, 11 Jan 2018 16:41:57 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2018 16:47:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,346,1511856000"; d="scan'208";a="9117535" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga008.fm.intel.com with ESMTP; 11 Jan 2018 16:47:11 -0800 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 11 Jan 2018 16:47:11 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 11 Jan 2018 16:47:10 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by shsmsx102.ccr.corp.intel.com ([169.254.2.189]) with mapi id 14.03.0319.002; Fri, 12 Jan 2018 08:47:08 +0800 From: "Wu, Jiaxin" To: "Wang, Fan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Fu, Siyuan" Thread-Topic: [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking Thread-Index: AQHTisXOIabR4rhYpEeudo0rSJ/xKqNvaCuQ Date: Fri, 12 Jan 2018 00:47:08 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741635C64E@SHSMSX103.ccr.corp.intel.com> References: <1515666006-5488-1-git-send-email-fan.wang@intel.com> In-Reply-To: <1515666006-5488-1-git-send-email-fan.wang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2YwNTA0ZGUtZDU0My00MjRlLWE5M2UtYmQ3ZTc3YzE3MzJhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ims3TWdydjd4Tmh1UUxsRDlEdHpuZnU5UEkybStTUVdYTGhsZDlMZHVZaHc9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for reconfig checking X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 00:41:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiaxin Wu > -----Original Message----- > From: Wang, Fan > Sent: Thursday, January 11, 2018 6:20 PM > To: edk2-devel@lists.01.org > Cc: Wu, Jiaxin ; Ye, Ting ; Fu, > Siyuan > Subject: [Patch] MdeModulePkg/Ip4Dxe: Add an independent timer for > reconfig checking >=20 > * 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. >=20 > Cc: Jiaxin Wu > Cc: Ye Ting > Cc: Fu Siyuan > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Wang Fan > --- > 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(-) >=20 > 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. >=20 > -Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
> (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
>=20 > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > @@ -251,10 +251,11 @@ Ip4CreateService ( > IpSb->MnpConfigData.DisableBackgroundPolling =3D FALSE; >=20 > ZeroMem (&IpSb->SnpMode, sizeof (EFI_SIMPLE_NETWORK_MODE)); >=20 > IpSb->Timer =3D NULL; > + IpSb->ReconfigCheckTimer =3D NULL; >=20 > IpSb->ReconfigEvent =3D NULL; >=20 > IpSb->Reconfig =3D FALSE; >=20 > @@ -283,10 +284,22 @@ Ip4CreateService ( > if (EFI_ERROR (Status)) { > goto ON_ERROR; > } >=20 > Status =3D gBS->CreateEvent ( > + EVT_NOTIFY_SIGNAL | EVT_TIMER, > + TPL_CALLBACK, > + Ip4TimerReconfigChecking, > + IpSb, > + &IpSb->ReconfigCheckTimer > + ); > + > + if (EFI_ERROR (Status)) { > + goto ON_ERROR; > + } > + > + Status =3D gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > TPL_NOTIFY, > Ip4AutoReconfigCallBack, > IpSb, > &IpSb->ReconfigEvent > @@ -408,10 +421,17 @@ Ip4CleanService ( > gBS->CloseEvent (IpSb->Timer); >=20 > IpSb->Timer =3D NULL; > } >=20 > + if (IpSb->ReconfigCheckTimer !=3D NULL) { > + gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerCancel, 0); > + gBS->CloseEvent (IpSb->ReconfigCheckTimer); > + > + IpSb->ReconfigCheckTimer =3D NULL; > + } > + > if (IpSb->DefaultInterface !=3D NULL) { > Status =3D Ip4FreeInterface (IpSb->DefaultInterface, NULL); >=20 > if (EFI_ERROR (Status)) { > return Status; > @@ -628,10 +648,16 @@ Ip4DriverBindingStart ( >=20 > if (EFI_ERROR (Status)) { > goto UNINSTALL_PROTOCOL; > } >=20 > + Status =3D gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerPeriodic, 500= * > TICKS_PER_MS); > + > + if (EFI_ERROR (Status)) { > + goto UNINSTALL_PROTOCOL; > + } > + > // > // Initialize the IP4 ID > // > mIp4Id =3D (UINT16)NET_RANDOM (NetRandomInitSeed ()); >=20 > 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 >=20 > -Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > http://opensource.org/licenses/bsd-license.php >=20 > @@ -2247,22 +2247,14 @@ Ip4SentPacketTicking ( > } >=20 > return EFI_SUCCESS; > } >=20 > - > /** > - There are two steps for this the heart beat timer of IP4 service insta= nce. > - First, it times out all of its IP4 children's received-but-not-deliver= ed > - and transmitted-but-not-recycle packets, and provides time input for i= ts > - 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 t= imer > - will signal the IP4 to run DHCP configuration again. IP4 driver will f= ree > - old IP address related resource, such as route table and Interface, th= en > - initiate a DHCP process to acquire new IP, eventually create route tab= le > - 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, an= d > provides > + time input for its IGMP protocol. >=20 > @param[in] Event The IP4 service instance's heart be= at timer. > @param[in] Context The IP4 service instance. >=20 > **/ > @@ -2272,22 +2264,47 @@ Ip4TimerTicking ( > IN EFI_EVENT Event, > IN VOID *Context > ) > { > IP4_SERVICE *IpSb; > + > + IpSb =3D (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 configurati= on > 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 ta= ble 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 be= at 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; >=20 > IpSb =3D (IP4_SERVICE *) Context; > NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE); >=20 > OldMediaPresent =3D IpSb->MediaPresent; >=20 > - 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. >=20 > -Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
> (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
>=20 > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > @@ -204,11 +204,11 @@ struct _IP4_SERVICE { >=20 > EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData; > EFI_SIMPLE_NETWORK_MODE SnpMode; >=20 > EFI_EVENT Timer; > - > + EFI_EVENT ReconfigCheckTimer; > EFI_EVENT ReconfigEvent; >=20 > BOOLEAN Reconfig; >=20 > // > @@ -332,14 +332,13 @@ Ip4Groups ( > IN BOOLEAN JoinFlag, > IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL > ); >=20 > /** > - 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, an= d > provides > + time input for its IGMP protocol. >=20 > @param[in] Event The IP4 service instance's heart be= at timer. > @param[in] Context The IP4 service instance. >=20 > **/ > @@ -349,10 +348,29 @@ Ip4TimerTicking ( > IN EFI_EVENT Event, > IN VOID *Context > ); >=20 > /** > + This dedicated timer is used to poll underlying network media status. = In > case > + of cable swap or wireless network switch, a new round auto configurati= on > 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 ta= ble 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 be= at 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