ALPM

ALPM trouble shooting

ALPM

Debug and maintenance commands for ALPM (algorithmic longest-prefix match), the way large route tables are stored when the config property l3_alpm_enable is set. To look up a route, see l3 alpm find.

All words must be written out in full; case does not matter. With no argument the command prints its usage. If ALPM is not enabled it prints ALPM is disabled! and does nothing. Apart from trace and defrag, the commands need the newer ALPM implementation. Without it they print Feature alpm2 is unavailable.

SONiC Trident 3 switches can run with ALPM off. The route table is then the plain route TCAM (see l3 defip show), and every alpm command, including the ones below, prints only ALPM is disabled!. The command does not count as failed, so the SAI front-end adds no error line. The descriptions below apply when ALPM is enabled.

The built-in help differs from what the shell accepts:

  • Its first line, <init|cust1|v4|v6|pvt|bkt|fmt> <show|add>, is out of date. cust1, v4 and v6 are not commands. add is accepted but does nothing except print the usage.

  • alpm defrag only works on Tomahawk 3. On Trident 3 it prints Currently unavailable for this chip.

  • The [acb_idx] argument of the show commands is a bit mask of the two ALPM blocks (1, 2, or the default 3 for both), not an index.

  • Commands not in the help: alpm util (an IPv6 address formatting self-test), alpm load (does nothing), alpm debug bmp <n> (sets a debug mask) and alpm hitbit with no argument (shows the hit-bit interval). alpm hitbit also accepts on/off.

The show commands, table dump, trace dump and util are safe. init, data restore, hitbit, trace and debug change the route-table software state underneath syncd.

Warning

alpm init resets the route table manager. Do not use it on a production switch.

SDK-6.5.20 HSDK Getting Started Guide (GS-SDK6520-R), plus SDK-6.5.20/21/22 Release Notes (RN-SDK65xx-R) lists alpm among the SDK 6.5.20 shell commands.

Hardware-validated

drivshell> alpm usage show
ALPM is disabled!
alpm init

Re-initialise ALPM. Disrupts routing on a running switch.

Unvalidated

drivshell> alpm init
alpm hitbit [enable | on | disable | off]

With no argument, print Current settings: and the hit-bit Interval. Otherwise start or stop the background task that collects route hit bits; it prints ALPM hitbit enable OK! or ALPM hitbit disable OK!. Changes software state.

Unvalidated

drivshell> alpm hitbit
alpm trace <enable | disable | clear>

Turn the ALPM operation trace on or off, or clear it. The sanity, wrap and dump forms are below.

Unvalidated

drivshell> alpm trace enable
alpm trace sanity [enable=<0|1>] [Start=<n>] [End=<n>]

Check the ALPM state after each traced operation within an index range.

Unvalidated

drivshell> alpm trace sanity enable=1
alpm trace wrap <enable | disable>

Let the trace buffer wrap around, or stop tracing when it is full.

Unvalidated

drivshell> alpm trace wrap enable
alpm trace dump [Showflags=<yes|no>] [File=<filename>]

Print the trace, or write it to a file. A trace too large for the console is refused with Too big to dump! Suggest to use: alpm trace dump file=<name>. Safe.

Unvalidated

drivshell> alpm trace dump File=/tmp/alpm-trace.txt
alpm table dump [raw | chg | all | nocache] <mem> <index> <fmt> [<ent> <vrf_id>]

Decode one entry of an ALPM memory. On Trident 3 only L3_DEFIP_ALPM_RAW is accepted for <mem>. <fmt> is the bucket format to decode it with. Safe.

Hardware-validated

drivshell> alpm table dump L3_DEFIP_ALPM_RAW 0 1
ALPM is disabled!
alpm debug info on [pvt | rte | cnt | hit | all | none]

With no flag, show which ALPM debug output is on; otherwise choose it. alpm debug bmp <n> sets a separate debug mask.

Unvalidated

drivshell> alpm debug info on
alpm data <save | restore> [FileName=<fn>]

