]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/SnpDxe/Snp.c
MdeModulePkg: update SNP.GetStatus to handle multiple recycled TX buffer.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / Snp.c
index db5b6267a613111bae3407cfc95c20a1e20b7699..5ff294f8b59b47d503edbc49e3f819c6c605eeb2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of driver entry point and driver binding protocol.\r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed\r
 and made available under the terms and conditions of the BSD License which\r
 accompanies this distribution. The full text of the license may be found at\r
@@ -403,6 +403,14 @@ SimpleNetworkDriverStart (
 \r
   Snp->TxRxBufferSize     = 0;\r
   Snp->TxRxBuffer         = NULL;\r
+\r
+  Snp->RecycledTxBuf = AllocatePool (sizeof (UINT64) * SNP_TX_BUFFER_INCREASEMENT);\r
+  if (Snp->RecycledTxBuf == NULL) {\r
+    Status = EFI_OUT_OF_RESOURCES;\r
+    goto Error_DeleteSNP;\r
+  }\r
+  Snp->MaxRecycledTxBuf    = SNP_TX_BUFFER_INCREASEMENT;\r
+  Snp->RecycledTxBufCount  = 0;\r
  \r
   if (Nii->Revision >= EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION) {\r
     Snp->IfNum = Nii->IfNum;\r
@@ -678,6 +686,10 @@ SimpleNetworkDriverStart (
 \r
 Error_DeleteSNP:\r
 \r
+  if (Snp->RecycledTxBuf != NULL) {\r
+    FreePool (Snp->RecycledTxBuf);\r
+  }\r
+\r
   PciIo->FreeBuffer (\r
            PciIo,\r
            SNP_MEM_PAGES (sizeof (SNP_DRIVER)),\r
@@ -790,6 +802,8 @@ SimpleNetworkDriverStop (
   PxeShutdown (Snp);\r
   PxeStop (Snp);\r
 \r
+  FreePool (Snp->RecycledTxBuf);\r
+\r
   PciIo = Snp->PciIo;\r
   PciIo->FreeBuffer (\r
            PciIo,\r