Fix a bug that mtftp4 driver reply 2 ACK in answer to incoming No.65535 block data. That issue incurs incorrect network transfer.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10619 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hhuan13 2010-07-01 09:08:33 +00:00
parent 7f97c9bb52
commit 49fd66cbf8
4 changed files with 7 additions and 3 deletions

View File

@ -169,7 +169,7 @@ Mtftp4RrqSaveBlock (
// to accept transfers of unlimited size. So TotalBlock is memorised as // to accept transfers of unlimited size. So TotalBlock is memorised as
// continuous block counter. // continuous block counter.
// //
Status = Mtftp4RemoveBlockNum (&Instance->Blocks, Block, &TotalBlock); Status = Mtftp4RemoveBlockNum (&Instance->Blocks, Block, Completed, &TotalBlock);
if (Status == EFI_NOT_FOUND) { if (Status == EFI_NOT_FOUND) {
return EFI_SUCCESS; return EFI_SUCCESS;

View File

@ -158,6 +158,7 @@ Mtftp4SetLastBlockNum (
@param Head The block range list to remove from @param Head The block range list to remove from
@param Num The block number to remove @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 TotalBlock The continuous block number in all
@retval EFI_NOT_FOUND The block number isn't in the block range list @retval EFI_NOT_FOUND The block number isn't in the block range list
@ -169,6 +170,7 @@ EFI_STATUS
Mtftp4RemoveBlockNum ( Mtftp4RemoveBlockNum (
IN LIST_ENTRY *Head, IN LIST_ENTRY *Head,
IN UINT16 Num, IN UINT16 Num,
IN BOOLEAN Completed,
OUT UINT64 *TotalBlock OUT UINT64 *TotalBlock
) )
{ {
@ -229,7 +231,7 @@ Mtftp4RemoveBlockNum (
Range->Round ++; Range->Round ++;
} }
if (Range->Start > Range->End) { if ((Range->Start > Range->End) || Completed) {
RemoveEntryList (&Range->Link); RemoveEntryList (&Range->Link);
FreePool (Range); FreePool (Range);
} }

View File

@ -92,6 +92,7 @@ Mtftp4SetLastBlockNum (
@param Head The block range list to remove from @param Head The block range list to remove from
@param Num The block number to remove @param Num The block number to remove
@param Completed Wether Num is the last block number
@param TotalBlock The continuous block number in all @param TotalBlock The continuous block number in all
@retval EFI_NOT_FOUND The block number isn't in the block range list @retval EFI_NOT_FOUND The block number isn't in the block range list
@ -103,6 +104,7 @@ EFI_STATUS
Mtftp4RemoveBlockNum ( Mtftp4RemoveBlockNum (
IN LIST_ENTRY *Head, IN LIST_ENTRY *Head,
IN UINT16 Num, IN UINT16 Num,
IN BOOLEAN Completed,
OUT UINT64 *TotalBlock OUT UINT64 *TotalBlock
); );

View File

@ -166,7 +166,7 @@ Mtftp4WrqHandleAck (
// tell the Mtftp4WrqInput to finish the transfer. This is the last // tell the Mtftp4WrqInput to finish the transfer. This is the last
// block number if the block range are empty.. // block number if the block range are empty..
// //
Mtftp4RemoveBlockNum (&Instance->Blocks, AckNum, &TotalBlock); Mtftp4RemoveBlockNum (&Instance->Blocks, AckNum, *Completed,&TotalBlock);
Expected = Mtftp4GetNextBlockNum (&Instance->Blocks); Expected = Mtftp4GetNextBlockNum (&Instance->Blocks);