]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Update Http driver to use DPC mechanism.
authorFu Siyuan <siyuan.fu@intel.com>
Mon, 14 Sep 2015 09:06:26 +0000 (09:06 +0000)
committersfu5 <sfu5@Edk2>
Mon, 14 Sep 2015 09:06:26 +0000 (09:06 +0000)
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

NetworkPkg/HttpDxe/HttpDriver.h
NetworkPkg/HttpDxe/HttpDxe.inf
NetworkPkg/HttpDxe/HttpImpl.c
NetworkPkg/HttpDxe/HttpProto.c

index d95b05b634928f4f92a59909c99186167f4e6ce5..eea8d5169e71a20384e050834b26ada07b3438ed 100644 (file)
@@ -28,7 +28,7 @@
 #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
index e8117006d6e7e014edb1e005b2821deea6bfa5ca..0d3bd00cf7b7d0579af08aeeca2cd75a949773c9 100644 (file)
@@ -48,6 +48,7 @@
   DebugLib\r
   NetLib\r
   HttpLib\r
   DebugLib\r
   NetLib\r
   HttpLib\r
+  DpcLib\r
 \r
 [Protocols]\r
   gEfiHttpServiceBindingProtocolGuid               ## BY_START\r
 \r
 [Protocols]\r
   gEfiHttpServiceBindingProtocolGuid               ## BY_START\r
index c5b2be430e29261f7e6eab37585347af95d3e673..2b62dc5db299f1ce1fe48b9ed43be5ccf67a31d8 100644 (file)
@@ -502,6 +502,8 @@ EfiHttpRequest (
     goto Error5;    \r
   }\r
 \r
     goto Error5;    \r
   }\r
 \r
+  DispatchDpc ();\r
+\r
   return EFI_SUCCESS;\r
 \r
 Error5:\r
   return EFI_SUCCESS;\r
 \r
 Error5:\r
@@ -1330,6 +1332,7 @@ EfiHttpPoll (
   )\r
 {\r
   HTTP_PROTOCOL                 *HttpInstance;\r
   )\r
 {\r
   HTTP_PROTOCOL                 *HttpInstance;\r
+  EFI_STATUS                    Status;\r
 \r
   if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
 \r
   if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -1346,5 +1349,9 @@ EfiHttpPoll (
     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
 }\r
index 9b06e24bed0ecd4b814dec481c2dc621ded44b6c..8fbd45411064df8c787efd3de2182aca44b00764 100644 (file)
@@ -38,20 +38,18 @@ HttpCommonNotify (
 /**\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
     return ;\r
   }\r
 \r
     return ;\r
   }\r
 \r
@@ -79,17 +77,36 @@ HttpTcpTransmitNotify (
 \r
 }\r
 \r
 \r
 }\r
 \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
@@ -99,7 +116,7 @@ HttpTcpReceiveNotify (
   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
     return ;\r
   }\r
 \r
     return ;\r
   }\r
 \r
@@ -173,6 +190,27 @@ HttpTcpReceiveNotify (
   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