If you have multiple pending read/ioctl irps, there is a single copy, from the NIC to the IRP and your are done (assuming there is a pending irp when data arrives, otherwise there are 2 copies, but this is heavily tunable). No more synchronization needed.
If you have a shared event, you have a morec compicated life b/c you must also synchronize the current head ptr into the ring buffer against the data size in the buffer which means another event (which also means you can’t acquire it at dispatch level in the driver when you get data, which means queueing a work item). Also, if you are sharing memory, you now need to manage that mapping when the app exits unexpectedly (otherwise you bugcheck).
In the end, the pure pending irp model is simpler and faster b/c there are fewer (as in none) sync objects being contended for between UM and KM.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Anton A. Kolomyeytsev (RDS)
Sent: Saturday, January 07, 2006 10:46 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Communication between user-mode and kernel-mode
I think you’d like to copy all of the filled buffers from kernel -> user.
Having more then one “shared” buffer protected
with single spin lock would allow your kernel driver keep filling the
buffers with data while user mode app would copy
filled ones to user space.
Well… I’d still recommend you to get THAT article 
Regards,
Anton Kolomyeytsev
CEO, Rocket Division Software
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Soren Dreijer
Sent: Saturday, January 07, 2006 6:24 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Communication between user-mode and kernel-mode
Thanks for the quick reply!
So when the user-mode application calls DeviceIoControl, would that transfer
all the packets in the ring buffer or just a single packet?
Sharing the event between the driver and the application shouldn’t be a
problem. There are excellent documents on the WHDC site and there’s an event
sample in the DDK.
–Soren
“Anton A. Kolomyeytsev (RDS)” wrote in message
news:xxxxx@ntdev…
Allocate a buffer inside your kernel component (better - ring of buffers
each protected with own spin lock). And signal shared between user and
kernel mode components event so your user mode app would call
DeviceIoControl to grab the data from kernel driver.
I’d recommend you to grab a copy of NT Insider (sorry, do not remember the
number). There was an article about how to share named event between user
and kernel mode.
Regards,
Anton Kolomyeytsev
CEO, Rocket Division Software
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of S?ren Dreijer
Sent: Saturday, January 07, 2006 5:54 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Communication between user-mode and kernel-mode
Hi,
I’m currently in the process of making a (virtual) network adapter which,
whenever packets are transmitted on the adapter, forward them to a user-mode
application.
I’m having a hard time deciding how to do notify the user-mode application
about the new data.
One way would be to have the application wait for a read event that gets
signalled by the driver whenever data is received.
Another way could be to let the application read the data using overlapped
I/O and then continually poll the status of the read request until it is
completed by the driver.
What would you guys suggest?
Thanks!
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@voliacable.com To
unsubscribe send a blank email to xxxxx@lists.osr.com
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@voliacable.com To
unsubscribe send a blank email to xxxxx@lists.osr.com
—
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com