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.

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
This commit is contained in:
Fu Siyuan 2015-09-14 09:06:26 +00:00 committed by sfu5
parent ccb71333c2
commit 49c9f74cc1
4 changed files with 56 additions and 10 deletions

View File

@ -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

View File

@ -48,6 +48,7 @@
DebugLib
NetLib
HttpLib
DpcLib
[Protocols]
gEfiHttpServiceBindingProtocolGuid ## BY_START

View File

@ -502,6 +502,8 @@ EfiHttpRequest (
goto Error5;
}
DispatchDpc ();
return EFI_SUCCESS;
Error5:
@ -1330,6 +1332,7 @@ EfiHttpPoll (
)
{
HTTP_PROTOCOL *HttpInstance;
EFI_STATUS Status;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@ -1346,5 +1349,9 @@ EfiHttpPoll (
return EFI_NOT_STARTED;
}
return HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
Status = HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
DispatchDpc ();
return Status;
}

View File

@ -38,20 +38,18 @@ HttpCommonNotify (
/**
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 ;
}
@ -79,17 +77,36 @@ HttpTcpTransmitNotify (
}
/**
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 @@ HttpTcpReceiveNotify (
EFI_STATUS Status;
HTTP_PROTOCOL *HttpInstance;
if ((Event == NULL) || (Context == NULL)) {
if (Context == NULL) {
return ;
}
@ -173,6 +190,27 @@ HttpTcpReceiveNotify (
FreePool (Wrap);
}
/**
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.