LINKscan

Configure/Display link scanning

LINKscan

Shortest form: link.

Show or configure link scanning: which ports have their link state polled by software, which by hardware, and the software polling interval. When linkscan sees a link change it updates the MAC (speed, duplex, pause) and notifies the SDK’s link callbacks. On SONiC this is how syncd learns that a port went up or down, so changing linkscan from the shell changes what SONiC sees.

With no argument, linkscan prints the current state: Linkscan enabled, the software polling interval in microseconds, and the software, hardware and disabled port bitmaps; or Linkscan disabled.

Otherwise it takes these keys and at most one bare word:

  • SwPortBitMap=<pbmp>: ports scanned by software;

  • HwPortBitMap=<pbmp>: ports scanned by hardware;

  • Force=<pbmp>: make linkscan process these ports once, even if their state did not change;

  • Interval=<usec>: software polling interval; 0 turns linkscan off;

  • on, enable or yes; off, disable or no; or a plain number, taken as the interval.

Port bitmaps are described in Ports and port bitmaps. The current software and hardware sets are the defaults, so giving only SwPortBitMap keeps the hardware set. Ports in neither set are not scanned. A port in both sets is an error (Same port can't use both software and hardware linkscan). The default interval is the bcm_linkscan_interval configuration variable, 250000 µs if unset. on restores the interval used before the last off.

On Trident 3, hardware linkscan runs as firmware on the switch’s built-in M0 microcontroller, which also drives the front-panel LEDs. linkscan on starts that firmware; linkscan off on its own stops it.

SONiC uses software linkscan. On a SONiC switch the state shows Linkscan enabled, an interval of 250000 µs, every ce and xe port in the software bitmap and none in the hardware and disabled bitmaps. Each bitmap is printed as a long hexadecimal number followed by the port types it contains (: ce,xe or : none).

The built-in help shows FORCE=; the shell actually accepts Force= abbreviated to f=. The help does not mention the enable/yes, disable/no synonyms or the plain-number interval. PRBS testing on Broadcom (SONiC) — prbs_broadcom.md + README turns linkscan off around PRBS tests on another Broadcom SONiC switch.

Showing the state is safe. Everything else changes linkscan behind SONiC’s back.

Warning

With linkscan off, or a port removed from both sets, SONiC no longer learns about link changes on those ports and its interface status goes stale. linkscan off also stops the M0 firmware, so the front-panel LEDs may stop updating. Restore the previous settings afterwards.

Hardware-validated — Show the linkscan state

drivshell> linkscan
LINKscan: Linkscan enabled
LINKscan:   Software polling interval: 250000 usec
LINKscan:   Software Port BitMap 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000888888888888888c2222222222223e22: ce,xe
LINKscan:   Hardware Port BitMap 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000: none
LINKscan:   Disabled Port BitMap 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000: none

Unvalidated — Software linkscan on two ports every 100 ms, hardware linkscan on none

drivshell> linkscan SwPortBitMap=ce0,ce1 HwPortBitMap=none Interval=100000
LINKscan on

Turn linkscan on with the interval used before the last off (or the default). enable and yes do the same; all three must be typed in full. On Trident 3 this also starts the M0 linkscan/LED firmware. If the interval would be 0 it prints WARNING: Cannot enable Linkscan if the polling interval is zero.

Unvalidated

drivshell> linkscan on
LINKscan off

Turn linkscan off and remember the interval for a later on. disable and no do the same. When off is the only word, it also stops the M0 firmware.

Warning

SONiC stops receiving link changes for every port until linkscan is turned back on.

Unvalidated

drivshell> linkscan off

Built-in help

Parameters: [SwPortBitMap=<pbmp>] [HwPortBitMap=<pbmp>]
    [Interval=<usec>] [FORCE=<pbmp>] [on] [off]
    With no arguments, displays the linkscan status for all ports.
    Enables software linkscan on ports specified by SwPortBitMap.
    Enables hardware linkscan on ports specified by HwPortBitMap.
    Disables linkscan on all other ports.
    Interval specifies non-default linkscan interval for software.
    Note: With linkscan disabled, autonegotiated ports will NOT have
    the MACs updated with speed/duplex..
    FORCE=<pbmp> requests linkscan to update ports once even if link
    status did not change.

Further reading

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 …, BCM_SDK命令, PRBS testing on Broadcom (SONiC) — prbs_broadcom.md + README.