Repository navigation
Queue schedulers: input and output fields instead of one rank - #126
Merged
Merged
Conversation
A PIFO tree needs more than one rank per packet (a leaf and a rank per level), and the egress must learn the rank that each level popped. So a P4QueueScheduler now names lists of user-metadata fields: - GetInputFields(): the switch reads them when a packet enters the queues, into P4QueueMetadata::fields (replaces GetRankFieldName() and P4QueueMetadata::rank). - GetOutputFields(): the switch writes them before the egress, with the values of P4DequeueInfo::fields that Dequeue() returns. Dequeue() now fills a P4DequeueInfo (qid, deq_qdepth, fields) instead of two out-parameters. - At most 8 of each. Each field names the attribute it came from, for the messages. A field without a name is skipped (an input then reads 0). P4CoreV1model looks them up at start and after a program swap (ResolveSchedulerFields; FindRankField becomes FindMetadataField with the attribute in its messages; GetRankField becomes GetSchedulerInputFields and GetSchedulerOutputFields). P4PifoScheduler names RankField as its one input field; strict priority names none. No behaviour changes. Test: a scheduler with three input and three output fields (one 64 bits wide, one without a name each) and program test/p4src/pifo/fields: the values reach the scheduler and the egress. 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 adds PIFO trees (hierarchical scheduling, Sivaraman et al., SIGCOMM 2016). A tree needs more from the switch than #123's interface gives: per packet a leaf and one rank per level, and before the egress the rank that each level actually popped (a reference popped at an upper level can carry another packet's rank, so per-node virtual time in the P4 program needs it). This PR generalises the interface first, without changing behaviour; the tree scheduler comes in the next PR.
What changes
P4QueueScheduler::GetInputFields(): the user-metadata fields that the switch reads when a packet enters the queues, intoP4QueueMetadata::fields. ReplacesGetRankFieldName()andP4QueueMetadata::rank.P4QueueScheduler::GetOutputFields(): fields that the switch writes before the egress, with the values thatDequeue()returns inP4DequeueInfo::fields.Dequeue(port, &packet, &info): oneP4DequeueInfo(qid, deq_qdepth, output values) instead of two out-parameters.P4CoreV1model:FindRankField→FindMetadataField(attribute in the messages),GetRankField→GetSchedulerInputFields/GetSchedulerOutputFields; fields are looked up at start and after a program swap, as before.P4PifoSchedulernamesRankFieldas its one input; strict priority names none.test/p4src/pifo/fields_v1model.p4.Scope
switch.md.doc/TODO.md(changed by Add rank examples LAS and EDF, with SP-PIFO and AIFO next to the PIFO (re-land of #124) #125, updated with the tree).run-tests.shpasses: 24 suites, 254 cases (one new), 44 example runs; build without warnings.main; only the lines with wall-clock times differ.P4DequeueInfo, no lookup after a swap, the attribute missing from the message, the PIFO's rank index,deq_qdepthof either scheduler) are all caught byp4-queue-scheduler.Two reviews are needed before merging.
🤖 Generated with Claude Code