From 7648748e99eeeadec38fda7568adb260c4acc861 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Thu, 25 Feb 2016 10:48:58 +0800 Subject: MdeModulePkg: Change the default IPv4 config policy Git version '3d0a49ad' commit provided a scenario to resolve the performance issue for IPv4, but it's not workable for IPv6. To avoid IPv4 and IPv6 inconsistency, we decided to revert that version fix. If so, the default policy for Ip4Config2 is Ip4Config2PolicyDhcp, which results in all NIC ports attempting DHCP. So, this patch is used to changes the the default IPv4 config policy to Ip4Config2PolicyStatic and also defer the SetData operation after Ip4Config2Protocol installed. This update let the other platform drivers have chance to change the default config data by consume Ip4Config2Protocol. Cc: Subramanian Sriram Cc: El-Haj-Mahmoud Samer Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu Reviewed-by: Subramanian Sriram Reviewed-by: Fu Siyuan Reviewed-by: Ye Ting --- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 90 ++----------------------- 1 file changed, 6 insertions(+), 84 deletions(-) (limited to 'MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c') diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c index b9a294b199..58adba7c8c 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
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 @@ -563,57 +563,6 @@ Ip4InitProtocol ( } -/** - The event handle for IP4 auto reconfiguration. The original default - interface and route table will be removed as the default. - - @param[in] Context The IP4 service binding instance. - -**/ -VOID -EFIAPI -Ip4AutoReconfigCallBackDpc ( - IN VOID *Context - ) -{ - IP4_SERVICE *IpSb; - - IpSb = (IP4_SERVICE *) Context; - NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE); - - if (IpSb->State > IP4_SERVICE_UNSTARTED) { - IpSb->State = IP4_SERVICE_UNSTARTED; - } - - IpSb->Reconfig = TRUE; - - Ip4StartAutoConfig (&IpSb->Ip4Config2Instance); - - return ; -} - - -/** - Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK. - - @param Event The event that is signalled. - @param Context The IP4 service binding instance. - -**/ -VOID -EFIAPI -Ip4AutoReconfigCallBack ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - // - // Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK - // - QueueDpc (TPL_CALLBACK, Ip4AutoReconfigCallBackDpc, Context); -} - - /** Configure the IP4 child. If the child is already configured, change the configuration parameter. Otherwise configure it @@ -724,32 +673,11 @@ Ip4ConfigProtocol ( } else { // - // Use the default address. If the default configuration hasn't - // been started, start it. + // Use the default address. Check the state. // if (IpSb->State == IP4_SERVICE_UNSTARTED) { - // - // Create the ReconfigEvent to start the new configuration. - // - if (IpSb->ReconfigEvent == NULL) { - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - Ip4AutoReconfigCallBack, - IpSb, - &IpSb->ReconfigEvent - ); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - } - - Status = Ip4StartAutoConfig (&IpSb->Ip4Config2Instance); - - if (EFI_ERROR (Status)) { - goto CLOSE_RECONFIG_EVENT; - } + Status = EFI_NO_MAPPING; + goto ON_ERROR; } IpIf = IpSb->DefaultInterface; @@ -778,7 +706,7 @@ Ip4ConfigProtocol ( EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER ); if (EFI_ERROR (Status)) { - goto CLOSE_RECONFIG_EVENT; + goto ON_ERROR; } } InsertTailList (&IpIf->IpInstances, &IpInstance->AddrLink); @@ -797,12 +725,6 @@ Ip4ConfigProtocol ( return EFI_SUCCESS; -CLOSE_RECONFIG_EVENT: - if (IpSb->ReconfigEvent != NULL) { - gBS->CloseEvent (IpSb->ReconfigEvent); - IpSb->ReconfigEvent = NULL; - } - ON_ERROR: Ip4FreeRouteTable (IpInstance->RouteTable); IpInstance->RouteTable = NULL; @@ -2417,7 +2339,7 @@ Ip4TimerTicking ( // // Media transimit Unpresent to Present means new link movement is detected. // - if (!OldMediaPresent && IpSb->MediaPresent) { + if (!OldMediaPresent && IpSb->MediaPresent && (IpSb->Ip4Config2Instance.Policy == Ip4Config2PolicyDhcp)) { // // Signal the IP4 to run the dhcp configuration again. IP4 driver will free // old IP address related resource, such as route table and Interface, then -- cgit v1.2.3