PORT

Set/Display port characteristics

PORT

Show or set port attributes. Changes go directly to the SDK, bypassing SONiC.

The first argument is always a port bitmap (written PBMP below; see Ports and port bitmaps). Only ports that exist are used; a bitmap that selects no port does nothing. A first word that is not a port bitmap prints port: Error: unrecognized port bitmap: <word>, so port status and port fecstat are not commands.

After the bitmap, the next word selects a sub-form: detach, probe, attach, lanes, Bridge, EEE, detail or asf. These words must be typed in full (any case). Anything else is read as a list of port attributes; see PORT PBMP.

The built-in help is incomplete:

  • It does not list the detach, probe/attach, lanes, Bridge and detail sub-forms.

  • It does not list the InterFace and SpanningTreeProtocol attributes, and several value lists are longer than it shows.

  • The built-in help shows DIScard; the shell actually needs at least disc (the key is DISCard), so dis=all is rejected.

  • The built-in help shows STationADdr; the key is STationADdress, and both spellings work.

  • There is no prbs or fecstat sub-form. PRBS tests are done with phy.

Setting attributes, lanes, Bridge <n>, EEE with values and asf change the port behind SONiC’s back: orchagent and syncd do not see the change, so SONiC’s view of admin status, speed and lanes no longer matches the hardware. Disabling a port or changing its speed, lanes or autonegotiation drops the link. Showing attributes is safe.

Warning

detach and probe/attach tear down or rebuild the SDK’s port state and may leave syncd confused or crash it. Do not use them on a production switch.

Unvalidated — Enable ports (illustrative: the source gives the template ``port ${pbmp} enable=true``)

drivshell> port xe0-xe5 enable=true

Unvalidated — Change lane count and speed at runtime

drivshell> port xe60-xe63 en=0
drivshell> port xe60 lanes 4
drivshell> port xe60 speed=40000
drivshell> port xe60-xe63 en=1

In the second example, en=0 and en=1 set the Enable attribute (Enable only needs its E), lanes 4 is the PORT PBMP lanes sub-form, and speed=40000 sets SPeed. lanes cannot be combined with attributes in one command, which is why the example uses separate lines.

Port names in these examples depend on the switch’s port configuration: xe60 exists only where the configuration creates that port. On a switch with other ports the shell rejects the bitmap (unrecognized port bitmap); use ps or pbmp to see which names exist.

PORT PBMP [<Key>[=<value>] ...]

With nothing after the port bitmap, show all attributes of the selected ports. The output starts with port: Status (* indicates PHY link up) and lists the ports grouped by type.

Otherwise the words are attributes. Most attributes can be given without a value: a bare key shows just that attribute (port xe0 speed). A key with a value sets it on every selected port, leaving other attributes alone. Showing and setting cannot be mixed in one command; the shell prints port: Cannot get and set port properties in one command. An unknown word prints port: Unknown argument <word>.

Key

Bare key shows it

Values

Enable

yes

boolean

AutoNeg

yes

boolean

ADVert

yes

port mode or ability list to advertise

SPeed

yes

Mb/s; 0 means maximum speed. With autonegotiation on, this is the maximum advertised speed; with it off, the forced speed.

FullDuplex

yes

boolean

LinkScan

yes

None, SW, HW, OFF, ON (ON means SW, OFF means none)

LeaRN

yes

bit mask: bit 0 hardware learning, bit 1 copy unknown-source packets to the CPU, bit 2 forward them

DISCard

yes

None, All, Untag, Tag

VlanFilter

yes

bit 0 ingress filtering, bit 1 egress filtering

PRIOrity

yes

priority (0–7) given to untagged packets

PortFilterMode

yes

0, 1 or 2 (mode A, B, C)

PHymaster

yes

Slave, Master, Auto, None

InterFace

yes

interface type: None, Null, MII, GMII, SGMII, XFI, SFI, KR, KR4, CR, CR4, SR4, XLAUI, CAUI4 and many more. Not in the built-in help.

