MdeModulePkg/Mtftp4Dxe: Separate the timer ticking to calculate the packet live time.
TPL deadlock issue was enrolled by the commit of39b0867d
. To resolve the issue, this patch separated the timer ticking for all the MTFTP clients to calculate the packet live time in TPL_NOTIFY level. Cc: Wang Fan <fan.wang@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> (cherry picked from commit0e2a5749d8
)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Support routines for Mtftp.
|
||||
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -568,6 +568,42 @@ Mtftp4Retransmit (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The timer ticking function in TPL_NOTIFY level for the Mtftp service instance.
|
||||
|
||||
@param Event The ticking event
|
||||
@param Context The Mtftp service instance
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
Mtftp4OnTimerTickNotifyLevel (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
MTFTP4_SERVICE *MtftpSb;
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *Next;
|
||||
MTFTP4_PROTOCOL *Instance;
|
||||
|
||||
MtftpSb = (MTFTP4_SERVICE *) Context;
|
||||
|
||||
//
|
||||
// Iterate through all the children of the Mtftp service instance. Time
|
||||
// out the current packet transmit.
|
||||
//
|
||||
NET_LIST_FOR_EACH_SAFE (Entry, Next, &MtftpSb->Children) {
|
||||
Instance = NET_LIST_USER_STRUCT (Entry, MTFTP4_PROTOCOL, Link);
|
||||
if ((Instance->PacketToLive == 0) || (--Instance->PacketToLive > 0)) {
|
||||
Instance->HasTimeout = FALSE;
|
||||
} else {
|
||||
Instance->HasTimeout = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The timer ticking function for the Mtftp service instance.
|
||||
|
||||
@ -591,29 +627,28 @@ Mtftp4OnTimerTick (
|
||||
MtftpSb = (MTFTP4_SERVICE *) Context;
|
||||
|
||||
//
|
||||
// Iterate through all the children of the Mtftp service instance. Time
|
||||
// out the packet. If maximum retries reached, clean the session up.
|
||||
// Iterate through all the children of the Mtftp service instance.
|
||||
//
|
||||
NET_LIST_FOR_EACH_SAFE (Entry, Next, &MtftpSb->Children) {
|
||||
Instance = NET_LIST_USER_STRUCT (Entry, MTFTP4_PROTOCOL, Link);
|
||||
|
||||
if ((Instance->PacketToLive == 0) || (--Instance->PacketToLive > 0)) {
|
||||
if (!Instance->HasTimeout) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Instance->HasTimeout = FALSE;
|
||||
|
||||
//
|
||||
// Call the user's time out handler
|
||||
//
|
||||
Token = Instance->Token;
|
||||
|
||||
if ((Token->TimeoutCallback != NULL) &&
|
||||
if (Token != NULL && Token->TimeoutCallback != NULL &&
|
||||
EFI_ERROR (Token->TimeoutCallback (&Instance->Mtftp4, Token))) {
|
||||
|
||||
Mtftp4SendError (
|
||||
Instance,
|
||||
EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,
|
||||
(UINT8 *) "User aborted the transfer in time out"
|
||||
);
|
||||
Instance,
|
||||
EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,
|
||||
(UINT8 *) "User aborted the transfer in time out"
|
||||
);
|
||||
|
||||
Mtftp4CleanOperation (Instance, EFI_ABORTED);
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user