October 10, 20001
2 Split Transaction Budgeting Algorithm John Garney Working Group Chair: Hub Intel Corporation John Garney Working Group Chair: Hub Intel Corporation
October 10, Budgeting Algorithm Outline w Terms w General Algorithm Comments w Non-split Transactions w Budgeting Split Transactions – Core Spec Requirements – EHCI Requirements – Algorithm implementation tradeoffs w Information in: – Core Spec Chapters 5, 8 & 11 – EHCI Spec.
October 10, Budget and Schedule w Host determines when transactions run – The “Budget”: N (micro-)frames of information – Host builds description of transactions requested to run w Host Controller issues transactions – The “Schedule”: MxN (micro-)frames of transactions w Budget and schedule must match – Both are HC dependent w TT behavior must correspond – Specified by core USB spec w Mismatched budget/schedule/TT causes errors w Budgeting only applies to periodic transactions
October 10, Repeating Frame Patterns w Budget consists of a repeating pattern of frames – Likely a 2^N number of frames – Likely 64 or less frames for reasonable space useage – Example algorithm uses 8 frames w Schedule repeats budget pattern “endlessly” – Schedule can be same number of frames as budget Frame 0 Frame 1 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 Frame 2 Frame 0 Frame 7 … … … … BudgetBudget
October 10, Budgeting Algorithms w Many different algorithms possible w Any algorithm has requirements and constraints – Determined by USB core spec. and HC specification(s) w Simple budget algorithm in use for classic USB w Split transactions require new budget algorithm w This session illustrates one budget algorithm – Focus is on split transaction budget
October 10, Non-Split Budgeting w Classic and high-speed bus allocations easy – Count bytes for transaction in (micro-)frame – Well known for classic u 90% / 10% for periodic/non-periodic frame u Worst case (i.e. include bit-stuffing) u Transaction overheads well known (chap 5) – Similar for high-speed u 80% / 20% for microframe u Worst case (i.e. include bit-stuffing) u New transaction overheads (chap 5)
October 10, Transaction Overhead w Bus time requirements of a transaction includes: – Token packet (Sync + 3 bytes + EOP) u 4 bytes for split token vs. 3 for non-split token – Data packet (Sync + 3 bytes + wMaxPacketSize + EOP) u If present – Handshake packet (Sync + 1 byte + EOP) u If present – 2 Bus turnaround times – Think_time (Inter transaction gap) u HC dependent
October 10, Overheads Reference w Classic overheads (FS byte times, T+D+H): – FS_Isoch 9 – FS_Interrupt13 – LS_Interrupt19*8 w High-speed split overheads (HS byte times): – Token_Same_direction39 – Token_Change_direction29 – Data_Same_direction19 – Data_Change_direction 9 – Handshake_only 7
October 10, TTs and Split Budgeting w One or more Host Controllers per system – One High-speed budget per HS Host Controller – One classic budget per USB1.1 Host Controller w One Bus per Host Controller w One or more Hubs per bus w One or more TTs per Hub w A classic bus per TT – One split budget per TT w Split budgeter allocates HS and classic bus times
October 10, HC/TT/Device_endpoint w New configured EP allocates 2 bus times: – Classic from split_budget of “parent” TT u To determine in what microframes classic transaction can run – High-speed from HC HS budget, per microframe u For split transactions on HS bus HCHC HubHub TTTTSplitBudgetSplitBudgetHSBudgetHSBudgetTTTTSplitBudgetSplitBudget DevDev EPEPEPEP
October 10, Budget/Schedule Example w Two isoch OUT endpoints: A, B (spans uframe) w Does A/B split-start order matter? HS Schedule: HS Schedule: S S SSA O O D D Periodic Xacts TIME A A B B S S SSB1 O O D D S S SSB2 O O D D Classic Schedule: Budget:: Periodic Xacts A A B B Microframe
October 10, Budget/Schedule Example (Error) w Does A/B split-start order matter? – YES!! – TT sees classic B and HS SSB2 as errors S S SSB1 O O D D Periodic Xacts TIME A A S S SSA O O D D S S SSB2 O O D D B B Budget:: Periodic Xacts A A B B HS Schedule: HS Schedule: Classic Schedule: B B Microframe
October 10, Core Spec Requirements w Allocate bus times – HS split transactions with bit-stuffing, 80% x 7500 bytes max – Classic without bit-stuffing, 90% x 6/7 x 1500 bytes max w Only 2^N periods allowed, (new) periodic isochronous w Split Processing: – Determine start- & complete- split patterns u Fewer CSs at end of frame (chap 11 for details) – At most 16 SS per microframe w Split Ordering – CSs for all endpoints in each microframe matches SS order – SSs & CSs scheduled in budget order for microframe
October 10, EHCI Requirements w Schedule “large” isoch first in frame – Large is > 1157 x ½, i.e. 579 bytes – Not only wMaxPacketSize,… – Must include transaction overhead also w Interrupt in decreasing period order – Dictated by Qhead endpoint “tree”
October 10, Endpoint Trees w One struct per allocated endpoint w Linked into correct period frame list(s) Frame 0 Endpt Frame 1 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 Frame 2 Endpt Per = 8 Per = 4 Per = 2 Per = 1
October 10, Algorithm Tradeoffs w Minimize changes to current budget/schedule – Adding new endpoint should avoid change to others w Desirable to balance allocation in all frames – Find least allocated frame(s) for new allocation u First fully allocated frame precludes more period 1 endpoints w What order for endpoints with same period? – Choose “oldest to newest” order toward end of frame w All isochronous endpoints, then all interrupt – Other sequences are possible to implement
October 10, Split Endpoint Order in Frame w Only one large isoch allowed in any frame LargeLarge Frame 0 Per =1 Per =N Per =2 Per =1 Split Isoch. endpoints Split Interrupt endpoints … … Frame 1 Frame 2 … … … Decreasing period same period old new same period old new same period old new same period old new
October 10, Algorithm Comments w Preserve old to new order within same period – Least impact on other allocated endpoints – Most isoch. will be period = 1 – Most isoch. allocations at end of isoch. Portion of frame w Isoch. order in frame is preferred – Allows compact budget, no budget “holes” – But, EHCI dictates opposite order for interrupts
October 10, Budget Data Structure w Budget uses endpoint tree to track split isoch & interrupt Frame 0 EndptEndpt EndptEndpt EndptEndpt Frame 1 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 Frame 2 EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt Endpt Endpt EndptEndpt Isochronous Endpoints Interrupt Endpoints
October 10, Schedule Data Structure w Schedule uses interrupt Tree, but replicates isoch. TDs w HS nonsplit TDs are unordered and can be “anywhere” Frame 0 EndptEndpt EndptEndpt EndptEndpt Frame 1 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 Frame 2 EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt Endpt Endpt EndptEndpt Endpt EndptEndpt Endpt EndptEndpt EndptEndpt EndptEndpt EndptEndpt Ordered Isochronous siTDS Ordered Isochronous siTDS Ordered Interrupt Qheads/qTDs
October 10, Example Budget - 1 w A:Isoch out, wMaxPacketSize=19, Period=1 Frame 0 Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 A
October 10, Example Budget - 2 w B:Inter out, wMaxPacketSize=64, Period= 1 Frame 0 Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 A B
October 10, Example Budget - 3 w C: Inter in, wMaxPacketSize=45, Period= 4 Frame 0 Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 A B C
October 10, Example Budget - 4 w D: Inter in, wMaxPacketSize=36, Period= 2 Frame 0 Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 A B C D
October 10, Example Budget - 5 w E: Isocin, wMaxPacketSize=110, Period= 1 Frame 0 Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 A B C D E
October 10, Example Budget - 6 w F:Isoch in, wMaxPacketSize=580, Period= 8 Frame 0 Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 A B C D E F
October 10, Example Budget - 7 w G:Interin, wMaxPacketSize=32, Period= 2 Frame 0 Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 A B C D E F G
October 10, Example Budget Deallocation w Deallocate D: B & G “compacted” Frame 0 Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 A B C E F G
October 10, Calculated Budget Parameters IDMicroframeStartSplits CompleteSplits w A 21 0 w B 31 3 w C 31 3 w E 21 4 w F-11 6 w G 31 3
October 10, Example Periodic Isoch w Creates “hole” that can be reclaimed by bulk/control – Or other large periodic isoch allocations Frame 0 Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 A B C E F G
October 10, Budgeting Summary w Classic budgeting is well understood w High-speed budgeting is a derivative of classic w Split transaction budgeting is new and complex w Split budgeting must be done correctly w A split budgeting algorithm exists and works w Contact: