Direct Copying To Share Memory In NDIS ProtocolReceive



I have an NDIS driver based on NDISPROT.

I am wondering if I can obviate much of the NDIS packet allocation by
copying indicated packets in ProtocolReceive directly to user-mode
+kernel-mode shared memory section. I would call
KeWaitForSingleObject in ProtocolReceive on a semaphore to wait (0
seconds) for one of, say, 64 fixed-size packet (frame) slots in the
shared section, and copy the packet directly, taking note which slots
were filled. If the wait breaks because there are no slots, then I
would simply return NDIS_STATUS_NOT_ACCEPTED. When ReadFile is called,
I would complete the IRP by receiving not the packet data, but an
array of indexes showing which slots were filled in.

I was wondering two things:

1. What is the computational cost of KeWaitForSingleObject with
timeout of 0? (relatively of course)
2. What kind of performance improvement can I expect using this
method, if any.

I was trying to come up with a way of batching receives, and this
seemed reasonable.

-Le Chaud Lapin-

.


Loading