Setreg

Set register

Setreg

Shortest form: s.

Write a register, either as a whole value or as a list of fields. PUTREG is a hidden synonym.

Warning

This writes the hardware behind SONiC’s back; the SDK and SAI are not told. A wrong value in a pipeline, MMU or port register can stop forwarding or hang the switch until syncd is restarted.

Grammar:

setreg [nocache] [<REGTYPE>] <REGISTER> <VALUE>
setreg [nocache] <REGISTER> <FIELD>=<VALUE>[,<FIELD>=<VALUE>...]

With fields, every field you do not name is set to zero: the register is not read first. To change one field and keep the rest, use Modreg. Several FIELD=VALUE words may be separated by spaces or commas. nocache writes only the hardware and leaves the SDK’s register cache alone; the built-in help documents it only for modreg, but setreg accepts it too. Names and value syntax: Memories and registers.

Unvalidated — Whole-value write (changes what the RDBGC0 debug counter counts)

drivshell> setreg RDBGC0_SELECT 0x0

Unvalidated — Field write on a register with one field (maximum receive frame size of one port)

drivshell> setreg CLMAC_RX_MAX_SIZE.ce0 RX_MAX_SIZE=0x3fe8

Built-in help

1. Parameters: [<REGTYPE>] <REGISTER> <VALUE>
    If <REGTYPE> is not specified, it defaults to "soc".
    <REGISTER> is offset, address, or symbolic name.
2. Parameters: <REGISTER> <FIELD>=<VALUE>[,...]
    <REGISTER> is SOC register offset or symbolic name.
    <FIELD>=<VALUE>[,...] is a list of fields to affect,
    for example: L3_ENA=0,CPU_PRI=1.
    Fields not specified in the list are set to zero.
    For a list of register types, use "help dump".

Further reading

OpenBCM sdk-6.5.27/rc: rc.soc, config.bcm, td3_sanity.soc, cmd_td3_tr514_lr.soc, tr51/tr517_bcm56870_a0.soc, bcm_diag_info.soc …, sonic-mgmt test suite files invoking bcmcmd (19 files), cPCI-6S10 Series 6U CompactPCI Switch Blade User’s Manual (50-15099-1000, Rev 1.0), bcm cli 命令, bcm cmd, bcm 使用技巧.