LoopBack

yes

NONE, MAC, PHY, RMT, MAC_RMT, EDB, NIF. The built-in help shows only the first three.

SpanningTreeProtocol

yes

Disable, Block, LIsten, LEarn, Forward. Not in the built-in help.

STationADdress

yes

MAC address used as the source of pause frames

TxPAUse, RxPAUse

yes

boolean

ENCapsulation

no

IEEE, HIGIG, B5632, HIGIG2, HIGIG2_LITE, HIGIG2_L2, HIGIG2_L3, OBSOLETE, SOP, HGOE, CPRI, RSVD4, HIGIG3

FrameMax

no

maximum received frame size in bytes

MDIX

no

Auto, ForcedAuto, ForcedNormal, ForcedXover

Medium

no

None, Copper, Fiber, Backplane, All. The built-in help shows only the first three.

Setting attributes changes the port behind SONiC’s back; showing them is safe.

Unvalidated — Show only speed and linkscan mode of two ports

drivshell> port xe0,xe1 speed linkscan

Unvalidated

drivshell> port xe0
PORT PBMP lanes <lanes>

Set the number of SerDes lanes of each selected port (a flex-port change). The value may be decimal or 0x hex. On failure it prints Unit:<u> Port:<p> :Port control lanes set failed with <rv>. Not in the built-in help.

This changes the port behind SONiC’s back and drops its link. Disable the ports first, as in the example above.

Unvalidated

drivshell> port xe60 lanes 4
PORT PBMP Bridge [<value>]

Without a value, print Unit <u> Port <name> :Port Bridge = <n> for each port. With a value, set it. When set, the port may send a packet back out of the port it arrived on (hairpin). Not in the built-in help.

Showing is safe; setting changes the port behind SONiC’s back.

Unvalidated

drivshell> port xe0 Bridge
PORT PBMP detach

Detach the selected ports from the SDK and print Detached port bitmap <bitmap>. Not in the built-in help.

Warning

Do not use on a production switch; syncd still uses these ports.

Unvalidated

drivshell> port xe5 detach
PORT PBMP probe

Probe (re-attach) the selected ports and print Probed port bitmap <bitmap>. attach does the same. Not in the built-in help.

Warning

Do not use on a production switch.

Unvalidated

drivshell> port xe5 attach
PORT PBMP detail

For each selected port, print a banner (<device> PORT = <n> INFORMATION) followed by the SDK’s detailed software and hardware information for the port. Not in the built-in help. Safe to run.

Unvalidated

drivshell> port xe0 detail
PORT PBMP EEE [ENable=<enable|disable>] [TxIDleTime=<us>] [TxWakeTime=<us>] [STats=get]

Energy Efficient Ethernet. With nothing after EEE, print an EEE Details: table: port, EEE state, transmit idle and wake times, and event counts and durations. With keys, print Port = <name>(<n>) for each port, then:

  • ENable=enable or ENable=disable turns EEE on or off;

  • TxIDleTime and TxWakeTime set the transmit idle and wake times in microseconds;

  • STats=get prints Tx events = … TX Duration = …(us) RX events = … RX Duration = …(us).

Ports without EEE support print EEE <value> is not available. Showing is safe; setting changes the port behind SONiC’s back.

Unvalidated

drivshell> port xe0 EEE
PORT PBMP asf <mode>

Set the cut-through (Alternate Store and Forward) mode of each selected port. On chips with several cut-through modes: 0 store-and-forward, 1 same speed, 2 slow to fast, 3 fast to slow. Otherwise: 0 off, 1 on. An out-of-range value prints <mode>: invalid mode; per-port failures print <port>: unsupported or <port>: invalid arg(s). Check the result with ASF show.

This changes forwarding behind SONiC’s back.

Unvalidated

drivshell> port ce0 asf 0

Built-in help

