which method to use METHOD_NEITHER /METHOD_OUT_DIRECT ?

Hi

I have an application communicating with my driver. Actually, the
application fires IOCTL (currently method buffered) to driver with output
buffer of *size 20 K*. But. this adds overhead by copying memory as the
buffer size is large. I am confused whether I should change the method to
METHOD_NEITHER /METHOD_OUT_DIRECT. What should be the exact buffer size to
use METHOD_OUT_DIRECT and METHOD_NEITHER ?

Regards
James

If you transfer large amounts of data, then METHOD_OUT_DIRECT gives you a performance improvement over METHOD_BUFFERED. Please note that 20K is just 5 pages, so that, in your particular case, a buffer in itself is not that large. Use of METHOD_NEITHER is, in most cases, unjustified (please note that you have to validate every UM address that you access when using METHOD_NEITHER, so that it puts quite a lot of responsibility on a programmer) . The only situation when you may need it that gets into my head is when you pass a linked list to your driver, and do it frequently. In such case you may, indeed, want to do everything in a single IOCTL. …

Anton Bassov

Can you tell me the maximum buffer sizes we can use for METHOD_BUFFERED,
METHOD_OUT_DIRECT and METHOD_NEITHER ?

On Feb 18, 2008 4:26 PM, wrote:

> If you transfer large amounts of data, then METHOD_OUT_DIRECT gives you a
> performance improvement over METHOD_BUFFERED. Please note that 20K is just 5
> pages, so that, in your particular case, a buffer in itself is not that
> large. Use of METHOD_NEITHER is, in most cases, unjustified (please note
> that you have to validate every UM address that you access when using
> METHOD_NEITHER, so that it puts quite a lot of responsibility on a
> programmer) . The only situation when you may need it that gets into my head
> is when you pass a linked list to your driver, and do it frequently. In such
> case you may, indeed, want to do everything in a single IOCTL. …
>
> Anton Bassov
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

I am not aware of an actual weel defined limit on METHOD_BUFFERED. The MDL
(Direct) methods restrict the buffer size to slightly less than 64MB. There
is no well defined limit for METHOD_NEITHER .

Your size (20k) does not in itself demand moving away from METHOD_BUFFERED
simply for the copy overhead.
On Feb 18, 2008 6:34 AM, James Thompson wrote:

> Can you tell me the maximum buffer sizes we can use for METHOD_BUFFERED,
> METHOD_OUT_DIRECT and METHOD_NEITHER ?
>
>
> On Feb 18, 2008 4:26 PM, wrote:
>
> > If you transfer large amounts of data, then METHOD_OUT_DIRECT gives you
> > a performance improvement over METHOD_BUFFERED. Please note that 20K is just
> > 5 pages, so that, in your particular case, a buffer in itself is not that
> > large. Use of METHOD_NEITHER is, in most cases, unjustified (please note
> > that you have to validate every UM address that you access when using
> > METHOD_NEITHER, so that it puts quite a lot of responsibility on a
> > programmer) . The only situation when you may need it that gets into my head
> > is when you pass a linked list to your driver, and do it frequently. In such
> > case you may, indeed, want to do everything in a single IOCTL. …
> >
> > Anton Bassov
> >
> > —
> > NTDEV is sponsored by OSR
> >
> > For our schedule of WDF, WDM, debugging and other seminars visit:
> > http://www.osr.com/seminars
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
>
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer


Mark Roddy

Thanks Mark and Anton