Hi all,
Is it possible to use paged memory in NDIS drivers? I found ExAllocatePool
in list of prohibited functions and ExAllocatePoolWithTag in list of
discouraged functions and both NdisAllocateMemory and
NdisAllocateMemoryWithTag allocate only nonpaged pool. Does it mean that
paged memory shouldn't be used in NDIS drivers?

Thank's for answer
Michal

Re: NDIS and memory 2 by Stephan

Stephan
Fri May 27 08:24:25 CDT 2005

On Fri, 27 May 2005 14:05:24 +0200, "Michal Filka"
<michal.filka@atlas.cz> wrote:

>Is it possible to use paged memory in NDIS drivers? I found ExAllocatePool
>in list of prohibited functions and ExAllocatePoolWithTag in list of
>discouraged functions and both NdisAllocateMemory and
>NdisAllocateMemoryWithTag allocate only nonpaged pool. Does it mean that
>paged memory shouldn't be used in NDIS drivers?

NDIS does not expose any memory allocating function that can allocate
paged memory. Simply because most functions/contexts of an NDIS
(miniport) driver usually run at IRQL >= PASSIVE_LEVEL (note the '>'),
which means the function/context can be at DISPATCH_LEVEL at least
sometimes. Thus, paged memory cannot be accessed here (page fault =>
fatal error).

I know you could force some code paths to always execute at
PASSIVE_LEVEL, e.g. via NdisScheduleWorkItem(). But OTOH, I guess
there is not much benefit from allocating paged instead of non-paged
memory compared to the risk of causing a page fault at DISPATCH_LEVEL.

If you actually need to keep/access large amounts of data (say more
than some MB) and therefore want to use paged memory, I guess you
should write a user-mode program, e.g. a service, and let the
user-mode program and the NDIS driver talk via IOCTL.

But note that WHQL won't accept any accompanying pice of software for
miniports except a co-installer (and thus the co-installer would have
to play the "user-mode program" role then).

Stephan

Re: NDIS and memory 2 by Pavel

Pavel
Fri May 27 08:21:18 CDT 2005

"Michal Filka" <michal.filka@atlas.cz> wrote in message news:uylKbSrYFHA.2860@TK2MSFTNGP10.phx.gbl...
> Hi all,
> Is it possible to use paged memory in NDIS drivers? I found ExAllocatePool
> in list of prohibited functions and ExAllocatePoolWithTag in list of
> discouraged functions and both NdisAllocateMemory and
> NdisAllocateMemoryWithTag allocate only nonpaged pool. Does it mean that
> paged memory shouldn't be used in NDIS drivers?

NDIS library has rather pragmatic approach. It does not offer
everything in the DDK - only what is sufficient for NDIS drivers.
If they don't have it - probably nobody really needs it..
Can you prove that you must have paged memory?
See also lookaside lists : NdisAllocateFromNPagedLookasideList

--PA

> Thank's for answer
> Michal
>
>