Parameters: <pbmp> [[ENCap=IEEE|HIGIG|B5632|HIGIG2|HGOE|HIGIG3]
    [AutoNeg=on|off] [ADVert=<portmode>]
    [LinkScan=on|off|hw|sw] [SPeed=10|100|1000] [FullDuplex=true|false]
    [TxPAUse=on|off] [RxPAUse=on|off] [STationADdr=<macaddr>]
    [LeaRN=<learnmode>] [DIScard=none|untag|all] [VlanFilter=<value>]
    [PRIOrity=<0-7>] [PortFilterMode=<value>]
    [PHymaster=<Master|Slave|Auto|None>] [Enable=<true|false>]
    [FrameMax=<value>]
    [MDIX=Auto|ForcedAuto|ForcedNormal|ForcedXover]
    [LoopBack=NONE|MAC|PHY]
    [MEdium=None|Copper|Fiber]]
    | [[EEE] [ENable=<enable|disable>|TxIDleTime=<0-2560>|TxWakeTime=<0-2560>|STats=<get>]]
    [ASF(in case of multimode asf)=<0-3>]
    [ASF(in case regular asf)=<0-1>]
    If only <ports> is specified, characteristics for that port are
    displayed. <ports> is a standard port bitmap (see "help pbmp").
    If AutoNeg is on, SPeed and DUPlex are the ADVERTISED MAX values.
    If AutoNeg is off, SPeed and DUPlex are the FORCED values.
    SPeed of zero indicates maximum speed.
    LinkScan enables automatic scanning for link changes with updating
    of MAC registers, and EPC_LINK (or equivalent)
    PAUse enables send/receive of pause frames in full duplex mode.
    <learnmode> is a numeric value controlling source lookup failure
    packets; it may include bit 0 to enable hardware L2 learn, bit 1
    to copy SLF packets to CPU, bit 2 to forward SLF packets.
    VlanFilter drops input packets that not tagged with a valid VLAN
    that contains the port. For XGS3, VlanFilter takes a value 0/1/2/3 where
    bit 0 turns on/off ingress filter and bit 1 turns on/off egress filter.
    PRIOrity sets the priority for untagged packets coming on this port.
    PortFilterMode takes a value 0/1/2 for mode A/B/C (see register manual).
    EEE: Energy Efficient Ethernet.
    ASF: Alternative Store and Forward (cut-thru mode).
    ASF Modes(in case of multimode asf): [0]SAF [1]Same Speed [2]Slow to Fast [3]Fast to Slow
    ASF Modes(in case regular asf): [0]Disable [1]Enable

Further reading

bcmsh.md (published as https://kamelnetworks.github.io/sonic/bcmsh.html), SDK-6.5.20 HSDK Getting Started Guide (GS-SDK6520-R), plus SDK-6.5.20/21/22 Release Notes (RN-SDK65xx-R), 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 …, SDK-6.5.20..6.5.27 Resolved-Issues-Improvements.xlsx (7 files), sonic-mgmt test suite files invoking bcmcmd (19 files), scripts/generate_dump (show techsupport collector), cPCI-6S10 Series 6U CompactPCI Switch Blade User’s Manual (50-15099-1000, Rev 1.0), BISDN Linux docs: OF-DPA client tools, auto-negotiation, FEC, SwitchControl, known issues, FBOSS: BcmSwitch gatherSdkState/rcload, validated shell commands, diag shell stress test, vendor-diag-shell skill, debugging doc, TestON OF-DPA switch driver, BCM-SDK命令的使用.pdf, bcm cli 命令, bcm cmd, 交换芯片Helix4 L2 L3功能验证, 【交换芯片】硬件调测使用场景下的BMC交换常用命令说明, [j-nsp] Link establishment issues with 1Gbps SX/LX SFPs on QFX5110, PRBS testing on Broadcom (SONiC) — prbs_broadcom.md + README, Auto-MDIX / Flow Control wiki notes (Chinese), OF-DPA with ONL Cheat Sheet.