Ports and port bitmaps
Most port commands take a single port or a port bitmap (<pbmp> in the
grammar, sometimes written PBMP): a set of ports written as a list,
ranges or port types. This chapter describes how the shell names ports and
how it reads a port bitmap.
Port names
The shell names a port by a type prefix and a zero-based index within that
type: ge, xe, ce, cd and so on, cpu0 for the CPU port and
lb0 for a loopback port. The prefix comes from the port’s current type,
which on Trident 3 follows its configured speed (xe for 10G/25G, ce
for 100G). A port’s name can therefore change when it is reconfigured, for
example through port lane and speed changes or FLEXport.
Shell port names are not SONiC EthernetN names. The mapping from logical
port to physical lane is set by the portmap_* configuration variables (see
Configuration variables), and SONiC’s port_config.ini maps EthernetN to lanes.
show pmap and portmod info pm show the mapping from logical
ports to physical lanes, and pbmp port resolves one name to its
logical port number.
Port numbers that the shell prints (in pbmp output, register
suffixes and so on) are SDK logical port numbers, not front-panel numbers.
On a 32-port 100G Trident 3 switch running SONiC, here a Celestica Seastone2 with one front-panel port broken out into four 10G ports, the shell shows:
ce0–ce30: the 100G ports, logical ports 1, 5, 13, 17, … 127 (every fourth number, with gaps);xe0–xe3: the four 10G ports of the split port, logical ports 9–12;xe4: the management port, logical port 66 (also in themgmtbitmap);cpu0: logical port 0; two loopback ports, logical 65 and 131.
There are no ge ports, so examples written for older switches
(ge0, ge0-ge3) fail with Invalid pbmp string or unrecognized
port bitmap.
Port bitmap grammar
A port bitmap is either a hexadecimal number or a comma-separated list of terms:
PBMP : '0x' HEXDIGITS raw logical-port bitmap (also '0X')
| LIST
LIST : TERM { ',' TERM }
TERM : [ '~' | '!' ] RANGE [ ':' STEP ]
RANGE : PORT '-' PORT ports PORT..PORT of that type
| PORT one port
| NAME every port of a type or block
PORT : INTEGER bare number (see below)
| NAME INTEGER n-th port of a type, or block number
STEP : INTEGER every STEP-th port number, STEP > 0
Rules:
Hex. A string that starts with
0xor0Xis read as a raw bitmap of logical port numbers; nothing else in the string is parsed.Exclusion.
~or!in front of a term removes its ports from the bitmap built so far, so order matters:e,~xe3is all Ethernet ports exceptxe3, while~xe3,econtainsxe3.Ranges are written
xe0-xe5, or with bare numbers1-8. Ports between the two ends that are not of the given type are skipped.a-b-cis an error.Step.
:Nafter a range keeps every N-th logical port number of it, starting from the first. It must be followed by,or the end of the string. Because logical numbers are not consecutive within a type, the result is often not “every N-th port”: on the switch described above theceports are all odd logical numbers, soce0-ce7:2selects all ofce0–ce7.Bare numbers are looked up in the unit’s port-number map. If the configuration variable
dport_map_directis set, they are logical port numbers. A number that is not a valid port is an error.Names are matched in full, ignoring case; abbreviations are not accepted. A name ends at the first digit,
-,,or:. The block namesXLB0PORT,CLG2PORTandCLG3PORTand the typed3ccontain a digit and are recognised as whole words.Any other character, a trailing
,or an unknown name makes the whole bitmap invalid. Commands then usually printInvalid pbmp string (…); use 'pbmp ?' for more info.
Type and group names, in the order the shell tries them:
Name |
Ports |
|---|---|
|
Fast Ethernet, Gigabit and 10G-class ( |
|
Other speed classes. On Trident 3 normally only |
|
Port classes of other chip families (HiGig, Interlaken, fabric, …). They are accepted on Trident 3 but select no ports. |
|
All Ethernet ports |
|
The CPU port, |
|
Loopback ports |
|
MMU ports; management ports |
|
All ports, without MACsec, loopback, RDB and FAE ports |
|
All front-panel ports |
|
No ports |
|
Numbers that follow are physical port numbers ( |
|
Ports of a |
|
HyperPort ports |
any block name |
All ports of that block type, or with a number, of block n (for
example the port-macro blocks |
Port status
ps shows link, speed and autonegotiation state; port reads
and changes port attributes.