]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/TcpIoLib: Check input Timeout before calling CheckEvent() service.
authorFu Siyuan <siyuan.fu@intel.com>
Tue, 5 Dec 2017 06:10:40 +0000 (14:10 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Tue, 12 Dec 2017 07:48:09 +0000 (15:48 +0800)
For TcpIoConnect() and TcpIoAccept(), this patch adds the check for Timeout event
before calling CheckEvent() service so as to avoid the unnecessary function call.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
MdeModulePkg/Include/Library/TcpIoLib.h
MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c

index 2871f6747ea0b775c094cfa6d1576a6b758d5bea..22629dbcd5596d5361776276c793f0467e1735ba 100644 (file)
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.\r
   It provides the helper routines to access TCP service.\r
 \r
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at<BR>\r
@@ -144,7 +144,7 @@ TcpIoDestroySocket (
   Connect to the other endpoint of the TCP socket.\r
 \r
   @param[in, out]  TcpIo     The TcpIo wrapping the TCP socket.\r
-  @param[in]       Timeout   The time to wait for connection done.\r
+  @param[in]       Timeout   The time to wait for connection done. Set to NULL for infinite wait.\r
   \r
   @retval EFI_SUCCESS            Connect to the other endpoint of the TCP socket\r
                                  successfully.\r
@@ -160,14 +160,14 @@ EFI_STATUS
 EFIAPI\r
 TcpIoConnect (\r
   IN OUT TCP_IO             *TcpIo,\r
-  IN     EFI_EVENT          Timeout\r
+  IN     EFI_EVENT          Timeout        OPTIONAL\r
   );\r
 \r
 /**\r
   Accept the incomding request from the other endpoint of the TCP socket.\r
 \r
   @param[in, out]  TcpIo     The TcpIo wrapping the TCP socket.\r
-  @param[in]       Timeout   The time to wait for connection done.\r
+  @param[in]       Timeout   The time to wait for connection done. Set to NULL for infinite wait.\r
 \r
   \r
   @retval EFI_SUCCESS            Connect to the other endpoint of the TCP socket\r
@@ -185,7 +185,7 @@ EFI_STATUS
 EFIAPI\r
 TcpIoAccept (\r
   IN OUT TCP_IO             *TcpIo,\r
-  IN     EFI_EVENT          Timeout\r
+  IN     EFI_EVENT          Timeout        OPTIONAL\r
   );\r
   \r
 /**\r
@@ -229,7 +229,7 @@ TcpIoTransmit (
   @param[in]       Packet      The buffer to hold the data copy from the socket rx buffer.\r
   @param[in]       AsyncMode   Is this receive asyncronous or not.\r
   @param[in]       Timeout     The time to wait for receiving the amount of data the Packet\r
-                               can hold.\r
+                               can hold. Set to NULL for infinite wait.\r
 \r
   @retval EFI_SUCCESS            The required amount of data is received from the socket.\r
   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.\r
@@ -246,7 +246,7 @@ TcpIoReceive (
   IN OUT TCP_IO             *TcpIo,\r
   IN     NET_BUF            *Packet,\r
   IN     BOOLEAN            AsyncMode,\r
-  IN     EFI_EVENT          Timeout\r
+  IN     EFI_EVENT          Timeout       OPTIONAL\r
   );\r
 \r
 #endif\r
index 17183e1a6c818df61f2e1715b02f4d0259de140b..a7637579f2c17a93eff09fce176fafceaa5fe2b7 100644 (file)
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.\r
   It provides the helper routines to access TCP service.\r
 \r
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at<BR>\r
@@ -530,7 +530,7 @@ TcpIoDestroySocket (
   Connect to the other endpoint of the TCP socket.\r
 \r
   @param[in, out]  TcpIo     The TcpIo wrapping the TCP socket.\r
-  @param[in]       Timeout   The time to wait for connection done.\r
+  @param[in]       Timeout   The time to wait for connection done. Set to NULL for infinite wait.\r
   \r
   @retval EFI_SUCCESS            Connect to the other endpoint of the TCP socket\r
                                  successfully.\r
@@ -546,7 +546,7 @@ EFI_STATUS
 EFIAPI\r
 TcpIoConnect (\r
   IN OUT TCP_IO             *TcpIo,\r
-  IN     EFI_EVENT          Timeout\r
+  IN     EFI_EVENT          Timeout        OPTIONAL\r
   )\r
 {\r
   EFI_TCP4_PROTOCOL         *Tcp4;\r
@@ -576,7 +576,7 @@ TcpIoConnect (
     return Status;\r
   }\r
 \r
-  while (!TcpIo->IsConnDone && EFI_ERROR (gBS->CheckEvent (Timeout))) {\r
+  while (!TcpIo->IsConnDone && ((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout)))) {\r
     if (TcpIo->TcpVersion == TCP_VERSION_4) {\r
       Tcp4->Poll (Tcp4);\r
     } else {\r
@@ -597,7 +597,7 @@ TcpIoConnect (
   Accept the incomding request from the other endpoint of the TCP socket.\r
 \r
   @param[in, out]  TcpIo     The TcpIo wrapping the TCP socket.\r
-  @param[in]       Timeout   The time to wait for connection done.\r
+  @param[in]       Timeout   The time to wait for connection done. Set to NULL for infinite wait.\r
 \r
   \r
   @retval EFI_SUCCESS            Connect to the other endpoint of the TCP socket\r
@@ -607,7 +607,7 @@ TcpIoConnect (
                                  supported in the implementation.\r
 \r
   @retval EFI_TIMEOUT            Failed to connect to the other endpoint of the\r
-                                 TCP socket in the specified time period.                      \r
+                                 TCP socket in the specified time period.\r
   @retval Others                 Other errors as indicated.\r
 \r
 **/\r
@@ -615,7 +615,7 @@ EFI_STATUS
 EFIAPI\r
 TcpIoAccept (\r
   IN OUT TCP_IO             *TcpIo,\r
-  IN     EFI_EVENT          Timeout\r
+  IN     EFI_EVENT          Timeout        OPTIONAL\r
   )\r
 {\r
   EFI_STATUS                Status;\r
@@ -646,7 +646,7 @@ TcpIoAccept (
     return Status;\r
   }\r
 \r
-  while (!TcpIo->IsListenDone && EFI_ERROR (gBS->CheckEvent (Timeout))) {\r
+  while (!TcpIo->IsListenDone && ((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout)))) {\r
     if (TcpIo->TcpVersion == TCP_VERSION_4) {\r
       Tcp4->Poll (Tcp4);\r
     } else {\r
@@ -860,7 +860,7 @@ ON_EXIT:
   @param[in]       Packet      The buffer to hold the data copy from the socket rx buffer.\r
   @param[in]       AsyncMode   Is this receive asyncronous or not.\r
   @param[in]       Timeout     The time to wait for receiving the amount of data the Packet\r
-                               can hold.\r
+                               can hold. Set to NULL for infinite wait.\r
 \r
   @retval EFI_SUCCESS            The required amount of data is received from the socket.\r
   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.\r
@@ -877,7 +877,7 @@ TcpIoReceive (
   IN OUT TCP_IO             *TcpIo,\r
   IN     NET_BUF            *Packet,\r
   IN     BOOLEAN            AsyncMode,\r
-  IN     EFI_EVENT          Timeout\r
+  IN     EFI_EVENT          Timeout       OPTIONAL\r
   )\r
 {\r
   EFI_TCP4_PROTOCOL         *Tcp4;\r