kernel fifo

Is there a WDK equivalent of linux’s kfifo (http://www.gnugeneration.com/books/linux/2.6.20/kernel-api/ch07s01.html)?

FIFO’s can be implemented any number of ways using singly linked lists,
doubly linked lists, or wing it and write your own. But … forgetting
LINUX, exactly what is it that you need to do?

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 Dan Newton
Sent: Wednesday, July 07, 2010 10:22 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] kernel fifo

Is there a WDK equivalent of linux’s kfifo
(http://www.gnugeneration.com/books/linux/2.6.20/kernel-api/ch07s01.html)?


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

KQUEUE?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Dan Newton
Sent: Wednesday, July 07, 2010 8:22 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] kernel fifo

Is there a WDK equivalent of linux’s kfifo (http://www.gnugeneration.com/books/linux/2.6.20/kernel-api/ch07s01.html)?


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

Ok, so I have a usb bulk endpoint that wants to stream about 10MB/sec of data. I want to capture this to make it available to a user mode app to analyze.

I started out using a continuous reader and rolling my own ring buffer (whenever the user mode requests I just give it what is currently in the ring buffer or pend if nothing there yet), but the problem with this is I don’t reliably get all the data (especially if NumPendingReads is set to 1, which I need to do because I want the requests to complete in the right order).

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-417035-
xxxxx@lists.osr.com] On Behalf Of Gary G. Little
Sent: Thursday, July 08, 2010 3:42 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] kernel fifo

FIFO’s can be implemented any number of ways using singly linked lists,
doubly linked lists, or wing it and write your own. But … forgetting
LINUX, exactly what is it that you need to do?

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 Dan Newton
Sent: Wednesday, July 07, 2010 10:22 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] kernel fifo

Is there a WDK equivalent of linux’s kfifo
(http://www.gnugeneration.com/books/linux/2.6.20/kernel-
api/ch07s01.html)?


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

>this is I don’t reliably get all the data (especially if NumPendingReads is set to 1

Set it to > 1 and reassemble the flow.

I think KMDF contiguous reader should be OK for such a task.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Dan Newton wrote:

Ok, so I have a usb bulk endpoint that wants to stream about 10MB/sec of data. I want to capture this to make it available to a user mode app to analyze.

I started out using a continuous reader and rolling my own ring buffer (whenever the user mode requests I just give it what is currently in the ring buffer or pend if nothing there yet), but the problem with this is I don’t reliably get all the data (especially if NumPendingReads is set to 1, which I need to do because I want the requests to complete in the right order).

Your IRPs will always complete in the order that the packets were
received. As long as you do the copy in the completion handler (which
runs at raised IRQL) and have a strategy for dealing with ring buffer
overflow, just copy the data into the ring buffer and off you go.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

That sounds good but contradicts the docs (as I read them).

From http://help.outlook.com/en-us/140/ff552561(VS.85).aspx:

Set NumPendingReads to 1 if it is important that your driver receive data buffers in the exact order that the device delivers the data.

If the framework queues more than one read request, the driver might not receive the data buffers in the order that the device delivers the data.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-417126-
xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Friday, July 09, 2010 4:42 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] kernel fifo

Dan Newton wrote:
> Ok, so I have a usb bulk endpoint that wants to stream about 10MB/sec
of data. I want to capture this to make it available to a user mode app
to analyze.
>
> I started out using a continuous reader and rolling my own ring
buffer (whenever the user mode requests I just give it what is
currently in the ring buffer or pend if nothing there yet), but the
problem with this is I don’t reliably get all the data (especially if
NumPendingReads is set to 1, which I need to do because I want the
requests to complete in the right order).

Your IRPs will always complete in the order that the packets were
received. As long as you do the copy in the completion handler (which
runs at raised IRQL) and have a strategy for dealing with ring buffer
overflow, just copy the data into the ring buffer and off you go.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


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

Heh, “contiguous” if only that were so!

I don’t think there is anything identifiable in the individual packets of data that would enable reassembly reliably.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-417063-
xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Thursday, July 08, 2010 7:11 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] kernel fifo

>this is I don’t reliably get all the data (especially if
NumPendingReads is set to 1

Set it to > 1 and reassemble the flow.

I think KMDF contiguous reader should be OK for such a task.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


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

(we just had a whole, tortured, thread in which this was discussed)

The docs are speaking in general. The USB devs have given us their assurances here on the forum that the requests are completed in order.

If one-request-at-a-time is OK for your device, in terms of throughput, then what you’re doing is fine. If your throughput needs are greater, don’t hesitate to queue multiple requests.

Peter
OSR

Ah, my google-fu must have failed me.

Thanks Peter and Tim for clearing that up

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-417175-
xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
Sent: Friday, July 09, 2010 9:52 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] kernel fifo

(we just had a whole, tortured, thread in which this was discussed)

The docs are speaking in general. The USB devs have given us their
assurances here on the forum that the requests are completed in order.

If one-request-at-a-time is OK for your device, in terms of throughput,
then what you’re doing is fine. If your throughput needs are greater,
don’t hesitate to queue multiple requests.

Peter
OSR


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