Author: cgutman
Date: Sat Sep 13 11:33:23 2008
New Revision: 36190
URL:
http://svn.reactos.org/svn/reactos?rev=36190&view=rev
Log:
- Implement NdisDprAllocatePacket
Modified:
branches/aicom-network-fixes/drivers/network/ndis/ndis/buffer.c
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/buffer.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/buffer.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/buffer.c [iso-8859-1] Sat Sep
13 11:33:23 2008
@@ -694,7 +694,7 @@
/*
- * @unimplemented
+ * @implemented
*/
VOID
EXPORT
@@ -710,7 +710,37 @@
* PoolHandle = Handle returned by NdisAllocatePacketPool
*/
{
- *Status = NDIS_STATUS_FAILURE;
+ PNDIS_PACKET Temp;
+ PNDISI_PACKET_POOL Pool = (PNDISI_PACKET_POOL)PoolHandle;
+
+ NDIS_DbgPrint(MAX_TRACE, ("Status (0x%X) Packet (0x%X) PoolHandle
(0x%X).\n",
+ Status, Packet, PoolHandle));
+
+ *Packet = NULL;
+
+ if (Pool == NULL)
+ {
+ *Status = NDIS_STATUS_FAILURE;
+ return;
+ }
+
+ KeAcquireSpinLockAtDpcLevel(&Pool->SpinLock.SpinLock);
+
+ if (Pool->FreeList) {
+ Temp = Pool->FreeList;
+ Pool->FreeList = (PNDIS_PACKET)Temp->Private.Head;
+
+ KeReleaseSpinLockFromDpcLevel(&Pool->SpinLock.SpinLock);
+
+ RtlZeroMemory(&Temp->Private, sizeof(NDIS_PACKET_PRIVATE));
+ Temp->Private.Pool = Pool;
+
+ *Packet = Temp;
+ *Status = NDIS_STATUS_SUCCESS;
+ } else {
+ *Status = NDIS_STATUS_RESOURCES;
+ KeReleaseSpinLockFromDpcLevel(&Pool->SpinLock.SpinLock);
+ }
}