Implemented (copied from NdisAllocatePacketPool)
NdisAllocatePacketPoolEx.
Modified: trunk/reactos/drivers/net/ndis/ndis/buffer.c
_____
Modified: trunk/reactos/drivers/net/ndis/ndis/buffer.c
--- trunk/reactos/drivers/net/ndis/ndis/buffer.c 2005-08-11
20:13:26 UTC (rev 17302)
+++ trunk/reactos/drivers/net/ndis/ndis/buffer.c 2005-08-11
20:16:03 UTC (rev 17303)
@@ -469,6 +469,12 @@
NDIS_DbgPrint(MAX_TRACE, ("Status (0x%X) Packet (0x%X) PoolHandle
(0x%X).\n",
Status, Packet, PoolHandle));
+ if (Pool == NULL)
+ {
+ *Status = NDIS_STATUS_FAILURE;
+ return;
+ }
+
KeAcquireSpinLock(&Pool->SpinLock.SpinLock, &OldIrql);
if (Pool->FreeList) {
@@ -563,7 +569,57 @@
* NDIS 5.0
*/
{
- UNIMPLEMENTED
+ PNDIS_PACKET_POOL Pool;
+ UINT Size, Length, i;
+ PNDIS_PACKET Packet, NextPacket;
+
+ NDIS_DbgPrint(MAX_TRACE, ("Status (0x%X) PoolHandle (0x%X) "
+ "NumberOfDescriptors (%d) ProtocolReservedLength (%d).\n",
+ Status, PoolHandle, NumberOfDescriptors,
ProtocolReservedLength));
+
+ if (NumberOfDescriptors > 0xffff)
+ {
+ *Status = NDIS_STATUS_RESOURCES;
+ }
+ else
+ {
+ NumberOfDescriptors += NumberOfOverflowDescriptors;
+ if (NumberOfDescriptors > 0xffff)
+ {
+ NumberOfDescriptors = 0xffff;
+ }
+
+ Length = sizeof(NDIS_PACKET) + ProtocolReservedLength;
+ Size = sizeof(NDIS_PACKET_POOL) + Length *
NumberOfDescriptors;
+
+ Pool = ExAllocatePool(NonPagedPool, Size);
+ if (Pool)
+ {
+ KeInitializeSpinLock(&Pool->SpinLock.SpinLock);
+ Pool->PacketLength = Length;
+
+ if (NumberOfDescriptors > 0)
+ {
+ Packet = (PNDIS_PACKET)&Pool->Buffer;
+ Pool->FreeList = Packet;
+
+ NextPacket = (PNDIS_PACKET)((ULONG_PTR)Packet +
Length);
+ for (i = 1; i < NumberOfDescriptors; i++)
+ {
+ Packet->Private.Head = (PNDIS_BUFFER)NextPacket;
+ Packet = NextPacket;
+ NextPacket =
(PNDIS_PACKET)((ULONG_PTR)Packet + Length);
+ }
+ Packet->Private.Head = NULL;
+ }
+ else
+ Pool->FreeList = NULL;
+
+ *Status = NDIS_STATUS_SUCCESS;
+ *PoolHandle = (PNDIS_HANDLE)Pool;
+ } else
+ *Status = NDIS_STATUS_RESOURCES;
+ }
}
Show replies by date