NetLibDetectMediaWaitTimeout() in DxeNetLib is called 15 places in the codebase. Multiple callers might call into the function for the same NIC such as Dhcp4Dxe, PxeBcDxe, etc. For example:
Snp->undi.initialize() <-- By SimpleNetworkDriverStart
Snp->undi.initialize() <-- By NetLibDetectMedia()
Snp->undi.initialize() 8000h:6h
Snp->undi.initialize()
Snp->undi.initialize() <-- By NetLibDetectMedia()
Snp->undi.initialize() 8000h:6h
Snp->undi.initialize()
Initialization might also occur multiple times in the same flow, for example, when SnpUndi32Initialize() first calls with PXE_OPFLAGS_INITIALIZE_DETECT_CABLE and if that fails, again with PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE:
|
// |
|
// If UNDI support cable detect for INITIALIZE command, try it first. |
|
// |
|
if (Snp->CableDetectSupported) { |
|
if (PxeInit (Snp, PXE_OPFLAGS_INITIALIZE_DETECT_CABLE) == EFI_SUCCESS) { |
|
goto ON_EXIT; |
|
} |
|
} |
|
|
|
Snp->Mode.MediaPresent = FALSE; |
|
|
|
EfiStatus = PxeInit (Snp, PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE); |
|
|
|
if (EFI_ERROR (EfiStatus)) { |
|
gBS->CloseEvent (Snp->Snp.WaitForPacket); |
|
goto ON_EXIT; |
|
} |
|
|
|
// |
|
// Try to update the MediaPresent field of EFI_SIMPLE_NETWORK_MODE if the UNDI support it. |
|
// |
|
if (Snp->MediaStatusSupported) { |
|
PxeGetStatus (Snp, NULL, FALSE); |
|
} |
Collectively this can lead to SNP shutting down and reinitializing multiple times when it might not need to impacting stability and performance.
This issue tracks exploration of a solution to reduce the number of times shutdown and reinitialization occurs across the network stack.
NetLibDetectMediaWaitTimeout()inDxeNetLibis called 15 places in the codebase. Multiple callers might call into the function for the same NIC such asDhcp4Dxe,PxeBcDxe, etc. For example:Initialization might also occur multiple times in the same flow, for example, when
SnpUndi32Initialize()first calls withPXE_OPFLAGS_INITIALIZE_DETECT_CABLEand if that fails, again withPXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE:mu_basecore/NetworkPkg/SnpDxe/Initialize.c
Lines 254 to 277 in c4a845c
Collectively this can lead to SNP shutting down and reinitializing multiple times when it might not need to impacting stability and performance.
This issue tracks exploration of a solution to reduce the number of times shutdown and reinitialization occurs across the network stack.