Skip to content

[Task] UefiPxeBcDxe: Check return status of NetLibDetectMediaWaitTimeout() in #1637

@makubacki

Description

@makubacki

The point of NetLibDetectMediaWaitTimeout() in DxeNetLib is to return whether network media is present. It returns a status code that is ignored in 14/15 calls throughout the codebase.

These are the possible return values defined for NetLibDetectMediaWaitTimeout():

/**
Detect media state for a network device. This routine will wait for a period of time at
a specified checking interval when a certain network is under connecting until connection
process finishs or timeout. If Aip protocol is supported by low layer drivers, three kinds
of media states can be detected: EFI_SUCCESS, EFI_NOT_READY and EFI_NO_MEDIA, represents
connected state, connecting state and no media state respectively. When function detects
the current state is EFI_NOT_READY, it will loop to wait for next time's check until state
turns to be EFI_SUCCESS or EFI_NO_MEDIA. If Aip protocol is not supported, function will
call NetLibDetectMedia() and return state directly.
@param[in] ServiceHandle The handle where network service binding protocols are
installed on.
@param[in] Timeout The maximum number of 100ns units to wait when network
is connecting. Zero value means detect once and return
immediately.
@param[out] MediaState The pointer to the detected media state.
@retval EFI_SUCCESS Media detection success.
@retval EFI_INVALID_PARAMETER ServiceHandle is not a valid network device handle or
MediaState pointer is NULL.
@retval EFI_DEVICE_ERROR A device error occurred.
@retval EFI_TIMEOUT Network is connecting but timeout.
**/
EFI_STATUS
EFIAPI
NetLibDetectMediaWaitTimeout (
IN EFI_HANDLE ServiceHandle,
IN UINT64 Timeout,
OUT EFI_STATUS *MediaState
)

It would be intuitive to expect that if NetLibDetectMediaWaitTimeout() returns a non-EFI_SUCCESS code, the output pointer value in the *MediaState argument is invalid. That's not done today.


This issue tracks exploration of conditionally accepting *MediaState in combination with the function return value. That may require other work like #1635 being completed first.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions