This patch updates the HttpDxe driver to use the DPC mechanism to avoid long
time delay when single event.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18451
6f19259b-4bc3-4df7-8a09-
765794883524
#include <Library/DebugLib.h>\r
#include <Library/NetLib.h>\r
#include <Library/HttpLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/NetLib.h>\r
#include <Library/HttpLib.h>\r
-#include <Library/TcpIoLib.h>\r
+#include <Library/DpcLib.h>\r
\r
//\r
// UEFI Driver Model Protocols\r
\r
//\r
// UEFI Driver Model Protocols\r
DebugLib\r
NetLib\r
HttpLib\r
DebugLib\r
NetLib\r
HttpLib\r
\r
[Protocols]\r
gEfiHttpServiceBindingProtocolGuid ## BY_START\r
\r
[Protocols]\r
gEfiHttpServiceBindingProtocolGuid ## BY_START\r
return EFI_SUCCESS;\r
\r
Error5:\r
return EFI_SUCCESS;\r
\r
Error5:\r
)\r
{\r
HTTP_PROTOCOL *HttpInstance;\r
)\r
{\r
HTTP_PROTOCOL *HttpInstance;\r
\r
if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r
\r
if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r
return EFI_NOT_STARTED;\r
}\r
\r
return EFI_NOT_STARTED;\r
}\r
\r
- return HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);\r
+ Status = HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);\r
+\r
+ DispatchDpc ();\r
+\r
+ return Status;\r
/**\r
The notify function associated with TxToken for Tcp4->Transmit().\r
\r
/**\r
The notify function associated with TxToken for Tcp4->Transmit().\r
\r
- @param[in] Event The event signaled.\r
@param[in] Context The context.\r
\r
**/\r
VOID\r
EFIAPI\r
@param[in] Context The context.\r
\r
**/\r
VOID\r
EFIAPI\r
-HttpTcpTransmitNotify (\r
- IN EFI_EVENT Event,\r
+HttpTcpTransmitNotifyDpc (\r
IN VOID *Context\r
)\r
{\r
HTTP_TOKEN_WRAP *Wrap;\r
\r
IN VOID *Context\r
)\r
{\r
HTTP_TOKEN_WRAP *Wrap;\r
\r
- if ((Event == NULL) || (Context == NULL)) {\r
+ if (Context == NULL) {\r
+/**\r
+ Request HttpTcpTransmitNotifyDpc as a DPC at TPL_CALLBACK.\r
+\r
+ @param Event The receive event delivered to TCP for transmit.\r
+ @param Context Context for the callback.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+HttpTcpTransmitNotify (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ //\r
+ // Request HttpTcpTransmitNotifyDpc as a DPC at TPL_CALLBACK\r
+ //\r
+ QueueDpc (TPL_CALLBACK, HttpTcpTransmitNotifyDpc, Context);\r
+}\r
+\r
+\r
/**\r
The notify function associated with RxToken for Tcp4->Receive ().\r
\r
/**\r
The notify function associated with RxToken for Tcp4->Receive ().\r
\r
- @param[in] Event The event signaled.\r
@param[in] Context The context.\r
\r
**/\r
VOID\r
EFIAPI\r
@param[in] Context The context.\r
\r
**/\r
VOID\r
EFIAPI\r
-HttpTcpReceiveNotify (\r
- IN EFI_EVENT Event,\r
+HttpTcpReceiveNotifyDpc (\r
IN VOID *Context\r
)\r
{\r
IN VOID *Context\r
)\r
{\r
EFI_STATUS Status;\r
HTTP_PROTOCOL *HttpInstance;\r
\r
EFI_STATUS Status;\r
HTTP_PROTOCOL *HttpInstance;\r
\r
- if ((Event == NULL) || (Context == NULL)) {\r
+ if (Context == NULL) {\r
FreePool (Wrap);\r
}\r
\r
FreePool (Wrap);\r
}\r
\r
+/**\r
+ Request HttpTcpReceiveNotifyDpc as a DPC at TPL_CALLBACK.\r
+\r
+ @param Event The receive event delivered to TCP for receive.\r
+ @param Context Context for the callback.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+HttpTcpReceiveNotify (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ //\r
+ // Request HttpTcpTransmitNotifyDpc as a DPC at TPL_CALLBACK\r
+ //\r
+ QueueDpc (TPL_CALLBACK, HttpTcpReceiveNotifyDpc, Context);\r
+}\r
+\r
+\r
/**\r
Create events for the TCP4 connection token and TCP4 close token.\r
\r
/**\r
Create events for the TCP4 connection token and TCP4 close token.\r
\r