Save the ALPM database to a file (default alpm_data.bin), or load it back. Loading needs an empty database (ALPM DB not empty! Clear DB before restore (rc)) and changes the route table.

Unvalidated

drivshell> alpm data save FileName=/tmp/alpm_data.bin
alpm defrag [Vrf=<-2|x|-4>] [Ipt=<0|1|3>] [Time=<msec>] [l2merge=<cnt>] [l3merge=<cnt>]

Defragment ALPM buckets. Only works on Tomahawk 3; on Trident 3 it prints Currently unavailable for this chip. Vrf: a VRF number, -2 for the global table, -4 for all. Ipt: 0 IPv4, 1 IPv6, 3 both.

Unvalidated

drivshell> alpm defrag
alpm bkt show [<acb_bmp>]

Show ALPM bucket use. fmt show, pvtlen show, stat show and config show take the same argument and show bucket formats, pivot lengths, statistics and configuration. Safe.

Hardware-validated

drivshell> alpm stat show
ALPM is disabled!
alpm pvt show [<acb_bmp>] [<bkt>]

Show the pivots, all of them or those of one bucket. Safe.

Hardware-validated

drivshell> alpm pvt show
ALPM is disabled!
alpm pvttrie show [<acb_bmp>] [<vrf>] [<ipt>]

Print the pivot trie. alpm bkttrie show prints the bucket trie and takes the same arguments. Safe.

Hardware-validated

drivshell> alpm pvttrie show 3 0 0
ALPM is disabled!
alpm usage show [-1]

Show ALPM resource use. With -1 it prints the usage log instead. Safe.

Hardware-validated

drivshell> alpm usage show
ALPM is disabled!
alpm projection show [<v4v6_ratio_x100>]

Estimate how many routes fit for a given IPv4:IPv6 mix (the ratio times 100). Safe.

Hardware-validated

drivshell> alpm projection show 50
ALPM is disabled!
alpm tcam show

Show the state of the ALPM TCAM zones. Safe.

Hardware-validated

drivshell> alpm tcam show
ALPM is disabled!
alpm util

Not in the built-in help. Parses six fixed IPv6 addresses, formats them back and prints Original:/Converted: pairs: a self-test of the shell’s IPv6 handling. Safe.

Unvalidated

drivshell> alpm util

Built-in help

Parameters: <init|cust1|v4|v6|pvt|bkt|fmt> <show|add>
    alpm init
    alpm hitbit <enable|disable>
    alpm trace <enable|disable|clear>
    alpm trace sanity [enable=<val>] [Start=<val>] [End=<val>]
    alpm trace wrap <enable|disable>
    alpm trace dump [Showflags=<yes|no>] [File=<filename>]
    alpm table dump [raw|chg|all|nocache] <mem> <index> <fmt> [<ent> <vrf_id>]
        For Trident3, only accept L3_DEFIP_ALPM_RAW in <mem>
        For Tomahawk3, other usage can be:
        alpm table dump [nocache] <LEVEL1 mem> <index or -1(all)> <levels to print(1|2|3)> <entry 0|1>
        <index> is used to index <mem>
        <fmt> is used to parse <mem>
        <ent> is used to index entry in <mem>
    alpm debug info on [pvt|rte|cnt|hit|all|none]
    alpm data <save|restore> [FileName=<fn>]
    alpm defrag [vrf=<-2|x|-4 for all>] [ipt=<0|1|3 for all>] [time=<msec>] [l2merge=<cnt>] [l3merge=<cnt>]
    alpm bkt show [acb_idx]
    alpm fmt show [acb_idx]
    alpm pvtlen show [acb_idx]
    alpm stat show [acb_idx]
    alpm pvttrie show [acb_idx] [vrf] [ipt]
    alpm bkttrie show [acb_idx] [vrf] [ipt]
    alpm usage show [-1 for dump usage log]
    alpm projection show [v4v6_ratio x100]
    alpm tcam show
    alpm config show [acb_idx]
    alpm pvt show [acb_idx] [bkt]

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).