Repository navigation
[Nexthop][fboss2-dev] Move a QoS ingress codepoint between traffic classes instead of duplicating it - #1763
Open
hillol-nexthop wants to merge 1 commit into
Open
[Nexthop][fboss2-dev] Move a QoS ingress codepoint between traffic classes instead of duplicating it#1763hillol-nexthop wants to merge 1 commit into
hillol-nexthop wants to merge 1 commit into
Conversation
…cating it `config qos policy <p> map dscp <v> traffic-class <tc>` appended the codepoint to the target class's ingress list without removing it from the class that already carried it, so the staged config mapped one DSCP to two traffic classes. The agent and SAI accept that silently and the resulting classification is SDK-defined. The same helper serves mpls-exp and dot1p, so they had the same defect. The ingress add now detaches the codepoint from any other class first, dropping an entry left with no ingress codepoints and no egress rewrite, and leaves the target class untouched, so re-issuing a mapping is a no-op while a duplicate an older CLI left behind still gets cleaned up. The detach logic is the one `delete qos policy map` already used, moved into QosPolicyUtils so add and delete cannot drift. Egress rewrites are untouched: several classes may legitimately rewrite to one codepoint.
This branch has not been deployed
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.
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runSummary
fboss2-dev config qos policy <P> map dscp <D> traffic-class <T>accepted a DSCP that another traffic class already carried and simply appended it to the new class'sfromDscpToTrafficClasslist. The staged config then mapped one DSCP to two traffic classes, the CLI reported success, and the commit was classified hitless. The agent builds itsDscpMapfrom that list without validation andSaiQosMapManagerhands both rows to SAI, so which class a packet with that DSCP actually lands in is SDK-defined. The only way to move a DSCP correctly wasdelete qos policy <P> map dscp <D>followed by the add.A DSCP (and likewise an MPLS EXP or DOT1P codepoint) classifies to exactly one traffic class, so re-mapping it must move it. The same
updateQosMapEntryhelper servesmpls-expanddot1p, so they had the identical defect.What changed
<type> <value> traffic-class <tc>) now detaches the codepoint from any other class before attaching it, drops an entry left with no ingress codepoints and no egress rewrite, and leaves the target class's own list untouched, so re-issuing a mapping is a no-op while a duplicate left behind by the old CLI still gets cleaned up. The user sees the usual success message, since the result is exactly what was asked for.eraseCodepointhelper thatdelete qos policy mapalready used. It moved intoQosPolicyUtilsaseraseQosMapCodepointwitheraseDscp/eraseExp/erasePcpwrappers, so add and delete share one definition and cannot drift.traffic-class <tc> <type> <value>) are untouched. Several classes may legitimately rewrite to the same codepoint.Not in this PR: agent-side rejection of a config that already carries a duplicated ingress codepoint (
ApplyThriftConfig). That would turn a config the agent accepts today into a reload failure on upgrade, so it should be a separate decision.Test Plan
New unit test
fboss/cli/fboss2/test/config/CmdConfigQosPolicyMapTest.cpp(11 cases): move between classes, a tc0→tc2→tc4 move sequence, re-add is a no-op, re-add heals a duplicate an older CLI left behind, moving the last codepoint drops the entry unless it has an egress rewrite, egress rewrites are not moved, mpls-exp and dot1p moves, dot1p on a policy with nopcpMaps, and add-then-delete agreeing on ownership.New integration test
ConfigQosPolicyMapTest.DscpMoveBetweenTrafficClassesmirrors the field repro end to end (seed under tc 0, commit, move to tc 2, commit, move to tc 4, commit, assert a single owner after each step and that the emptied tc 2 entry is gone). FullConfigQosPolicyMapTest.*suite run on an NH-4010-F viarun_test.py fboss2_integration:Manual repro of the original commands on the same device with the new
fboss2-dev, staged config afterdscp 9 tc 0,dscp 8 tc 0,dscp 9 tc 2,dscp 9 tc 4:clang-tidy and clang-format clean on all changed files.