MdeModulePke/Mtftp4Dxe: Correct the total received and saved block number.

The block returned from Mtftp4RemoveBlockNum is not the total received and
saved block number if it works in passive (Slave) mode.

The issue was exposed by the EMS test.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
This commit is contained in:
Jiaxin Wu
2018-10-25 15:31:10 +08:00
parent 0cd6452503
commit 9202304c18
5 changed files with 27 additions and 17 deletions

View File

@@ -158,8 +158,8 @@ Mtftp4SetLastBlockNum (
@param Head The block range list to remove from
@param Num The block number to remove
@param Completed Whether Num is the last block number
@param TotalBlock The continuous block number in all
@param Completed Whether Num is the last block number.
@param BlockCounter The continuous block counter instead of the value after roll-over.
@retval EFI_NOT_FOUND The block number isn't in the block range list
@retval EFI_SUCCESS The block number has been removed from the list
@@ -171,7 +171,7 @@ Mtftp4RemoveBlockNum (
IN LIST_ENTRY *Head,
IN UINT16 Num,
IN BOOLEAN Completed,
OUT UINT64 *TotalBlock
OUT UINT64 *BlockCounter
)
{
MTFTP4_BLOCK_RANGE *Range;
@@ -220,10 +220,10 @@ Mtftp4RemoveBlockNum (
// wrap to zero, because this is the simplest to implement. Here we choose
// this solution.
//
*TotalBlock = Num;
*BlockCounter = Num;
if (Range->Round > 0) {
*TotalBlock += Range->Bound + MultU64x32 ((UINTN) (Range->Round -1), (UINT32) (Range->Bound + 1)) + 1;
*BlockCounter += Range->Bound + MultU64x32 ((UINTN) (Range->Round -1), (UINT32) (Range->Bound + 1)) + 1;
}
if (Range->Start > Range->Bound) {