Tech Support > Microsoft Windows > Drivers > NDIS Miniport/Intermediate Driver Calling Each Other
NDIS Miniport/Intermediate Driver Calling Each Other
Posted by Jake on April 14th, 2007


Hi!

I've written an NDIS IM driver and a virtual miniport driver (based on the
netvmini driver). I think what I'm proposing here will work, but I wanted to
get feedback from other folks first.

I want to have the virtual miniport driver call functions within the IM
driver. Similarly, I'd like to be able to do the same thing with the IM
driver calling functions within the virtual miniport driver. What I thought
I could do is define a proprietary OID, which the IM driver can use to set
its entry points to the virtual MP driver. Similarly, the IM driver can
query the virtual MP driver's entry points through a query of another
proprietary OID. As long as these entry points aren't pageable functions,
this should be OK. Naturally, the IM driver would have to clear its entry
point table whenever the virtial MP adapter is unbound.

And, yes, I already have a proprietary OID I use in the IM driver to
determine which bound adapter is the virtual MP adapter.

Does anyone see any problems with this approach, or suggest something else?

Thanks!


Posted by Gianluca Varenni on April 14th, 2007


The main problem i see in this approach is deregistering this sort of
callbacks.

Suppose you pass a pointer of an IM function to the MP driver. The MP driver
uses the function pointer from multiple functions in different execution
contexts (DPCs? ISRs? whatever). At a certain point IM needs to be unloaded.
How does IM notify the MP that it can no longer use the IM function safely?
The only possible way on top of my head now is that there is some reference
counting mechanism and check for function pointer validity in an atomic way.

I would rather use the proprietary OIDs as stubs to invoke the functions
back and forth the two drivers (like ioctls).

Hope it helps
GV





"Jake" <ImInSoquel@nospam.nospam> wrote in message
news:ubtP1pifHHA.208@TK2MSFTNGP05.phx.gbl...


Posted by Pankaj Garg on April 14th, 2007


I think the first question here is why are you trying to do this? What are
your requirements?

Beside that, yes it is possible if your IM driver is directly bound on top
of your miniport. What happens when there is a MUX driver between your IM
driver and your miniport that changes the device topology?

Another question is how do you make sure that there is no race between
virtual miniport removal and you calling virtual miniport's functions?

--
Pankaj Garg
2007-04-13 at 11:23pm
http://www.intellectualheaven.com


On Fri, 13 Apr 2007, Jake wrote: