Revision: 18461
          http://sourceforge.net/p/edk2/code/18461
Author:   hwu1225
Date:     2015-09-15 05:40:12 +0000 (Tue, 15 Sep 2015)
Log Message:
-----------
NetworkPkg: Update Http driver to use DPC mechanism.

This patch updates the HttpDxe driver to use the DPC mechanism to avoid long
time delay when single event.

(Sync patch r18451 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <[email protected]>
Reviewed-by: Ye Ting <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/18451

Modified Paths:
--------------
    branches/UDK2015/NetworkPkg/HttpDxe/HttpDriver.h
    branches/UDK2015/NetworkPkg/HttpDxe/HttpDxe.inf
    branches/UDK2015/NetworkPkg/HttpDxe/HttpImpl.c
    branches/UDK2015/NetworkPkg/HttpDxe/HttpProto.c

Modified: branches/UDK2015/NetworkPkg/HttpDxe/HttpDriver.h
===================================================================
--- branches/UDK2015/NetworkPkg/HttpDxe/HttpDriver.h    2015-09-15 05:39:48 UTC 
(rev 18460)
+++ branches/UDK2015/NetworkPkg/HttpDxe/HttpDriver.h    2015-09-15 05:40:12 UTC 
(rev 18461)
@@ -28,7 +28,7 @@
 #include <Library/DebugLib.h>
 #include <Library/NetLib.h>
 #include <Library/HttpLib.h>
-#include <Library/TcpIoLib.h>
+#include <Library/DpcLib.h>
 
 //
 // UEFI Driver Model Protocols

Modified: branches/UDK2015/NetworkPkg/HttpDxe/HttpDxe.inf
===================================================================
--- branches/UDK2015/NetworkPkg/HttpDxe/HttpDxe.inf     2015-09-15 05:39:48 UTC 
(rev 18460)
+++ branches/UDK2015/NetworkPkg/HttpDxe/HttpDxe.inf     2015-09-15 05:40:12 UTC 
(rev 18461)
@@ -48,6 +48,7 @@
   DebugLib
   NetLib
   HttpLib
+  DpcLib
 
 [Protocols]
   gEfiHttpServiceBindingProtocolGuid               ## BY_START

Modified: branches/UDK2015/NetworkPkg/HttpDxe/HttpImpl.c
===================================================================
--- branches/UDK2015/NetworkPkg/HttpDxe/HttpImpl.c      2015-09-15 05:39:48 UTC 
(rev 18460)
+++ branches/UDK2015/NetworkPkg/HttpDxe/HttpImpl.c      2015-09-15 05:40:12 UTC 
(rev 18461)
@@ -502,6 +502,8 @@
     goto Error5;    
   }
 
+  DispatchDpc ();
+
   return EFI_SUCCESS;
 
 Error5:
@@ -1330,6 +1332,7 @@
   )
 {
   HTTP_PROTOCOL                 *HttpInstance;
+  EFI_STATUS                    Status;
 
   if (This == NULL) {
     return EFI_INVALID_PARAMETER;
@@ -1346,5 +1349,9 @@
     return EFI_NOT_STARTED;
   }
 
-  return HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
+  Status = HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
+
+  DispatchDpc ();
+
+  return Status;
 }

Modified: branches/UDK2015/NetworkPkg/HttpDxe/HttpProto.c
===================================================================
--- branches/UDK2015/NetworkPkg/HttpDxe/HttpProto.c     2015-09-15 05:39:48 UTC 
(rev 18460)
+++ branches/UDK2015/NetworkPkg/HttpDxe/HttpProto.c     2015-09-15 05:40:12 UTC 
(rev 18461)
@@ -38,20 +38,18 @@
 /**
   The notify function associated with TxToken for Tcp4->Transmit().
 
-  @param[in]  Event   The event signaled.
   @param[in]  Context The context.
 
 **/
 VOID
 EFIAPI
-HttpTcpTransmitNotify (
-  IN EFI_EVENT  Event,
+HttpTcpTransmitNotifyDpc (
   IN VOID       *Context
   )
 {
   HTTP_TOKEN_WRAP          *Wrap;
 
-  if ((Event == NULL) || (Context == NULL)) {
+  if (Context == NULL) {
     return ;
   }
 
@@ -80,16 +78,35 @@
 }
 
 /**
+  Request HttpTcpTransmitNotifyDpc as a DPC at TPL_CALLBACK.
+
+  @param  Event                 The receive event delivered to TCP for 
transmit.
+  @param  Context               Context for the callback.
+
+**/
+VOID
+EFIAPI
+HttpTcpTransmitNotify (
+  IN EFI_EVENT                Event,
+  IN VOID                     *Context
+  )
+{
+  //
+  // Request HttpTcpTransmitNotifyDpc as a DPC at TPL_CALLBACK
+  //
+  QueueDpc (TPL_CALLBACK, HttpTcpTransmitNotifyDpc, Context);
+}
+
+
+/**
   The notify function associated with RxToken for Tcp4->Receive ().
 
-  @param[in]  Event   The event signaled.
   @param[in]  Context The context.
 
 **/
 VOID
 EFIAPI
-HttpTcpReceiveNotify (
-  IN EFI_EVENT  Event,
+HttpTcpReceiveNotifyDpc (
   IN VOID       *Context
   )
 {
@@ -99,7 +116,7 @@
   EFI_STATUS               Status;
   HTTP_PROTOCOL            *HttpInstance;
 
-  if ((Event == NULL) || (Context == NULL)) {
+  if (Context == NULL) {
     return ;
   }
 
@@ -174,6 +191,27 @@
 }
 
 /**
+  Request HttpTcpReceiveNotifyDpc as a DPC at TPL_CALLBACK.
+
+  @param  Event                 The receive event delivered to TCP for receive.
+  @param  Context               Context for the callback.
+
+**/
+VOID
+EFIAPI
+HttpTcpReceiveNotify (
+  IN EFI_EVENT                Event,
+  IN VOID                     *Context
+  )
+{
+  //
+  // Request HttpTcpTransmitNotifyDpc as a DPC at TPL_CALLBACK
+  //
+  QueueDpc (TPL_CALLBACK, HttpTcpReceiveNotifyDpc, Context);
+}
+
+
+/**
   Create events for the TCP4 connection token and TCP4 close token.
 
   @param[in]  HttpInstance       Pointer to HTTP_PROTOCOL structure.


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to