Changes to ehci-hcd periodic transfer code

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

 



Dave and Dan:

Having read through most of ehci-sched.c, I've got some proposals for 
improvements.  First I'd like to run them by you, to see if you don't 
like any of them or have suggestions for better approaches.


	1. Periodic bandwidth accounting is wrong.

The periodic_usecs() and periodic_tt_usecs() routines both work by 
counting the allocations for each QH, iTD, and siTD for the frame in 
question, thereby arriving at the total number microseconds in use by 
periodic transfers during the frame in question.

But "in use" != "allocated"!  An endpoint may have bandwidth allocated 
during a frame without having any transfers queued during that frame.  
For example, suppose a period-1 Iso endpoint has 10 iTDs queued.  Its 
bandwidth should still be allocated for _all_ frames, even though the 
time is in use for only 10 of them.

To solve this, I'll create an array of N*8 bytes to store the number of
us allocated for periodic transfers during each uframe for the N frames
in the periodic schedule.  This has the advantage of allowing bandwidth 
to remain allocated even when an endpoint isn't in use, should we 
decide to allow such a thing.

To do the same sort of thing for FS/LS periodic transfers, I'll 
allocate a data structure for each active TT.  It may contain a similar 
array to account for allocated bandwidth; it certainly will hold a 
list_head for all the QHs and iso_streams going through the TT.


	2. Fix unlinking of interrupt URBs.

You've got to admit, intr_deschedule() looks awfully bogus.  Unlinking 
should be done properly, using the Inactivate bit for FS/LS.  I might 
also implement unlinking for Iso URBs; that can be done later.


	3. Implement siTD back-pointers and FSTNs.

This is self-explanatory.  Strictly speaking, the current code is wrong
to schedule split transfers in uframe 4 or later, because that requires
either a back-pointer or an FSTN.  The best way to do FSTNs isn't 
obvious; all I can come up with is to allocate a separate Save FSTN for 
each frame that needs one.


	4. Rewrite the FS/LS scheduler.

In the end, this comes down to a single subroutine to calculate in
which uframes a transfer can be scheduled to start.  The computation 
isn't hard but it is a little messy.  Once it's done, all that remains 
is a strategy for choosing which uframe to use.  For instance, it might 
be better to bias Isoc transfers towards earlier uframes and Interrupt 
transfers towards later uframes.


I don't have any plans to implement rebalancing.  Getting this stuff 
done is hard enough.

Alan Stern

--
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