Modreg

Read/modify/write register

Modreg

Shortest form: m.

Change fields of a register: read it, set the named fields, write it back. Fields you do not name keep their value.

Warning

This writes the hardware behind SONiC’s back (see Setreg).

Grammar:

modreg [nocache] <REGISTER> <FIELD>=<VALUE>[,<FIELD>=<VALUE>...]

Only internal (SOC) registers can be modified; a register type is not accepted, and a plain number instead of FIELD=VALUE shows the usage. nocache writes only the hardware, not the SDK’s register cache.

Unvalidated — Stop one port’s MAC from receiving (the link stays up)

drivshell> modreg CLMAC_CTRL.ce0 RX_EN=0

Unvalidated

drivshell> modreg nocache CLMAC_CTRL.ce0 RX_EN=1

Built-in help

Parameters: [nocache] <REGISTER> <FIELD>=<VALUE>[,...]
    [nocache] if nocache is specified, just update H/W data, skip cache.
    <REGISTER> is SOC register 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 left unaffected.
    For a list of register types, use "dump".

Further reading

BCM_SDK命令, bcm cmd, 【交换芯片】硬件调测使用场景下的BMC交换常用命令说明.