Is it Ok to issue a TDI_RECEIVE while receive events are still active? In other words, a TDI_SET_EVENT_HANDLER was issued for TDI_EVENT_RECEIVE and say events are actively coming in and being processed, BytesIndicated == BytesAvailable and all bytes taken each time. Then while this is occurring is it ok to asynchronous to that issue a TDI_RECEIVE IRP? Will the TCP transport layer and higher driver typically be coded to handle that safely? (say the higher driver then in the mean time receives an event with the last data to receive and takes it, THEN the TDI_RECEIVE is issued…and hangs waiting for more data that’s not going to arrive.)
Specifically I’m seeing that a higher driver is returning STATUS_DATA_NOT_ACCEPTED at times, however my driver has already buffered the data and I don’t want to copy it yet again later, so I return STATUS_SUCCESS and all bytes taken to IO Manager. the higher driver then issue a TDI_RECEIVE at some point. Can that get me into trouble?
Please read the DDK documentation for ClientEventReceive. It says:
" …The transport does not call ClientEvent(Chained)Receive while the client has an outstanding normal receive request or has rejected previously indicated data for a particular incoming normal receive until that receive is done. However, a transport that supports expedited data can call ClientEvent(Chained)ReceiveExpedited in the process of indicating a normal TSDU if an expedited TSDU comes in from the remote-node peer."
The doc also describes various scenarios that the higher-level client can use to receive. Basically, the client in its event handler can accept 1.) nothing, 2.) some or 3.) all of the data available. In addition, the client may behave differently at it’s own whim.
Thomas F. Divine
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-301005-
xxxxx@lists.osr.com] On Behalf Of xxxxx@swbell.net
Sent: Thursday, September 20, 2007 12:30 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is it Ok to issue a TDI_RECEIVE while receive events
are still active?
Is it Ok to issue a TDI_RECEIVE while receive events are still active?
In other words, a TDI_SET_EVENT_HANDLER was issued for
TDI_EVENT_RECEIVE and say events are actively coming in and being
processed, BytesIndicated == BytesAvailable and all bytes taken each
time. Then while this is occurring is it ok to asynchronous to that
issue a TDI_RECEIVE IRP? Will the TCP transport layer and higher driver
typically be coded to handle that safely? (say the higher driver then
in the mean time receives an event with the last data to receive and
takes it, THEN the TDI_RECEIVE is issued…and hangs waiting for more
data that’s not going to arrive.)
Specifically I’m seeing that a higher driver is returning
STATUS_DATA_NOT_ACCEPTED at times, however my driver has already
buffered the data and I don’t want to copy it yet again later, so I
return STATUS_SUCCESS and all bytes taken to IO Manager. the higher
driver then issue a TDI_RECEIVE at some point. Can that get me into
trouble?
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
Yes, I’ve read that documentation off and on quite a bit. But as the higher driver is issuing a new TDI_RECEIVE, the transport does not know this yet, so is not in the know to enforce the “” …The transport does not call ClientEvent(Chained)Receive while the client
has an outstanding normal receive request" part of the clause yet. And my driver is not in the know yet possibly either, until it has already copied the data into my internal buffer in my client event receive (so I will return STATUS_SUCCESS), passed it to higher driver which then in turn returns the STATUS_DATA_NOT_ACCEPTED. So in that situation I’m both still receiveing events AND getting TDI_RECEIVEs from above at the same time. Just wanted to make sure transport layer was ready for that. Sounds like it is.