Repository navigation
Add P4PifoTreeScheduler: hierarchical scheduling with a PIFO tree per port - #127
Merged
Merged
Conversation
… port
A PIFO tree (Sivaraman et al., SIGCOMM 2016) per output port, as a third
P4QueueScheduler. The attribute Tree gives the shape ("root(a(a1,a2),b)",
at most 4 levels, leaves numbered in the order of the text); the P4
program writes the packet's leaf (LeafField) and a rank per level
(RankFields, rank0 to rank3 by default). The leaves hold the packets, the
other nodes references to their children; to send, each level gives out
its smallest rank, from the root down to a leaf.
A rank given out above the leaf may be another packet's, so the switch
writes the rank that each level gave out into DequeueRankFields before
the egress; a program with a virtual time per node needs it. A full tree,
or a leaf the tree does not have, drops the arriving packet (the latter
with a warning, once). enq_qdepth and deq_qdepth count the packet's leaf.
No shaping yet.
- utils/p4-pifo-tree.h: PifoTreeShape (the text) and PifoTree<T> (one port).
- utils/p4-pifo-tree-scheduler.{h,cc}: the scheduler.
- Example p4-pifo-hpfq: hierarchical fair queueing (hpfq.p4, two levels
of STFQ with a virtual time per node) next to flat STFQ, three UDP flows
of 80 Mbps into 100 Mbps; when A1 stops, flat STFQ gives B1 two thirds,
the tree keeps half of the port for class A.
- Tests (suite p4-queue-scheduler, 6 new cases): the tree text and its
errors; PifoTree against a plain reference (order, the ranks the levels
give out, random operations on four shapes); the scheduler in a switch
(program test/p4src/pifo/tree): order, queue depths, DequeueRankFields,
full tree, missing leaf; the tree "root" sends the same frames at the
same times as P4PifoScheduler with tail drop.
- Docs: switch.md (PIFO trees, and what they model), examples.md, README,
TODO.md, test/Readme.md (also the count and the fields test of the
previous commit).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- hpfq.p4: only the flows may run at most MAX_AHEAD ahead, of their class's virtual time; that also bounds the class at the root. The bound on the class itself gave the class's places in the queue to whichever flow came first: with A1 at 120 and A2 at 60 Mbps, HPFQ gave them 32.7 and 17.3 % instead of 25 and 25. The virtual times now only move forward, and only for packets in the flow table (a packet without a flow set them back to 0). - p4-pifo-hpfq: A1, A2 and B1 send at 120, 60 and 80 Mbps (--rateA1, --rateA2, --rateB1 instead of --rate), so that the check fails if node a does not share its class fairly. The shares stay 25/25/50 and 50/50. - P4PifoTreeScheduler: a tree of one leaf reads no LeafField, so the tree root runs programs without a leaf field (test added). - Docs: a level below the packet's leaf gets 0 in DequeueRankFields; examples.md, test/Readme.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Phase 3 of the PIFO work: hierarchical scheduling with a PIFO tree per output port (Sivaraman et al., SIGCOMM 2016). One PIFO (#123) orders all packets of a port by one rank; a tree lets classes share the port by one policy and the flows inside a class share the class by another, e.g. hierarchical fair queueing. It uses the input and output fields of #126.
What changes
ns3::P4PifoTreeScheduler, a thirdP4QueueScheduler:Tree: the shape, e.g.root(a(a1,a2),b); at most 4 levels; leaves numbered in the order of the text. A tree of one leaf, such asroot, reads no leaf field.LeafField(leaf) andRankFields(rank0,rank1,rank2,rank3): the P4 program writes the packet's leaf and one rank per level from the root.DequeueRankFields(none by default): the switch writes the rank that each level gave out before the egress (0 below the packet's leaf). A rank given out above the leaf may be another packet's, so a program with a virtual time per node needs it.GetLeafDrops(), one warning).qidis the leaf;enq_qdepthanddeq_qdepthcount the packets of the leaf.utils/p4-pifo-tree.h:PifoTreeShape(the text and its errors) andPifoTree<T>(the tree of one port).Example
p4-pifo-hpfq: HPFQ (hpfq.p4, two levels of STFQ with a virtual time per node) next to flat STFQ; UDP flows A1 120, A2 60 and B1 80 Mbps into 100 Mbps (A1 and A2 differ, so class A splits evenly only if its node is fair); A1 stops at 1 s:root(a(a1,a2),b), 1:1 at each levelDocs:
switch.md(PIFO trees and what they model),examples.md, README (39 examples),TODO.md,test/Readme.md(260 cases; also the count and the fields test that Queue schedulers: input and output fields instead of one rank #126 left out).Second commit (review fixes):
hpfq.p4bounds only the flows byMAX_AHEAD, not the classes (a class bound gave A1 32.7 % and A2 17.3 %), and moves the virtual times only forward and only for packets in the flow table; the example's rates; a tree of one leaf reads no leaf field; docs.Scope
run-tests.shpasses: 24 suites, 260 cases (6 new), 47 example runs; build without warnings.PifoTreeagainst a plain reference with random operations on four shapes, up to 4 levels; the treerootsends the same frames at the same times asP4PifoSchedulerwith tail drop, and runs a program without a leaf field.p4-pifo-hpfqwith 12 seeds on each version: 25.0 / 25.0 / 50.0 %, then 49.9 to 50.1 %, the same on both versions.hpfq.p4(by the example). The two missed ones take the virtual times from the packet's own ranks instead ofDequeueRankFields; the shares do not move because all flows stay backlogged. The suite checksDequeueRankFieldsitself, andexamples.mdsays what the example does not show.Two reviews are needed before merging.
🤖 Generated with Claude Code