which is the correct way to implement ‘zero length packet’ transmission on a
bulk endpoint in a KMDF USB driver when payload length is an integer
multiple of packet size ?
I suppose to:
Detect the ZLP condition in EvtIoWrite() (set flag in device
context)
In the normal write completion routine if ZLP is required allocate
an empty request by WdfRequestCreate()
Use WdfUsbTargetPipeFormatRequestForWrite() with NULL value in
WDFMEMORY parameter (it is OPTIONAL in function prototype)
Assign a dedicated specific completion routine for this request and
send the request
Complete the user request by WdfRequestCompleteWithInformation()
In the specific completion routine use WdfObjectDelete to release
the WDFREQUEST object
Any suggestion & comment will be highly appreciated,
That mostly work. If you are reusing the callers request to send all of the io previous to the zlp, you can still use the callers request for the zlp too. I wouldn’t complete the callers request until the zlp write returned back to you though
d
Bent from my phone
From: Paolo Cazzolamailto:xxxxx Sent: ?4/?30/?2013 2:21 PM To: Windows System Software Devs Interest Listmailto:xxxxx Subject: [ntdev] ZLP
Hi all, which is the correct way to implement ?zero length packet? transmission on a bulk endpoint in a KMDF USB driver when payload length is an integer multiple of packet size ? I suppose to:
1) Detect the ZLP condition in EvtIoWrite() (set flag in device context)
2) In the normal write completion routine if ZLP is required allocate an empty request by WdfRequestCreate()
3) Use WdfUsbTargetPipeFormatRequestForWrite() with NULL value in WDFMEMORY parameter (it is OPTIONAL in function prototype)
4) Assign a dedicated specific completion routine for this request and send the request
5) Complete the user request by WdfRequestCompleteWithInformation()
6) In the specific completion routine use WdfObjectDelete to release the WDFREQUEST object
Any suggestion & comment will be highly appreciated, PaoloC
As much as the host is able to detect the transaction boundaries by using short and zero length packets, th device can use a similar approach to be able to separate one transaction from another. In case the transaction is a multiple of packet size, the host driver needs to send a ZLP to tell the device the data is all sent.
I have not yet tried this, I am investigating the best way to do for an
existing driver.
PaoloC
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, April 30, 2013 11:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] ZLP
That mostly work. If you are reusing the callers request to send all of the
io previous to the zlp, you can still use the callers request for the zlp
too. I wouldn’t complete the callers request until the zlp write returned
back to you though
d
Bent from my phone
From: Paolo Cazzola mailto:xxxxx Sent: ?4/?30/?2013 2:21 PM To: Windows System Software Devs Interest List mailto:xxxxx Subject: [ntdev] ZLP
Hi all,
which is the correct way to implement ?zero length packet? transmission on a bulk endpoint in a KMDF USB driver when payload length is an integer multiple of packet size ?
I suppose to:
1) Detect the ZLP condition in EvtIoWrite() (set flag in device context)
2) In the normal write completion routine if ZLP is required allocate an empty request by WdfRequestCreate()
3) Use WdfUsbTargetPipeFormatRequestForWrite() with NULL value in WDFMEMORY parameter (it is OPTIONAL in function prototype)
4) Assign a dedicated specific completion routine for this request and send the request
5) Complete the user request by WdfRequestCompleteWithInformation()
6) In the specific completion routine use WdfObjectDelete to release the WDFREQUEST object
Any suggestion & comment will be highly appreciated,
No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3272 / Virus Database: 3162/6286 - Release Date: 04/30/13</mailto:xxxxx></mailto:xxxxx>
WdfRequestReuse doesn’t need to come into play. For ping ponging the user’s request down the stack multiple times and then competing it, you don’t need to call WdfRequestReuse
d
Bent from my phone
From: Paolo Cazzolamailto:xxxxx Sent: ?5/?1/?2013 2:34 AM To: Windows System Software Devs Interest Listmailto:xxxxx Subject: RE: [ntdev] ZLP
Thanks a lot everyone.
@Doron I see in WdfRequestReuse documentation the following comment : ?Drivers must not attempt to reuse request objects that they have received from the framework.? So I?m going allocate a dedicated WDFREQUEST for the ZLP.
@Peter I have not yet tried this, I am investigating the best way to do for an existing driver.
PaoloC
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan Sent: Tuesday, April 30, 2013 11:24 PM To: Windows System Software Devs Interest List Subject: RE: [ntdev] ZLP
That mostly work. If you are reusing the callers request to send all of the io previous to the zlp, you can still use the callers request for the zlp too. I wouldn’t complete the callers request until the zlp write returned back to you though
d
Bent from my phone From: Paolo Cazzolamailto:xxxxx Sent: ?4/?30/?2013 2:21 PM To: Windows System Software Devs Interest Listmailto:xxxxx Subject: [ntdev] ZLP Hi all, which is the correct way to implement ?zero length packet? transmission on a bulk endpoint in a KMDF USB driver when payload length is an integer multiple of packet size ? I suppose to:
1) Detect the ZLP condition in EvtIoWrite() (set flag in device context)
2) In the normal write completion routine if ZLP is required allocate an empty request by WdfRequestCreate()
3) Use WdfUsbTargetPipeFormatRequestForWrite() with NULL value in WDFMEMORY parameter (it is OPTIONAL in function prototype)
4) Assign a dedicated specific completion routine for this request and send the request
5) Complete the user request by WdfRequestCompleteWithInformation()
6) In the specific completion routine use WdfObjectDelete to release the WDFREQUEST object
Any suggestion & comment will be highly appreciated, PaoloC
I realize that. What was it in my reply that lead you to think I didn’t?
I was pretty sure you did, but I have to say I also was confused by what
you were trying to say in your reply. The original poster was asking
how to send a ZLP to signal “end of transfer” when the transfer is an
even multiple of the packet length. In that case, the fact that “zero”
happens to be an even multiple of the packet length is irrelevant. That
terminating packet is not a separate transfer. It’s a part of the
previous transfer – the one we are trying to complete.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Ah, well, cough cough… THAT would be because I misread the OPs question as “I need to send a zlp, but I must send a transfer that an integer multiple of the max packet size.” Hence my comment that zero IS an integer multiple of the max packet size.
Ah, well, cough cough… THAT would be because I misread the OPs question as
“I need to send a zlp, but I must send a transfer that an integer multiple
of the max packet size.” Hence my comment that zero IS an integer multiple
of the max packet size.
No, no, Mr. PaoloC… not your fault at all. It was my fast reading (on my iPad at that). The English in your posts was clearly better than that in my answers.
Hope we were able to help, amid the confusion my hastiness introduced.