COS

Manage classes of service

COS

Class-of-service settings: the number of queues, the priority-to-queue map, the scheduling mode and weights, WRED (discard) and per-queue bandwidth, either for the whole switch or per port (cos port …).

Type the sub-commands in full; case does not matter. cos delay and cos port delay also work as names for bounded, although the help does not show them. Parameters (Pri=, Queue=, W0= …, PortBitMap=, KbpsMIn= …) can be shortened to their upper-case letters.

Scheduling sub-commands act immediately even without parameters: cos strict and cos simple switch the scheduling mode at once, and cos weight with no weights re-applies the current weights in weighted mode. Use cos show and cos port show to look.

show, port show, discard_show and bandwidth_show are read-only. Everything else changes queueing and scheduling that SONiC configures (SCHEDULER, WRED_PROFILE, TC_TO_QUEUE_MAP), and SONiC does not see the change. Some of these settings may not be supported on Trident 3; the shell then prints an SDK error.

Warning

cos clear resets the whole COS configuration to SDK defaults, undoing SONiC’s QoS setup.

Global

cos show

Show the global COS configuration: COS configuration:, Config (max queues): <n>, Schedule mode: <mode>, the per-queue weights under Weighting (in packets): (COSQ <q> = <w> packets), and Priority to queue mappings: with PRIO <p> ==> COSQ <q> lines for priorities 0–15. Read-only. A Bounded delay line appears only in bounded-delay mode; the WRED summary is printed by cos discard_show.

On a SONiC switch it shows 8 queues, weighted round-robin with weight 1 on every queue, priority p on queue p and priorities 8–15 on queue 7. These global values need not match SONiC’s QoS configuration, which the SAI programs per port on scheduler nodes.

Hardware-validated

drivshell> cos show
COS configuration:
  Config (max queues): 8
  Schedule mode: weighted round-robin
  Weighting (in packets):
    COSQ 0 = 1 packets
    COSQ 1 = 1 packets
    COSQ 2 = 1 packets
    COSQ 3 = 1 packets
    COSQ 4 = 1 packets
    COSQ 5 = 1 packets
    COSQ 6 = 1 packets
    COSQ 7 = 1 packets
  Priority to queue mappings:
    PRIO 0 ==> COSQ 0
    PRIO 1 ==> COSQ 1
    PRIO 2 ==> COSQ 2
    PRIO 3 ==> COSQ 3
    PRIO 4 ==> COSQ 4
    PRIO 5 ==> COSQ 5
    PRIO 6 ==> COSQ 6
    PRIO 7 ==> COSQ 7
    PRIO 8 ==> COSQ 7
    PRIO 9 ==> COSQ 7
    PRIO 10 ==> COSQ 7
    PRIO 11 ==> COSQ 7
    PRIO 12 ==> COSQ 7
    PRIO 13 ==> COSQ 7
    PRIO 14 ==> COSQ 7
    PRIO 15 ==> COSQ 7
cos clear

Reset the COS configuration to SDK defaults. See the warning above.

Unvalidated

drivshell> cos clear
cos config [Numcos=<n>]

Set the number of active COS queues. Changes the ASIC.

Unvalidated

drivshell> cos config numcos=8
cos map [PortBitMap=<pbmp>] [Pri=<0-7>] [Queue=<q>]

Map priority Pri to queue Queue. This is global, or per port for the ports in PortBitMap. Changes the ASIC.

Unvalidated

drivshell> cos map pri=5 queue=5
cos strict

Strict-priority scheduling for all queues, applied immediately. Changes the ASIC.

Unvalidated

drivshell> cos strict
cos simple

Round-robin scheduling, applied immediately. Changes the ASIC.

Unvalidated

drivshell> cos simple
cos weight [W0=<w>] [W1=<w>] … [W7=<w>]

Weighted round robin with per-queue weights. Weights not given keep their current values. W8–W11 exist when the device has more than 8 queues. Changes the ASIC.

Unvalidated

drivshell> cos weight w0=1 w1=2 w2=4 w3=8
cos fair [W0=<w>] … [W7=<w>]

Weighted fair queueing with per-queue weights. Changes the ASIC.

Unvalidated

drivshell> cos fair w0=1 w1=1
cos drr [W0=<w>] … [W7=<w>]

Deficit round robin with per-queue weights (“deficit round-robin” in cos show). Changes the ASIC.

Unvalidated

drivshell> cos drr w0=1 w1=1 w2=1 w3=1
cos bounded [W0=<w>] … [W7=<w>] [Delay=<usec>]

