I would modify Thomas’s ideas by converting the driver to KMDF and then not
have to provide cancel safe queues.
I’ve much the same kind of driver/service/application interface, and since
it is quite possible that the driver and app/service may be out of sync on
start, my driver on in a callout looks for the next IO request packet in a
WDF IO queue. If it does not find one, the callout is marked as blocked and
returned to NDIS. You should be able to establish the same kind of a
failsafe convention for the driver to handle data when your application is
not running.
Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Thomas F. Divine
Sent: Tuesday, August 31, 2010 11:23 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Rapid IO
Thoughts:
1.) Have application open a handle to WFP driver. Only queue packets as long
as that handle is open. Stop queuing and flush queue when handle is closed.
2.a.) Have multiple read IRPs in-flight concurrently. As read IRPs are
received driver marks them as pending and queues them. Can use a large
number of concurrent reads. Use Cancel Safe Queues to reduce IRP
queuing/cancellation problems. Idea is to have an IRP ready to complete when
packet arrives.
2.b) Instead of reading one packet at a time invent a scheme where you pass
larger buffer to driver and have it fill the larger buffer with multiple
packets. This reduces the number of read operations needed to fetch multiple
packets. May need a timer to insure partially filled buffer eventually
completes if traffic is slow.
2.c) Combination of 2.a) and 2.b)
No matter what - you will probably loose some…
Just ideas. Your mileage may vary.
Good luck,
Thomas F. Divine
http://www.pcausa.com
From:
Sent: Tuesday, August 31, 2010 12:07 PM
To: “Windows System Software Devs Interest List”
Subject: [ntdev] Rapid IO
> I have a WFP driver that queues packets and sends them to user mode
> for inspection. It mostly works. The problem I am facing is that the
> method (buffered IO) is giving me a basic problem.
>
> a) If the user mode app is not running, what should the driver do? How
> would it know the user mode app is not running. It can’t just keep on
> queuing as this would leak memory.
>
> b) The user mode app cannot register an IRP notification quickly
> enough so misses packets.
>
> Currently, the packets retry to send to user mode and then give up
> after so many tries (20 at present), so if the user mode app is too
> busy to send in the IRP notification in time, packets effectively get
> dropped as the driver has had not decision from user mode.
>
> Seeing as DeviceIOControl is all I know with regard to IO, my question
> is this.
>
> Is there a better way of doing this, like registering a user mode
> function pointer (ie a callback) with the driver?
>
> —
> 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