MdeModulePkg: update SNP.GetStatus to handle multiple recycled TX buffer.

This patch fixes a bug in SNP.GetStatus() interface. The UNDI driver may return
multiple transmitted buffers in a single GetStatus command, while SNP.GetStatus
could only return one pointer each time, the rest of them are lost. This patch
fixes this issue by store these recycled pointer in a temporary buffer in SNP
driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com> 

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19623 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Fu Siyuan
2016-01-08 02:21:25 +00:00
committed by sfu5
parent c2967d35d8
commit 7b4b93a247
3 changed files with 89 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
/** @file
Implementation of driver entry point and driver binding protocol.
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2016, 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
@@ -403,6 +403,14 @@ SimpleNetworkDriverStart (
Snp->TxRxBufferSize = 0;
Snp->TxRxBuffer = NULL;
Snp->RecycledTxBuf = AllocatePool (sizeof (UINT64) * SNP_TX_BUFFER_INCREASEMENT);
if (Snp->RecycledTxBuf == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error_DeleteSNP;
}
Snp->MaxRecycledTxBuf = SNP_TX_BUFFER_INCREASEMENT;
Snp->RecycledTxBufCount = 0;
if (Nii->Revision >= EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION) {
Snp->IfNum = Nii->IfNum;
@@ -678,6 +686,10 @@ SimpleNetworkDriverStart (
Error_DeleteSNP:
if (Snp->RecycledTxBuf != NULL) {
FreePool (Snp->RecycledTxBuf);
}
PciIo->FreeBuffer (
PciIo,
SNP_MEM_PAGES (sizeof (SNP_DRIVER)),
@@ -790,6 +802,8 @@ SimpleNetworkDriverStop (
PxeShutdown (Snp);
PxeStop (Snp);
FreePool (Snp->RecycledTxBuf);
PciIo = Snp->PciIo;
PciIo->FreeBuffer (
PciIo,