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 <sriram-s@hpe.com>
Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.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: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Subramanian Sriram <sriram-s@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
This commit is contained in:
Jiaxin Wu
2016-02-25 10:48:58 +08:00
parent d0d34cdf1d
commit 7648748e99
5 changed files with 150 additions and 107 deletions

View File

@@ -1,6 +1,6 @@
/** @file
Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2016, 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
@@ -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