MdeModulePkg/Ip4Dxe: fix a bug in IP4 driver for IpSec protocol notify.
The IP driver uses EfiCreateProtocolNotifyEvent() to register notify callback function for IpSec protocol, but it didn't notice that the callback will always be executed at least once, even the protocol wasn't in handle database. As a result, the Ip4IpSecProcessPacket() will still always call LocateProtocol() even the IpSec protocol is not installed, which will impact the network performance. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
This commit is contained in:
@@ -41,12 +41,20 @@ IpSec2InstalledCallback (
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
//
|
||||
// Close the event so it does not get called again.
|
||||
// Test if protocol was even found.
|
||||
// Notification function will be called at least once.
|
||||
//
|
||||
gBS->CloseEvent (Event);
|
||||
Status = gBS->LocateProtocol (&gEfiIpSec2ProtocolGuid, NULL, &mIpSec);
|
||||
if (Status == EFI_SUCCESS && mIpSec != NULL) {
|
||||
//
|
||||
// Close the event so it does not get called again.
|
||||
//
|
||||
gBS->CloseEvent (Event);
|
||||
|
||||
mIpSec2Installed = TRUE;
|
||||
mIpSec2Installed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user