I beg you both to stop top-posting immediately. The thread has devolved into an incomprehensible mess. Other than that, let's repeat that the context is:
https://github.com/tianocore/edk2/blob/49789216fa2571056cbc39b4b4c8ee3797bbbb71/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c#L1140 1130 case TRB_COMPLETION_SHORT_PACKET: 1131 case TRB_COMPLETION_SUCCESS: 1132 if (EvtTrb->Completecode == TRB_COMPLETION_SHORT_PACKET) { 1133 DEBUG ((EFI_D_ERROR, "XhcCheckUrbResult: short packet happens!\n")); 1134 } 1135 1136 TRBType = (UINT8) (TRBPtr->Type); 1137 if ((TRBType == TRB_TYPE_DATA_STAGE) || 1138 (TRBType == TRB_TYPE_NORMAL) || 1139 (TRBType == TRB_TYPE_ISOCH)) { 1140 CheckedUrb->Completed += (CheckedUrb->DataLen - EvtTrb->Lenth); 1141 } 1142 1143 break; and the question is whether the increment of CheckedUrb->Completed is correct: On 04/17/15 12:16, Anbazhagan, Baraneedharan wrote: > Maybe I am missing something. CheckedUrb->DataLen is input data length > and that’s used in a loop based on number of completed TRB. If there is > a more than one TRB completed in a single request, then > XhcCheckUrbResult reports multiples of CheckedUrb->DataLen as completed > data transfer length. I've recently looked at the same code (while working on <http://git.qemu.org/?p=qemu.git;a=commit;h=aa6857891d>), and I was also surprised by the increment. I think the following section applies from the XHCI spec: 4 Operational Model 4.11 TRBs 4.11.3 Event TRBs 4.11.3.1 Transfer Event TRB which says: > ... the TRB Transfer Length of the current Transfer Event should be > set to value of the TRB Transfer Length field in the original Transfer > Event ... which seems to imply that the statement should be CheckedUrb->Completed += EvtTrb->Lenth; The current formula (ie. what is in the tree right now) would be correct if EvtTrb->Lenth carried the number of bytes that were left un-transferred. There's at least one example for that in the XHCI spec too, see the "residue" language under 4.10.2.8 Isoch Endpoint Error Handling, but I don't think it applies here. Thanks Laszlo > > > > *From:* Tian, Feng [mailto:feng.t...@intel.com] > *Sent:* Thursday, April 16, 2015 10:42 PM > *To:* edk2-devel@lists.sourceforge.net > *Subject:* Re: [edk2] XHCI data transfer size > > > > XhcCheckUrbResult() will get invoked many times for single request. > XhcExecTransfer () will be only invoked once for single request. The URB > is a software data structure and will be persistent till the request is > finished. It will record how many bytes has been transferred. > > > > You can think the logic as it’s continuously polling to see if there is > new data received. > > > > Thanks > > Feng > > > > *From:* Anbazhagan, Baraneedharan [mailto:anbazha...@hp.com] > *Sent:* Friday, April 17, 2015 11:00 > *To:* edk2-devel@lists.sourceforge.net > <mailto:edk2-devel@lists.sourceforge.net> > *Subject:* Re: [edk2] XHCI data transfer size > > > > But the total data transfer size is accumulated based on input DataLen > field and if there is more than 1 transfer block(64K+ data request), > then the return size is not correct. > > > > CheckedUrb->Completed += (CheckedUrb->DataLen - EvtTrb->Lenth); > > > > *From:* Tian, Feng [mailto:feng.t...@intel.com] > *Sent:* Thursday, April 16, 2015 9:34 PM > *To:* Anbazhagan, Baraneedharan; edk2-devel@lists.sourceforge.net > <mailto:edk2-devel@lists.sourceforge.net> > *Subject:* Re: [edk2] XHCI data transfer size > > > > Hi, Baranee > > > > The intention of XhcCheckUrbResult() and XhcExecTransfer() is to > traverse all received events and accumulate these received data lengths > for a URB request to see if it matches with requested data length. > > > > The members of URB, such as ->Completed, -> Finished, -> StartDone and > -> EndDone, are used for this way. > > > > Thanks > > Feng > > > > *From:* Anbazhagan, Baraneedharan [mailto:anbazha...@hp.com] > *Sent:* Thursday, April 16, 2015 08:31 > *To:* edk2-devel@lists.sourceforge.net > <mailto:edk2-devel@lists.sourceforge.net> > *Cc:* Tian, Feng > *Subject:* XHCI data transfer size > > > > XhcCheckUrbResult calculates the data transfer size to return based on > DataLen within Urb, If the request is more than 64K and then it reports > the size as multiples of TrbNumber. > > > > Does it make sense to make use of Length field within TRB to calculate > total data transfer size? > > > > -Baranee ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel