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
PBMPbelow; 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 printsport: Error: unrecognized port bitmap: <word>, soport statusandport fecstatare not commands.After the bitmap, the next word selects a sub-form:
detach,probe,attach,lanes,Bridge,EEE,detailorasf. These words must be typed in full (any case). Anything else is read as a list of port attributes; seePORT PBMP.The built-in help is incomplete:
It does not list the
detach,probe/attach,lanes,Bridgeanddetailsub-forms.It does not list the
InterFaceandSpanningTreeProtocolattributes, and several value lists are longer than it shows.The built-in help shows
DIScard; the shell actually needs at leastdisc(the key isDISCard), sodis=allis rejected.The built-in help shows
STationADdr; the key isSTationADdress, and both spellings work.There is no
prbsorfecstatsub-form. PRBS tests are done withphy.
Setting attributes,
lanes,Bridge <n>,EEEwith values andasfchange 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
detachandprobe/attachtear down or rebuild the SDK’s port state and may leavesyncdconfused 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=trueUnvalidated — 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=0anden=1set theEnableattribute (Enableonly needs itsE),lanes 4is thePORT PBMP lanessub-form, andspeed=40000setsSPeed.lanescannot 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:
xe60exists only where the configuration creates that port. On a switch with other ports the shell rejects the bitmap (unrecognized port bitmap); usepsorpbmpto 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 printsport: Cannot get and set port properties in one command. An unknown word printsport: Unknown argument <word>.Key
Bare key shows it
Values
Enableyes
boolean
AutoNegyes
boolean
ADVertyes
port mode or ability list to advertise
SPeedyes
Mb/s; 0 means maximum speed. With autonegotiation on, this is the maximum advertised speed; with it off, the forced speed.
FullDuplexyes
boolean
LinkScanyes
None,SW,HW,OFF,ON(ONmeans SW,OFFmeans none)LeaRNyes
bit mask: bit 0 hardware learning, bit 1 copy unknown-source packets to the CPU, bit 2 forward them
DISCardyes
None,All,Untag,TagVlanFilteryes
bit 0 ingress filtering, bit 1 egress filtering
PRIOrityyes
priority (0–7) given to untagged packets
PortFilterModeyes
0, 1 or 2 (mode A, B, C)
PHymasteryes
Slave,Master,Auto,NoneInterFaceyes
interface type:
None,Null,MII,GMII,SGMII,XFI,SFI,KR,KR4,CR,CR4,SR4,XLAUI,CAUI4and many more. Not in the built-in help.LoopBackyes
NONE,MAC,PHY,RMT,MAC_RMT,EDB,NIF. The built-in help shows only the first three.SpanningTreeProtocolyes
Disable,Block,LIsten,LEarn,Forward. Not in the built-in help.STationADdressyes
MAC address used as the source of pause frames
TxPAUse,RxPAUseyes
boolean
ENCapsulationno
IEEE,HIGIG,B5632,HIGIG2,HIGIG2_LITE,HIGIG2_L2,HIGIG2_L3,OBSOLETE,SOP,HGOE,CPRI,RSVD4,HIGIG3FrameMaxno
maximum received frame size in bytes
MDIXno
Auto,ForcedAuto,ForcedNormal,ForcedXoverMediumno
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 linkscanUnvalidated
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
0xhex. On failure it printsUnit:<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;
syncdstill uses these ports.Unvalidated
drivshell> port xe5 detach
- PORT PBMP probe
Probe (re-attach) the selected ports and print
Probed port bitmap <bitmap>.attachdoes 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 anEEE Details:table: port, EEE state, transmit idle and wake times, and event counts and durations. With keys, printPort = <name>(<n>)for each port, then:ENable=enableorENable=disableturns EEE on or off;TxIDleTimeandTxWakeTimeset the transmit idle and wake times in microseconds;STats=getprintsTx 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>: unsupportedor<port>: invalid arg(s). Check the result withASF 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]EnableFurther 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.