Bounded-delay weighted scheduling. cos delay … is an undocumented alias. Changes the ASIC.

Unvalidated

drivshell> cos bounded w0=1 w1=1 delay=100
cos discard [Enable=<bool>] [CapAvg=<bool>]

Turn WRED discard on or off globally. Changes the ASIC.

Unvalidated

drivshell> cos discard enable=false
cos discard_port [PortBitMap=<pbmp>] [Queue=<q>] [Color=<green|yellow|red>] [DropSTart=<n>] [DropSLope=<n>] [AvgTime=<n>] [Gport=<gport>]

Per-port, per-queue, per-colour WRED parameters. Changes the ASIC.

Unvalidated

drivshell> cos discard_port pbm=ce0 queue=3 color=green dropstart=80 dropslope=10 avgtime=0
cos discard_show [Gport=<gport>] [Queue=<q>]

Show the WRED configuration: the per-port start/slope/time table, or for a GPORT the per-colour Min/Max/Gain/DropProb lines. Read-only.

The first line is the global state, Discard (WRED): discard disabled, cap-average disabled on a SONiC switch. The table then has one block per port, every ce and xe port: eight rows for the port’s queues, then rows marked U for each of its scheduler queues. On a switch with 36 front-panel ports that is over 8000 lines; give Gport= and Queue= to see one queue.

Hardware-validated

drivshell> cos discard_show
  Discard (WRED): discard disabled, cap-average disabled
  Discard (WRED) port configuration:
         |   | gr     | gr | gr    | ye     | ye | ye    | re     | re | re
    port | q | strt   | sl | time  | strt   | sl | time  | strt   | sl | time
    -----+---+--------+----+-------+--------+----+-------+--------+----+-------
     ce0 | 0 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
     ce0 | 1 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
     ce0 | 2 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
     ce0 | 3 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
     ce0 | 4 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
     ce0 | 5 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
     ce0 | 6 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
     ce0 | 7 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 0 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 1 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 2 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 3 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 4 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 5 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 6 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 7 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 8 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 9 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 10 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 0 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 1 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 2 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 3 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 4 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
  U  ce0 | 5 |     51 | 90 |     8 |     51 | 90 |     8 |     51 | 90 |     8
...
cos discard_gport [Enable=<bool>] [CapAvg=<bool>] [GPort=<gport>] [Queue=<q>] [Color=<green|yellow|red>] [DropStart=<n>] [DropEnd=<n>] [DropProbability=<n>] [GAin=<n>] [Mode=<byte|packet>]

WRED parameters on a queue scheduler GPORT. Here the short forms are gp= and drops= (the help shows Gport/DropSTart). Changes the ASIC.

Unvalidated

drivshell> cos discard_gport gport=<gport> queue=0 color=green enable=true dropstart=1000 dropend=2000 dropprobability=10
cos bandwidth [PortBitMap=<pbmp>] [Queue=<q>] [KbpsMIn=<kbps>] [KbpsMAx=<kbps>] [Flags=<n>]

Set minimum/maximum bandwidth for a queue on the given ports. Changes the ASIC.

Unvalidated

drivshell> cos bandwidth pbm=ce0 queue=0 kbpsmin=0 kbpsmax=1000000
cos bandwidth_show

Show the per-port, per-queue bandwidth table under the heading COSQ bandwith configuration: (spelled so), with columns port | q | KbpsMin | KbpsMax | Flags. Read-only. Like cos discard_show it lists every queue of every port, rows marked U included, and runs to more than 17,000 lines on a 36-port switch. Queues SONiC has not shaped show 0 (no limit).

Hardware-validated

drivshell> cos bandwidth_show
  COSQ bandwith configuration:
    port | q | KbpsMin  | KbpsMax  | Flags
    -----+---+----------+----------+-------
     ce0 | 0 |        0 |        0 |      0
     ce0 | 1 |        0 |        0 |      0
     ce0 | 2 |        0 |        0 |      0
     ce0 | 3 |        0 |        0 |      0
     ce0 | 4 |        0 |        0 |      0
     ce0 | 5 |        0 |        0 |      0
     ce0 | 6 |        0 |        0 |      0
     ce0 | 7 |        0 |        0 |      0
     ce0 | 8 |        0 |        0 |      0
  U  ce0 | 0 |        0 |        0 |      0
  U  ce0 | 1 |        0 |        0 |      0
  U  ce0 | 2 |        0 |        0 |      0
  U  ce0 | 3 |        0 |        0 |      0
  U  ce0 | 4 |        0 |        0 |      0
  U  ce0 | 5 |        0 |        0 |      0
  U  ce0 | 6 |        0 |        0 |      0
  U  ce0 | 7 |        0 |        0 |      0
  U  ce0 | 8 |        0 |        0 |      0
  U  ce0 | 9 |        0 |        0 |      0
  U  ce0 | 10 |        0 |        0 |      0
  U  ce0 | 11 |        0 |        0 |      0
  U  ce0 | 12 |        0 |        0 |      0
  U  ce0 | 13 |        0 |        0 |      0
  U  ce0 | 14 |        0 |        0 |      0
  U  ce0 | 15 |        0 |        0 |      0
  U  ce0 | 0 |        0 |        0 |      0
  U  ce0 | 1 |        0 |        0 |      0
