RE: Question about calculate trbs in xhci

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

 



From: vichy
 
> hi all:
> for iso transactions, we use below function to calculate trbs
>        addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset);
>         td_len = urb->iso_frame_desc[i].length;
>         num_trbs = DIV_ROUND_UP(td_len + (addr & (TRB_MAX_BUFF_SIZE - 1)),
>                         TRB_MAX_BUFF_SIZE);
> 
> Could we use below method to calculate it instead?
>        addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset);
>         td_len = urb->iso_frame_desc[i].length;
> -        num_trbs = DIV_ROUND_UP(td_len + (addr & (TRB_MAX_BUFF_SIZE - 1)),
>                         TRB_MAX_BUFF_SIZE);
> +       num_trbs = DIV_ROUND_UP(td_len ,TRB_MAX_BUFF_SIZE);
> 
> Why the trb calculation for iso is related to dma address?

Because the trb buffers can't cross a 64k physical address boundary.

Whichever hardware engineer decided to save a few gates on the address
counter really made it hard work for the device driver writer.
Modern logic has no problems generating counters that would be fast
enough and wide enough. Even a constraint at 32bit boundaries would be a pain.

	David

��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





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

  Powered by Linux