mirror of https://github.com/acidanthera/audk.git
NetworkPkg: remove unnecessary timeout event when setting IPv6 address.
Use Ip6Cfg->SetData() to set IP6 manual address is asynchronous process and the registered data notify event will be singled when process is done. So it's not necessary to create another timeout event for the address setting. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18610 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
48cb33ec30
commit
bf9f7cea98
|
@ -1376,16 +1376,15 @@ PxeBcRegisterIp6Address (
|
||||||
EFI_IP6_CONFIG_MANUAL_ADDRESS CfgAddr;
|
EFI_IP6_CONFIG_MANUAL_ADDRESS CfgAddr;
|
||||||
EFI_IPv6_ADDRESS GatewayAddr;
|
EFI_IPv6_ADDRESS GatewayAddr;
|
||||||
UINTN DataSize;
|
UINTN DataSize;
|
||||||
EFI_EVENT TimeOutEvt;
|
|
||||||
EFI_EVENT MappedEvt;
|
EFI_EVENT MappedEvt;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT64 DadTriggerTime;
|
|
||||||
EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits;
|
|
||||||
BOOLEAN NoGateway;
|
BOOLEAN NoGateway;
|
||||||
|
EFI_IPv6_ADDRESS *Ip6Addr;
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
TimeOutEvt = NULL;
|
|
||||||
MappedEvt = NULL;
|
MappedEvt = NULL;
|
||||||
|
Ip6Addr = NULL;
|
||||||
DataSize = sizeof (EFI_IP6_CONFIG_POLICY);
|
DataSize = sizeof (EFI_IP6_CONFIG_POLICY);
|
||||||
Ip6Cfg = Private->Ip6Cfg;
|
Ip6Cfg = Private->Ip6Cfg;
|
||||||
Ip6 = Private->Ip6;
|
Ip6 = Private->Ip6;
|
||||||
|
@ -1426,34 +1425,6 @@ PxeBcRegisterIp6Address (
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Get Duplicate Address Detection Transmits count.
|
|
||||||
//
|
|
||||||
DataSize = sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS);
|
|
||||||
Status = Ip6Cfg->GetData (
|
|
||||||
Ip6Cfg,
|
|
||||||
Ip6ConfigDataTypeDupAddrDetectTransmits,
|
|
||||||
&DataSize,
|
|
||||||
&DadXmits
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_EXIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create a timer as setting address timeout event since DAD in IP6 driver.
|
|
||||||
//
|
|
||||||
Status = gBS->CreateEvent (
|
|
||||||
EVT_TIMER,
|
|
||||||
TPL_CALLBACK,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
&TimeOutEvt
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_EXIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create a notify event to set address flag when DAD if IP6 driver succeeded.
|
// Create a notify event to set address flag when DAD if IP6 driver succeeded.
|
||||||
//
|
//
|
||||||
|
@ -1468,6 +1439,7 @@ PxeBcRegisterIp6Address (
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Private->IsAddressOk = FALSE;
|
||||||
Status = Ip6Cfg->RegisterDataNotify (
|
Status = Ip6Cfg->RegisterDataNotify (
|
||||||
Ip6Cfg,
|
Ip6Cfg,
|
||||||
Ip6ConfigDataTypeManualAddress,
|
Ip6ConfigDataTypeManualAddress,
|
||||||
|
@ -1485,23 +1457,54 @@ PxeBcRegisterIp6Address (
|
||||||
);
|
);
|
||||||
if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
|
if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
} else if (Status == EFI_NOT_READY) {
|
||||||
|
//
|
||||||
|
// Poll the network until the asynchronous process is finished.
|
||||||
|
//
|
||||||
|
while (!Private->IsAddressOk) {
|
||||||
|
Ip6->Poll (Ip6);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Check whether the IP6 address setting is successed.
|
||||||
|
//
|
||||||
|
DataSize = 0;
|
||||||
|
Status = Ip6Cfg->GetData (
|
||||||
|
Ip6Cfg,
|
||||||
|
Ip6ConfigDataTypeManualAddress,
|
||||||
|
&DataSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (Status != EFI_BUFFER_TOO_SMALL || DataSize == 0) {
|
||||||
|
Status = EFI_DEVICE_ERROR;
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
Ip6Addr = AllocatePool (DataSize);
|
||||||
// Start the 5 secondes timer to wait for setting address.
|
if (Ip6Addr == NULL) {
|
||||||
//
|
return EFI_OUT_OF_RESOURCES;
|
||||||
Status = EFI_NO_MAPPING;
|
}
|
||||||
DadTriggerTime = TICKS_PER_SECOND * DadXmits.DupAddrDetectTransmits + PXEBC_DAD_ADDITIONAL_DELAY;
|
Status = Ip6Cfg->GetData (
|
||||||
gBS->SetTimer (TimeOutEvt, TimerRelative, DadTriggerTime);
|
Ip6Cfg,
|
||||||
|
Ip6ConfigDataTypeManualAddress,
|
||||||
|
&DataSize,
|
||||||
|
(VOID*) Ip6Addr
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
Status = EFI_DEVICE_ERROR;
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) {
|
for (Index = 0; Index < DataSize / sizeof (EFI_IPv6_ADDRESS); Index++) {
|
||||||
Ip6->Poll (Ip6);
|
if (CompareMem (Ip6Addr + Index, Address, sizeof (EFI_IPv6_ADDRESS)) == 0) {
|
||||||
if (Private->IsAddressOk) {
|
break;
|
||||||
Status = EFI_SUCCESS;
|
}
|
||||||
break;
|
}
|
||||||
|
if (Index == DataSize / sizeof (EFI_IPv6_ADDRESS)) {
|
||||||
|
Status = EFI_ABORTED;
|
||||||
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set the default gateway address back if needed.
|
// Set the default gateway address back if needed.
|
||||||
//
|
//
|
||||||
|
@ -1526,8 +1529,8 @@ ON_EXIT:
|
||||||
);
|
);
|
||||||
gBS->CloseEvent (MappedEvt);
|
gBS->CloseEvent (MappedEvt);
|
||||||
}
|
}
|
||||||
if (TimeOutEvt != NULL) {
|
if (Ip6Addr != NULL) {
|
||||||
gBS->CloseEvent (TimeOutEvt);
|
FreePool (Ip6Addr);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue