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,7 +1,7 @@
/** @file
The driver binding and service binding protocol for IP4 driver.
Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
@@ -254,7 +254,7 @@ Ip4CreateService (
//
// Create various resources. First create the route table, timer
// event and MNP child. IGMP, interface's initialization depend
// event, ReconfigEvent and MNP child. IGMP, interface's initialization depend
// on the MNP child.
//
IpSb->DefaultRouteTable = Ip4CreateRouteTable ();
@@ -276,6 +276,17 @@ Ip4CreateService (
goto ON_ERROR;
}
Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
Ip4AutoReconfigCallBack,
IpSb,
&IpSb->ReconfigEvent
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
Status = NetLibCreateServiceChild (
Controller,
ImageHandle,
@@ -511,6 +522,13 @@ Ip4DriverBindingStart (
{
EFI_STATUS Status;
IP4_SERVICE *IpSb;
EFI_IP4_CONFIG2_PROTOCOL *Ip4Cfg2;
UINTN Index;
IP4_CONFIG2_DATA_ITEM *DataItem;
IpSb = NULL;
Ip4Cfg2 = NULL;
DataItem = NULL;
//
// Test for the Ip4 service binding protocol
@@ -536,6 +554,8 @@ Ip4DriverBindingStart (
ASSERT (IpSb != NULL);
Ip4Cfg2 = &IpSb->Ip4Config2Instance.Ip4Config2;
//
// Install the Ip4ServiceBinding Protocol onto ControlerHandle
//
@@ -544,13 +564,40 @@ Ip4DriverBindingStart (
&gEfiIp4ServiceBindingProtocolGuid,
&IpSb->ServiceBinding,
&gEfiIp4Config2ProtocolGuid,
&IpSb->Ip4Config2Instance.Ip4Config2,
Ip4Cfg2,
NULL
);
if (EFI_ERROR (Status)) {
goto FREE_SERVICE;
}
//
// Read the config data from NV variable again.
// The default data can be changed by other drivers.
//
Status = Ip4Config2ReadConfigData (IpSb->MacString, &IpSb->Ip4Config2Instance);
if (EFI_ERROR (Status)) {
goto UNINSTALL_PROTOCOL;
}
//
// Consume the installed EFI_IP4_CONFIG2_PROTOCOL to set the default data items.
//
for (Index = Ip4Config2DataTypePolicy; Index < Ip4Config2DataTypeMaximum; Index++) {
DataItem = &IpSb->Ip4Config2Instance.DataItem[Index];
if (DataItem->Data.Ptr != NULL) {
Status = Ip4Cfg2->SetData (
Ip4Cfg2,
Index,
DataItem->DataSize,
DataItem->Data.Ptr
);
if (EFI_ERROR(Status)) {
goto UNINSTALL_PROTOCOL;
}
}
}
//
// Ready to go: start the receiving and timer.