SwitchControl

General switch control

SwitchControl

Shortest form: sc.

Get or set switch controls: the SDK’s large set of global and per-port switch settings, such as which packet types are copied to the CPU, hash configuration, ECMP and LAG hash offsets, and mirroring and L3 behaviour. Usually abbreviated sc.

SwitchControl [PortBitMap=<pbmp>] [<name> | <name>=<value>]

  • <name> is a control name such as L3UcastTtl1ToCpu. Case does not matter, but the name must be complete. If no control has that name, the shell prints Unknown switch control: <name>, then Did you mean? and every control whose name contains what you typed. So sc ttl is a quick way to search the list. The search counts as a failed command, so the SAI front-end adds Failed to execute the diagnostic command. Error: Operation failed. at the end.

  • <value> can be decimal or 0x hex. Values are always printed in hex.

  • With no name, every control that the chip supports is listed, one per line, with its value. On Trident 3 that is close to 580 lines.

  • With PortBitMap=, the get or set applies to each port in the bitmap instead of the switch as a whole.

Getting values is read-only. Setting one takes effect immediately. Many controls are managed by SONiC, for example the CPU trap controls and the hash settings. SONiC does not see your change and may undo it, or behave differently from what its configuration says.

Some controls that matter on SONiC: ArpReplyToCpu, IgmpPktToCpu, DhcpPktToCpu, L3UcastTtl1ToCpu, HashControl, HashSeed0, HashField0Config, ECMPHashSet0Offset, ECMPHashOffset, L3EgressMode, MirrorUnmarked and Ip4McastL2DestCheck. Whether the chip supports a control shows in the no-argument listing. Real uses are in sonic-mgmt test suite files invoking bcmcmd (19 files), BISDN Linux docs: OF-DPA client tools, auto-negotiation, FEC, SwitchControl, known issues and 交换芯片Helix4 L2 L3功能验证 (sc arpreplytocpu on a Helix4).

Hardware-validated — List every supported global control and its value (read-only)

drivshell> sc
HgHdrErrToCpu                           0x0
ClassTagPacketsToCpu                    0x0
McastUnknownErrToCpu                    0x0
L2StaticMoveToCpu                       0x0
UnknownMcastToCpu                       0x0
UnknownUcastToCpu                       0x0
NonIpL3ErrToCpu                         0x0
L3HeaderErrToCpu                        0x0
UnknownVlanToCpu                        0x0
UnknownL3DestToCpu                      0x0
IpmcPortMissToCpu                       0x0
IpmcErrorToCpu                          0x0
SourceRouteToCpu                        0x0
SampleIngressRandomSeed                 0x1849461e
SampleEgressRandomSeed                  0x10928c3d
L2NonStaticMoveToCpu                    0x0
V6L3ErrToCpu                            0x0
V6L3DstMissToCpu                        0x0
V4L3ErrToCpu                            0x0
V4L3DstMissToCpu                        0x0
TunnelErrToCpu                          0x0
MartianAddrToCpu                        0x0
L3UcTtlErrToCpu                         0x0
L3SlowpathToCpu                         0x0
IpmcTtlErrToCpu                         0x0
DosAttackToCpu                          0x0
DosAttackSipEqualDip                    0x0
DosAttackMinTcpHdrSize                  0x14
DosAttackV4FirstFrag                    0x0
DosAttackIcmpPktOversize                0x200
...

Hardware-validated — Read one control (read-only)

drivshell> sc ECMPHashSet0Offset
0x12

Hardware-validated — Search the names: an unknown name lists every control containing it

drivshell> sc ttl1
Unknown switch control: ttl1
Did you mean?
     IpmcTtl1ToCpu
     L3UcastTtl1ToCpu
     AfrTtl1ToCpu

Failed to execute the diagnostic command. Error: Operation failed.

Unvalidated — Set a global control (changes the ASIC)

drivshell> switchcontrol l3ucastttl1tocpu=1

Built-in help

SwitchControl [PortBitMap=<pbmp>] [<name> | <name>=<value>]

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), sonic-mgmt test suite files invoking bcmcmd (19 files), BISDN Linux docs: OF-DPA client tools, auto-negotiation, FEC, SwitchControl, known issues, bcm cli 命令, bcm cmd, 交换芯片Helix4 L2 L3功能验证.