PortRate

Set/Display port rate metering characteristics

PortRate

Shortest form: pr.

Show or set per-port ingress policing or egress shaping, in kilobits per second with a burst size in kilobits.

PortRate <pbmp> [ingress | egress] [<rate> <max_burst>]

With only the bitmap, both meters are shown, one line each: Ingress meter: <n> kbps <n> kbits max burst. and Egress meter: …. Any prefix of ingress/egress works (i, e). Chips without that kind of meter print ingress metering unavailable for this device (or egress). Higig ports in the bitmap produce a warning.

The built-in help also offers pause [pause_thresh resume_thresh], but this shell rejects it with unrecognized port rate type: pause.

Showing is read-only. Setting a meter changes port policing or shaping behind SONiC’s back.

On a SONiC Trident 3 switch the ingress meter is not available through this command: portrate <port> and portrate <port> ingress stop at the first port with PortRate port <name>: ERROR: bcm_port_rate_ingress_get: Feature unavailable, followed by the SAI shell’s Failed to execute the diagnostic command. Error: Operation failed.

Hardware-validated — Show both meters of ce0 (read-only)

drivshell> portrate ce0
PortRate port ce0: ERROR: bcm_port_rate_ingress_get: Feature unavailable

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

To see the egress meter, ask for it alone:

Hardware-validated — Show only the egress meter of ce0 (read-only)

drivshell> portrate ce0 egress

Unvalidated — Shape ce0 egress to 1 Gbit/s with a 512 kbit burst (changes the ASIC)

drivshell> portrate ce0 egress 1000000 512

Built-in help

Set/Display port rate metering characteristics.
Parameters: <pbm> [ingress|egress|pause [arg1 arg2]]
        For Ingress or Egress: arg1 is rate, arg2 is max_burst
        For Pause: arg1 is pause_thresh, arg2 is resume_thresh
        rate is in kilobits (1000 bits) per second
        max_burst and xxx_thresh are in kilobits (1000 bits)

Further reading

BCM_SDK命令.