mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Implement NdisAllocatePacketPool by calling NdisAllocatePacketPoolEx.
svn path=/trunk/; revision=17315
This commit is contained in:
parent
6e338ed990
commit
2967654c88
1 changed files with 6 additions and 34 deletions
|
@ -514,40 +514,12 @@ NdisAllocatePacketPool(
|
||||||
* ProtocolReservedLength = Size of protocol reserved area in bytes
|
* ProtocolReservedLength = Size of protocol reserved area in bytes
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PNDIS_PACKET_POOL Pool;
|
NdisAllocatePacketPoolEx(
|
||||||
UINT Size, Length, i;
|
Status,
|
||||||
PNDIS_PACKET Packet, NextPacket;
|
PoolHandle,
|
||||||
|
NumberOfDescriptors,
|
||||||
NDIS_DbgPrint(MAX_TRACE, ("Status (0x%X) PoolHandle (0x%X) "
|
0,
|
||||||
"NumberOfDescriptors (%d) ProtocolReservedLength (%d).\n",
|
ProtocolReservedLength);
|
||||||
Status, PoolHandle, NumberOfDescriptors, ProtocolReservedLength));
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue