Skip to content

QoS: traffic class table over DCB, counters per traffic class - #1839

Open
troglobit wants to merge 9 commits into
mainfrom
qos-fixes
Open

troglobit wants to merge 9 commits into
mainfrom
qos-fixes

Conversation

@troglobit

@troglobit troglobit commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #1611.

  • The traffic class table of a switch port moves from the tc priority map to DCB. Marvell and LAN969x take it as the IEEE ETS managed object, FlexSwitch gets it folded into dcb app. The qdiscs now only schedule.
  • On Marvell the table is written on every port, cascade ports included, which is the fix for QoS: Background traffic is prioritised above Best Effort #1611.
  • New get-statistics action under a port's qos, the frames each traffic class has sent. show interface NAME lists them.

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@troglobit
troglobit force-pushed the qos-fixes branch 3 times, most recently from 79388e6 to f183829 Compare December 4, 2026 13:58
@troglobit troglobit changed the title Misc QoS fixes QoS: traffic class table over DCB, counters per traffic class Dec 4, 2026
@troglobit
troglobit marked this pull request as ready for review December 4, 2026 14:10
@troglobit
troglobit requested a review from wkz December 5, 2026 09:40
The section listed the settings without saying what the table is for,
and the per-switch limit was only mentioned as a Marvell detail.  Define
the table up front and state the limit as the general rule for switches.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Without an entry confd sets the ports up as plain NICs, with an ets
root and the credit-based and time-aware shapers in software, so only
frames from the CPU are scheduled and shaped.

List what the pasw driver offloads: classification, the mqprio and
taprio roots, and the two shapers.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The traffic-class-table of a port is written as the map of its root
qdisc.  A switch does not have to take it from there: upstream, lan966x
and sparx5 refuse any map but one to one, and the FlexSwitch driver
ignores the map.  How a switch does take the table depends on what it
keeps for a frame, so let a quirk of the port say:

 - qos-ets-table: the switch keeps the priority and the queue of a frame
   apart, and takes the table between them as the IEEE ETS managed
   object.  Write it with

       dcb ets set dev PORT prio-tc ...

 - qos-class-at-ingress: the switch has one field for both, and picks
   the queue where a frame comes in.  Write each dcb app priority as its
   traffic class, and map the class back to the priority with dcb rewr,
   so a tagged frame leaves with its priority as PCP.  A table with two
   priorities on one class has no way back, and nothing is rewritten
   for it.

Either way the root qdisc gets one class per priority, as it only says
how the classes are served, and a change to the table no longer
replaces it.  A port with neither quirk works as before.

The FlexSwitch ports on Saline have one field, so put them on
qos-class-at-ingress.

qos-pcp-encoded now means the port always writes the PCP from the
priority, where it used to mean its PCP table is left alone.  The
operational datastore reports the rewrite from the table itself, and
reads the traffic class table of a qos-ets-table port from the ETS
object.

Issue #1611

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A frame that crosses from one switch chip to the next on a DCP-SC-28P
was queued by the priority to traffic class table on the first chip
only.  The driver programmed the table into user ports, and the next
chip takes its queue from the port between the chips.

Program the table into every port, and take it from the IEEE ETS
managed object in place of the priority map of the ets qdisc.  The
qdisc then only says how the queues are served.  Put the ports on the
quirk qos-ets-table, so the table is written with dcb ets; the driver
now refuses an ets qdisc with any other map than one band per priority,
so the kernel patch and the quirk go together.

An untagged frame from the CPU waits in the traffic class of its
priority.  A tagged one waits in the queue with the number of its PCP.

The patch is numbered after the four that the kernel branch has ahead
of this one.

Fixes #1611

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
LAN969x picks the queue of a frame on the port it leaves by, from a
table the driver wrote from the priority map of the root qdisc.  That
made the map of a qdisc the home of the priority to traffic class
table.

Take the table as the IEEE ETS managed object instead, and put the
ports on the quirk qos-ets-table, so the table is written with dcb ets
and the root qdisc, ets, mqprio or taprio, gets one class per priority.
The driver is modelled on lan966x here, where the maps of a port are
DCB objects and a qdisc only says how the queues are served.

The driver now refuses an ets qdisc with any other map, so the kernel
patch and the quirk go together.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Nothing reports how many frames each traffic class of a port has sent.
The only way to see it is to log in and read the counters of the qdisc,
which on a switch port count frames from the CPU alone, and by the band
of the kernel's qdisc where the switch has its own queues.

Add a get-statistics action under the port's qos, like the one for the
frame counters of an Ethernet port: the counters are read from the port
when asked.  Where they come from depends on the port:

 - a port the kernel serves answers from its ets qdisc, with frames,
   octets and discards per class
 - a Marvell port answers from the chip's counter of frames sent per
   queue, named by the new quirk qos-queue-counters
 - a LAN969x port counts per priority, not per queue.  It answers with
   the sum over the priorities its table puts in each class, the table
   read back from the port, so its counters follow the table the port
   runs now.  The quirk qos-priority-counters names the counters
 - any other switch port answers without counters

`show interface NAME` runs the action and lists what it returns in the
traffic class table.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Five tests each build the gate-parameter-table of a port themselves,
with their own copy of the set-gate-states identity, and several wait
for the kind of a port's root qdisc with the same expression.

Add qos.gate_table() and qos.root_kind() and use them.  The tests
configure what they did before.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Eight QoS tests read what a port runs over SSH from its root qdisc: the
traffic class table from the priority map, and in one test the counters
per class.  On a switch port neither is there any more.  The table is in
the DCB ETS object or in dcb app, the qdisc has one class per priority,
and the qdisc's counters are the kernel's own, which say nothing about
the queues of the switch.

Ask the port where its table is and read it from there, in one helper
the tests share; qos_traffic_class and qos_factory_default had their
own copies of the qdisc check.  qos_ingress_classify expects the
traffic class in dcb app on a port that keeps it there.

qos_queue_assignment reads the counters with the get-statistics action
where the port counts at its queues.  A switch that counts per priority
cannot show the queue of a frame that way, so there the test opens the
gate of one traffic class at a time and checks that only the priorities
the table puts in it get through.  The listener is a static neighbour
of the egress port for that: the DUT's own ARP has priority 0 and would
wait behind a closed gate, until the entry fails and nothing is routed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A frame must cross a bridge with its priority unchanged, whatever the
traffic class table does to its queue.  Send frames through two bridged
ports and check the PCP they leave with: for the ieee and ieee-sr
tables, for an untagged frame tagged on the way out, for a table where
priorities share a class, and for a custom pcp-map.

On a device with several switch chips the test prints whether the two
ports are on one chip or on different ones.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

QoS: Background traffic is prioritised above Best Effort

2 participants