...

Per port and GPORT

cos port show [PortBitMap=<pbmp>]

Show the per-port COS configuration (Port <p> COS configuration:): schedule mode, weights and priority→queue map. It also traverses the port’s COSQ GPORTs. Read-only.

The weights include a ninth line, COSQ 8 = <w> packets (queue for output of S1 scheduler). After the priority map come repeated VLAN COSQ Schedule mode / VLAN COSQ Weighting blocks for the port’s scheduler nodes (VLAN COSQ 0 to 15), about 575 lines for one ce port.

Hardware-validated

drivshell> cos port show pbm=ce0

  Port ce0 COS configuration:
 ------------------------------
  Config (max queues): 8
  Schedule mode: weighted round-robin
  Weighting (in packets):
    COSQ 0 = 1 packets
    COSQ 1 = 1 packets
    COSQ 2 = 1 packets
    COSQ 3 = 1 packets
    COSQ 4 = 1 packets
    COSQ 5 = 1 packets
    COSQ 6 = 1 packets
    COSQ 7 = 1 packets
    COSQ 8 = 1 packets (queue for output of S1 scheduler)
  Priority to queue mappings:
    PRIO 0 ==> COSQ 0
    PRIO 1 ==> COSQ 1
    PRIO 2 ==> COSQ 2
    PRIO 3 ==> COSQ 3
    PRIO 4 ==> COSQ 4
    PRIO 5 ==> COSQ 5
    PRIO 6 ==> COSQ 6
    PRIO 7 ==> COSQ 7
    PRIO 8 ==> COSQ 7
    PRIO 9 ==> COSQ 7
    PRIO 10 ==> COSQ 7
    PRIO 11 ==> COSQ 7
    PRIO 12 ==> COSQ 7
    PRIO 13 ==> COSQ 7
...
cos port config [PortBitMap=<pbmp>] [Numcos=<n>] [Gport=<gport>]

Create a queue scheduler node (GPORT) with Numcos queues on each port and attach it. It prints Added/Attached GPORT <n> (0x…) to port <p>. This adds scheduler nodes that SONiC does not know about.

Unvalidated

drivshell> cos port config pbm=ce0 numcos=8
cos port map [PortBitMap=<pbmp>] [Pri=<0-7>] [Queue=<q>]

Per-port priority→queue mapping. Changes the ASIC.

Unvalidated

drivshell> cos port map pbm=ce0 pri=3 queue=3
cos port weight [PortBitMap=<pbmp>] [Queue=<q>] [Weight=<w>] [Gport=<gport>]

Set one queue’s weighted-round-robin weight on the given ports or GPORT. cos port fair, drr, bounded (also delay), strict and simple take the same parameters (no Weight for the last two) and select their mode. Changes the ASIC.

Unvalidated

drivshell> cos port weight pbm=ce0 queue=3 weight=10
cos port fair [PortBitMap=<pbmp>] [Queue=<q>] [Weight=<w>] [Gport=<gport>]

Weighted fair queueing for one queue. Changes the ASIC.

Unvalidated

drivshell> cos port fair pbm=ce0 queue=3 weight=10
cos port drr [PortBitMap=<pbmp>] [Queue=<q>] [Weight=<w>] [Gport=<gport>]

Deficit round robin for one queue. Changes the ASIC.

Unvalidated

drivshell> cos port drr pbm=ce0 queue=3 weight=10
cos port bounded [PortBitMap=<pbmp>] [Queue=<q>] [Weight=<w>] [Gport=<gport>]

Bounded-delay scheduling for one queue. delay is an alias. Changes the ASIC.

Unvalidated

drivshell> cos port bounded pbm=ce0 queue=3 weight=10
cos port strict [PortBitMap=<pbmp>] [Queue=<q>] [Gport=<gport>]

Strict priority for one queue. Changes the ASIC.

Unvalidated

