Microsoft KB Archive/277730

{|
 * width="100%"|

INFO: Map Register Count in NdisMAllocateMapRegisters

 * }

Q277730

-

The information in this article applies to:


 * Microsoft Windows 2000 Driver Development Kit (DDK)

-

SUMMARY
The Microsoft Windows Driver Development Kit (DDK) documentation contains discrepancies in the description of the NdisMAllocateMapRegisters parameters.

This article contains corrected information for the NdisMAllocateMapRegisters description and also describes the maximum number of map registers a driver may allocate by using this function.

MORE INFORMATION
 Function Prototype 

NDIS_STATUS NdisMAllocateMapRegisters(   IN NDIS_HANDLE  MiniportAdapterHandle,    IN UINT  DmaChannel,    IN BOOLEAN  DmaSize,    IN ULONG  PhysicalMapRegistersNeeded,    IN ULONG  MaximumPhysicalMapping    ); The PhysicalMapRegistersNeeded parameter that is passed to NdisMAllocateMapRegisters determines the number of base map registers required by the driver as opposed to the total number of map registers. Every base map register is a handle to a set of map registers that translate logical addresses to physical addresses.

The MaximumPhysicalMapping parameter is the size of the biggest buffer that the driver is requested to send (Maximum packet size). The MaximumPhysicalMapping size determines how many map registers the Network Device Interface Specification (NDIS) needs to allocate for every base map register. For example, for an Ethernet driver with a maximum packet size of 1512, the number of map registers per a base map register is 2, because 1512 bytes, in a worst case scenario, can span 2 pages of physical memory.

The total number of map registers that NDIS can allocate for a device is 64, such as:

PhysicalMapRegistersNeeded * (ROUND_TO_PAGES(Maximum Packet Size) + 1) <= 64 Therefore, the PhysicalMapRegistersNeeded parameter requested for an Ethernet device should not exceed 32 (total of 64 divided by 2 that we need for a buffer of size 1512 bytes). For a device with a maximum packet size of 64 K, the PhysicalMapRegistersNeeded translates to 3 (64/17). Such drivers should not use map registers for Direct Memory Access (DMA) transfer. For those drivers the Scatter/Gather technique is recommended instead.

For more information on how to implement Scatter/Gather DMA, refer to NdisMInitializeScatterGatherDma.

If you try to allocate more map registers on Physical Address Extension (PAE) enabled Microsoft Windows 2000 systems, especially those that have more than one network card, the system may stop responding (hang) because the system waits indefinitely for sufficient map registers to be available to satisfy a large request.