Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- From: "Don Burn" <burn@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 2 Mar 2007 15:35:21 -0500
On #1 think seriously about having the prime application sending a request,
that can be pended. If the request is ever canceled your driver will know
the prime application is in trouble.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
"Le Chaud Lapin" <jaibuduvin@xxxxxxxxx> wrote in message
news:1172867110.993388.179570@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Don, thanks for tips..
1. If you create the section in the driver, you need to know when to
delete the section. Relying on the application to do this is a security
hole since the application can easily exit or be killed.
I am essentially creating from user-mode. My Prime application that
loads the driver must follows a LIFO model with the driver, so if it
ever occurs that the driver is loaded and the Prime application is
not, something is seriously wrong (restart of application). In that
case, I would not mind that the driver is holding on to the zombie
section, and writing too it. I will probably design it so that a
restart of the application will unload and reload the driver.
2. You say you want to use the section for both sends and recieves?
Why
sends, since there is no copy overhead here. Keep it simple, and just
do
the sends directly, even if they are sending packets recieved into the
section.
That's just it, the "direct" sends will 100% of the time be from
frames stored in the section. In other words, when the prime
application sends, the transmitted frames are already in the shared
section. For my application, there is never a situation where an
application has a free-floating buffer that needs to be sent to the
driver. I know there are many people who probably want to do this
(but not like NDISPROT did it), but I have no use of it for now.
3. You talk about using a semaphore to coordinate the processes. This
is
going to drag performance down to the level, that you are probably not
gaining an advantage. Consider, using interlocked operations in the
section, and minimizing the use of semaphores.
Hmm...interesting. I was using a semaphore because the user-mode
components do need to block if they attempt to acquire a frame from
the shared section and none are available because they are all being
used.
But your point gives me an idea....since I do have shared section that
is visible by all applications and drivers, I can still use the
semaphore, but preced it with use of type of spin-lock to increase
performance on lowering the semaphore to acquire frames.
-Le Chaud Lapin-
.
- References:
- Direct Copying To Share Memory In NDIS ProtocolReceive
- From: Le Chaud Lapin
- Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- From: Thomas F. Divine
- Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- From: Le Chaud Lapin
- Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- From: Thomas F. Divine
- Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- From: Le Chaud Lapin
- Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- From: Gianluca Varenni
- Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- From: Le Chaud Lapin
- Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- From: Don Burn
- Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- From: Le Chaud Lapin
- Direct Copying To Share Memory In NDIS ProtocolReceive
- Prev by Date: Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- Next by Date: Re: WDK Build Environments
- Previous by thread: Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- Next by thread: Re: Direct Copying To Share Memory In NDIS ProtocolReceive
- Index(es):
Relevant Pages
|