drivshell> cos port strict pbm=ce0 queue=7
cos port simple [PortBitMap=<pbmp>] [Queue=<q>] [Gport=<gport>]

Round robin for one queue. Changes the ASIC.

Unvalidated

drivshell> cos port simple pbm=ce0 queue=0
cos port bandwidth [PortBitMap=<pbmp>] [Queue=<q>] [KbpsMIn=<kbps>] [KbpsMAx=<kbps>] [Flags=<n>] [Gport=<gport>]

Per-queue min/max bandwidth on ports or a GPORT. Changes the ASIC.

Unvalidated

drivshell> cos port bandwidth pbm=ce0 queue=0 kbpsmin=0 kbpsmax=500000

Built-in help

Usages:
    cos clear                  - Reset COS configuration to default
    cos config [Numcos=#]      - Set number of active COS queues
    cos map [Pri=#] [Queue=#]  - Map a priority 0-7 to a COS queue
    cos strict                 - Set strict queue scheduling mode
    cos simple                 - Set round robin queue scheduling mode
    cos weight [W0=#] [W1=#] ... - Set weighted queue scheduling mode
                                 with the specified weights per queue
    cos fair [W0=#] [W1=#] ... - Set weighted fair queue scheduling mode
                                 with the specified weights per queue
    cos bounded [W0=#] [W1=#] ... [Delay=<usec>]
                               - Set bounded queue scheduling with delay
    cos drr [W0=#] [W1=#] ...  - Set Deficit Round Robin scheduling mode
                                 with the specified weights per queue
    cos discard [Enable=true|false] [CapAvg=true|false]
                               - Set discard (WRED) config
    cos discard_port [PortBitMap=<pbmp>] [Queue=#] [Color=green|yellow|red]
                     [DropSTart=#] [DropSLope=#] [AvgTime=#] [Gport=<GPORT ID>]
                               - Set port discard (WRED) config
    cos discard_show [Gport=<GPORT ID>] [Queue=#]
                               - Show current discard (WRED) config
    cos discard_gport [Enable=true|false] [CapAvg=true|false]
                      [Gport=<GPORT ID>] [Queue=#] [Color=green|yellow|red]
                      [DropSTart=#] [DropEnd=#] [DropProbability=#] [GAin=#]
                      [Mode=byte|packet]
                               - Set GPORT discard (WRED) config
    cos bandwidth [PortBitMap=<pbmp>] [Queue=#] [KbpsMIn=#]
                  [KbpsMAx=#] [Flags=#]
                               - Set cos bandwidth
    cos bandwidth_show         - Show current COS bandwidth config
    cos show                   - Show current COS config

    cos port config [PortBitMap=<pbmp>] [Numcos=#] [Gport=<GPORT ID>]
                               - Add and attach a COSQ GPORT
    cos port map [PortBitMap=<pbmp>] [Pri=#] [Queue=#]
                               - Map a port's priority 0-7 to a COS queue
    cos port strict            - Set strict queue scheduling mode
    cos port simple            - Set round robin queue scheduling mode
    cos port weight [PortBitMap=<pbmp>] [Queue=#] [Weight=#] [Gport=<GPORT ID>]
                               - Set weighted queue scheduling mode
                                 with the specified weight of queue
    cos port fair [PortBitMap=<pbmp>] [Queue=#] [Weight=#] [Gport=<GPORT ID>]
                               - Set weighted fair queue scheduling mode
                                 with the specified weight of queue
    cos port bounded [PortBitMap=<pbmp>] [Queue=#] [Weight=#] [Gport=<GPORT ID>]
                               - Set bounded queue scheduling mode
                                 with the specified weight of queue
    cos port drr [PortBitMap=<pbmp>] [Queue=#] [Weight=#] [Gport=<GPORT ID>]
                               - Set Deficit Round Robin scheduling mode
                                 with the specified weight of queue
    cos port bandwidth [PortBitMap=<pbmp>] [Queue=#] [KbpsMIn=#]
                       [KbpsMAx=#] [Flags=#] [Gport=<GPORT ID>]
                               - Set port cos bandwidth
    cos port show [PortBitMap=<pbmp>]
                               - Show current port COS config

Further reading

SDK-6.5.20 HSDK Getting Started Guide (GS-SDK6520-R), plus SDK-6.5.20/21/22 Release Notes (RN-SDK65xx-R), H3C S12500-F系列交换机 Probe命令参考(R100x系列)-6W100, H3C S5830V2[S5820V2] Probe Command Reference – 01-Probe Commands, BCM_SDK命令, 交换芯片Helix4 L2 L3功能验证.