diff options
author | fanwang2 <fan.wang@intel.com> | 2017-12-06 13:00:21 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-12-06 13:10:05 +0800 |
commit | ca4e43239282a97bdc1f5b34abafa2f8774691d9 (patch) | |
tree | 08c2dc86d3e4ee05046369f6335f1428108ec687 /MdeModulePkg/Include | |
parent | 1e6e6e188e01fa08f653706076a6465e0fcb0441 (diff) | |
download | edk2-ca4e43239282a97bdc1f5b34abafa2f8774691d9.zip edk2-ca4e43239282a97bdc1f5b34abafa2f8774691d9.tar.gz edk2-ca4e43239282a97bdc1f5b34abafa2f8774691d9.tar.bz2 |
MdeModulePkg/NetLib: Add NetLibDetectMediaWaitTimeout() API to support EFI_NOT_READY media state detection
In wireless connection, connecting state needs to be cared more
about. ECR 1772 redefined the state EFI_NOT_READY to represent
connecting state and can be retrieved from Aip protocol. This
patch adds a new API to check media state at a specified time
interval when network is connecting until the connection process
finishes or timeout.
V2:
* Return error status code directly when Aip protocol falied to detect
media rather than wait for another time's check.
* Set media state default value to EFI_SUCCESS since some platforms may
not support retrieving media state from Aip protocol.
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Diffstat (limited to 'MdeModulePkg/Include')
-rw-r--r-- | MdeModulePkg/Include/Library/NetLib.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/MdeModulePkg/Include/Library/NetLib.h b/MdeModulePkg/Include/Library/NetLib.h index b9df46c..7862df9 100644 --- a/MdeModulePkg/Include/Library/NetLib.h +++ b/MdeModulePkg/Include/Library/NetLib.h @@ -95,6 +95,12 @@ typedef UINT16 TCP_PORTNO; #define DNS_CLASS_HS 4
#define DNS_CLASS_ANY 255
+//
+// Number of 100ns units time Interval for network media state detect
+//
+#define MEDIA_STATE_DETECT_TIME_INTERVAL 1000000U
+
+
#pragma pack(1)
//
@@ -1248,6 +1254,40 @@ NetLibDetectMedia ( );
/**
+
+ 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 finishes 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
+ );
+
+
+/**
Create an IPv4 device path node.
The header type of IPv4 device path node is MESSAGING_DEVICE_PATH.
|