Re: Question about calculate trbs in xhci

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/01/2014 05:50 PM, vichy wrote:
> hi Mathias:
> 
>>
>> In xhci-ring.c,  static int xhci_queue_isoc_tx():
>>
>> /* Calculate TRB length */
>>   trb_buff_len = TRB_MAX_BUFF_SIZE - (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1));
>>
>> where  addr = start_addr + urb->iso_frame_desc[i].offset;
>>
>> this limits the trb_buff_len to stop the trb buffer at TRB_MAX_BUFF_SIZE boundary
> Yes, you are right.
> the above is make sure trb buffer will not cross over
> TRB_MAX_BUFF_SIZE boundary.
> But it still possible to cross the page boundary for ISO trb, right?
> (suppose page boundary is 4KB, TRB_MAX_BUFF_SIZE is 64KB)
> 
> appreciate your kind help,
> 

Hi

As I understood it, it is ok to cross page boundaries as long as the buffer is physically contiguous. As our dma case should be.
xhci specification section 3.2.8 says that:

"Note that no constraints are placed on the TRB Length fields in a Scatter/Gather list. Classically all the
buffers pointed to by a scatter gather list were required to be “page size” in length except for the first and
last (as illustrated by the example above). The xHCI does not require this constraint. Any buffer pointed to
by a Normal, Data Stage, or Isoch TRB in a TD may be any size between 0 and 64K bytes in size. For
instance, if when an OS translates a virtual memory buffer into a list of physical pages, some of the entries
in the list reference multiple contiguous pages, the flexible Length fields of TRBs allow a 1:1 mapping of list
entries to TRBs, i.e. a multi-page list entry does not need to be defined as multiple page sized TRBs."
"

Same section defines a scatter/gather transfer as:
"Transfers that are comprised of non-contiguous data (e.g. cross memory Page boundaries) are referred to
as Scatter/Gather Transfers."

-Mathias

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux