IoAllocateMdl 64MB limit?

Has anyone come across a limit to the size of an MDL that can be created
with IoAllocateMdl under Win2K? If so is there a work around?

I’ve been retained by a company that has a high speed bus mastering PCI data
capture card. One application requires the driver to setup DMA to a very
large (500MB) buffer (the machine has 1GB SDRAM) The application passes the
driver the address of the large buffer in a private ioctl. The driver calls
IoAllocateMdl to create a MDL for the user space buffer which is then locked
by MmProbeAndLock and a DMA scatter list created by MapTransfer. There’s a
small FIFO that provides ~100 uSec buffering at full speed so it’s not
feasible to break the transfer into several parts; the time taken to create
the MDL, lock it and map it would cause the FIFO to overflow.

The problem is that IoAllocateMdl fails when the buffer is >~ 63MB. I’ve
switched to using MmCreateMdl which seems to avoid the problem but this API
is deprecated in the Win2K API, furthermore a colleague has suggested that
any legal MDL must be < 64 MB due to the 16-bit field ‘Size’ in the MDL
header. He thinks that this limits the overall size of a MDL to 64Kbytes
which provides for a maximum 16K pages.

Can anyone shed any light on this?

Thanks

– Lawrence Rust
Software Systems
6 Lode Avenue, Waterbeach, Cambs. CB5 9PX, UK
Tel/Fax +44 1223 862391
www.softsystem.co.uk

IoAllocateMdl is the ONLY MDL interface that pays any attention to the size
field. I have never seen any documentation from microsoft that says: “MDLs
are limited to describing a little less than 64MB”. Certainly none of the
documentation for the MDL operations says this, I just looked. So I’d ignore
the ‘its not legal’ issue. Other people out there have done as you have done
and used MmCreateMdl to build huge mdls. I agree it is disconcerting that it
appears to be going away. You might want to check out the whistler ddk to
see just how going away it is. I suppose that if worse came to worse you
would be forced into just poofing up your own mdl with the help of
MmSizeOfMdl and use MmInitializeMdl to init the thing.

By the way, you could allocate multiple mdls to describe your buffer and
have them all mapped probe and locked BEFORE you start your transfer. This
might avoid the latency problem you mention, and is certainly no worse than
mapping down 500MB in one MDL.

Mark Roddy
Windows 2000/NT Consultant
Hollis Technology Solutions
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Lawrence Rust
Sent: Saturday, November 11, 2000 7:54 AM
To: NT Developers Interest List
Subject: [ntdev] IoAllocateMdl 64MB limit?

Has anyone come across a limit to the size of an MDL that can be created
with IoAllocateMdl under Win2K? If so is there a work around?

I’ve been retained by a company that has a high speed bus
mastering PCI data
capture card. One application requires the driver to setup DMA to a very
large (500MB) buffer (the machine has 1GB SDRAM) The application
passes the
driver the address of the large buffer in a private ioctl. The
driver calls
IoAllocateMdl to create a MDL for the user space buffer which is
then locked
by MmProbeAndLock and a DMA scatter list created by MapTransfer.
There’s a
small FIFO that provides ~100 uSec buffering at full speed so it’s not
feasible to break the transfer into several parts; the time taken
to create
the MDL, lock it and map it would cause the FIFO to overflow.

The problem is that IoAllocateMdl fails when the buffer is >~ 63MB. I’ve
switched to using MmCreateMdl which seems to avoid the problem
but this API
is deprecated in the Win2K API, furthermore a colleague has suggested that
any legal MDL must be < 64 MB due to the 16-bit field ‘Size’ in the MDL
header. He thinks that this limits the overall size of a MDL to 64Kbytes
which provides for a maximum 16K pages.

Can anyone shed any light on this?

Thanks

– Lawrence Rust
Software Systems
6 Lode Avenue, Waterbeach, Cambs. CB5 9PX, UK
Tel/Fax +44 1223 862391
www.softsystem.co.uk


You are currently subscribed to ntdev as: xxxxx@wattanuck.mv.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Thanks for the info on IoAllocateMdl. I feel a good happier now that I
know others have used MmCreateMdl to work around this. I hope M$ are aware
and don’t pull the rug out.

I’ve just signed up for the Whistler Beta DDK so I’ll soon find out if
MmCreateMdl has disappeared. Even if it has then as you say creating my
own MDL using ExAllocatePool etc isn’t too much extra effort.

– Lawrence Rust

> any legal MDL must be < 64 MB due to the 16-bit field ‘Size’ in the MDL

header. He thinks that this limits the overall size of a MDL to 64Kbytes
which provides for a maximum 16K pages.

Yes, this is true.
What kind of app is it? Maybe 64MB MDL would be enough?
Or - allocate, probe and lock several MDLs and fill them by DMA in chain,
constantly allocating new MDLs to the end of the chain.

Max