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 the mgmt bitmap);

  • 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 0x or 0X is 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,~xe3 is all Ethernet ports except xe3, while ~xe3,e contains xe3.

  • Ranges are written xe0-xe5, or with bare numbers 1-8. Ports between the two ends that are not of the given type are skipped. a-b-c is an error.

  • Step. :N after 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 the ce ports are all odd logical numbers, so ce0-ce7:2 selects all of ce0–ce7.

  • Bare numbers are looked up in the unit’s port-number map. If the configuration variable dport_map_direct is 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 names XLB0PORT, CLG2PORT and CLG3PORT and the type d3c contain 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 print Invalid pbmp string (…); use 'pbmp ?' for more info.

Type and group names, in the order the shell tries them:

Name

Ports

fe, ge, xe

Fast Ethernet, Gigabit and 10G-class (xe) ports

d3c, mdc, le, ce, cd, cc

Other speed classes. On Trident 3 normally only xe and ce ports exist.

hg, hl, hg_s, st, il, axp, sch, sci, qsgmii, sfi/if, fabric, sci_sfi, spi, spi_s, rcy, rdb, fae, msec, roe, otn

Port classes of other chip families (HiGig, Interlaken, fabric, …). They are accepted on Trident 3 but select no ports.

e

All Ethernet ports

cpu

The CPU port, cpu0

lb

Loopback ports

mmu, mgmt

MMU ports; management ports

all

All ports, without MACsec, loopback, RDB and FAE ports

*

All front-panel ports

none

No ports

phy

Numbers that follow are physical port numbers (phy1…)

ci

Ports of a ci block

hyper

HyperPort ports

any block name

All ports of that block type, or with a number, of block n (for example the port-macro blocks CLPORT and XLPORT)

Port status

ps shows link, speed and autonegotiation state; port reads and changes port attributes.