From: Freddie Witherden on
Hi all,

I've been playing around with the 1394 vdev_hybrid stack for the past
few weeks. Recently, I've been looking and the ASYNC_READ and
ASYNC_WRITE IOCTLs. However, bizarrely, I have been unable to get the
READ/WRITE request to work.

Broadly speaking, in the sample, the IOCTL handler dispatches
IOCTL_ASYNC_READ requests to the kmdf1394_AsyncRead function which
creates an MDL from the user-supplied buffer, allocates an 1394-stack
IRB, fills it out and then calls kmdf1394_SubmitIrpAsync. This
function just formats the Request (the same Request provided to the
IOCTL handler by the WDF) using
WdfIoTargetFormatRequestForInternalIoctlOthers and then calls
WdfRequestSend.

Investigation in shows that once submitted the request is failing with
STATUS_INVALID_PARAMETER (as determined from the completion routine).
In desperation I replaced the call to kmdf1394_SubmitIrpAsync to
kmdf1394_SubmitIrpSynch. It worked. No errors, no issues, and the
expected data bubbles its way up to user space. SubmitIrpSynch just
calls WdfIoTargetSendInternalIoctlOthersSynchronously.

Hence my question is: what could cause Async requests to fail but
Synch requests to succeed?

Regards, Freddie.
From: Freddie Witherden on
On Sep 30, 7:29 pm, Freddie Witherden <fred...(a)witherden.org> wrote:
> Hence my question is: what could cause Async requests to fail but
> Synch requests to succeed?

After a bit of debugging I reached the conclusion that it is the re-
appropriation of the WDFREQUEST Request (using
WdfIoTargetFormatRequestForInternalIoctlOthers) is causing the
trouble. If I create a brand new request, format it, and then submit
this request it works as expected. It appears as if the sample code
is erroneous. This also explains why the synchronous call worked (as
there is no Request parameter).

Having to create a separate internal request is something of a
nuisance, though. I'm still unsure the best way to re-use these
internal requests and match IOCTL requests up with them (as,
eventually, the original request needs to be completed). Something
like a per-device request pool, but I'm really not sure.

Regards, Freddie.
From: Langbeng on
??????

"Freddie Witherden" <freddie(a)witherden.org> skrev i nyhetsmeldingen:
492aa7fa-0579-43a1-aaef-1ea60d4e257d(a)j18g2000yqd.googlegroups.com ...
> Hi all,
>
> I've been playing around with the 1394 vdev_hybrid stack for the past
> few weeks. Recently, I've been looking and the ASYNC_READ and
> ASYNC_WRITE IOCTLs. However, bizarrely, I have been unable to get the
> READ/WRITE request to work.
>
> Broadly speaking, in the sample, the IOCTL handler dispatches
> IOCTL_ASYNC_READ requests to the kmdf1394_AsyncRead function which
> creates an MDL from the user-supplied buffer, allocates an 1394-stack
> IRB, fills it out and then calls kmdf1394_SubmitIrpAsync. This
> function just formats the Request (the same Request provided to the
> IOCTL handler by the WDF) using
> WdfIoTargetFormatRequestForInternalIoctlOthers and then calls
> WdfRequestSend.
>
> Investigation in shows that once submitted the request is failing with
> STATUS_INVALID_PARAMETER (as determined from the completion routine).
> In desperation I replaced the call to kmdf1394_SubmitIrpAsync to
> kmdf1394_SubmitIrpSynch. It worked. No errors, no issues, and the
> expected data bubbles its way up to user space. SubmitIrpSynch just
> calls WdfIoTargetSendInternalIoctlOthersSynchronously.
>
> Hence my question is: what could cause Async requests to fail but
> Synch requests to succeed?
>
> Regards, Freddie.