NetworkPkg/Mtftp6Dxe: Correct the total received and saved block number.

The block returned from Mtftp6RemoveBlockNum 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:16:13 +08:00
parent 9202304c18
commit 2f6693c283
5 changed files with 28 additions and 18 deletions

View File

@@ -158,8 +158,8 @@ Mtftp6SetLastBlockNum (
@param[in] Head The block range list to remove from.
@param[in] Num The block number to remove.
@param[in] Completed Whether Num is the last block number
@param[out] TotalBlock The continuous block number in all
@param[in] Completed Whether Num is the last block number.
@param[out] 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 @@ Mtftp6RemoveBlockNum (
IN LIST_ENTRY *Head,
IN UINT16 Num,
IN BOOLEAN Completed,
OUT UINT64 *TotalBlock
OUT UINT64 *BlockCounter
)
{
MTFTP6_BLOCK_RANGE *Range;
@@ -220,10 +220,10 @@ Mtftp6RemoveBlockNum (
// 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 (Range->Round - 1, (UINT32)(Range->Bound + 1)) + 1;
*BlockCounter += Range->Bound + MultU64x32 (Range->Round - 1, (UINT32)(Range->Bound + 1)) + 1;
}
if (Range->Start > Range->Bound) {