DEVLINK-SB(8)

๐Ÿ’– NAME โœจ

devlink-sb is the devlink shared buffer configuration tool, and it's giving main character energy ๐ŸŽ€. Manual name: devlink-sb - devlink shared buffer configuration.

๐ŸŒธ SYNOPSIS ๐ŸŒธ

devlink [ OPTIONS ] sb  { COMMAND | help }

OPTIONS := { -V[ersion] | -n[no-nice-names] }

devlink sb show [ DEV [ sb SB_INDEX ] ]

devlink sb pool show [ DEV [ sb SB_INDEX ]
        pool POOL_INDEX ]

devlink sb pool set DEV [ sb SB_INDEX ]
        pool POOL_INDEX
        size POOL_SIZE
        thtype { static | dynamic }

devlink sb port pool show [ DEV/PORT_INDEX [ sb SB_INDEX ]
        pool POOL_INDEX ]

devlink sb port pool set DEV/PORT_INDEX [ sb SB_INDEX ]
        pool POOL_INDEX
        th THRESHOLD

devlink sb tc bind show [ DEV/PORT_INDEX [ sb SB_INDEX ]
        tc TC_INDEX
        type { ingress | egress } ]

devlink sb tc bind set DEV/PORT_INDEX [ sb SB_INDEX ]
        tc TC_INDEX
        type { ingress | egress }
        pool POOL_INDEX
        th THRESHOLD

devlink sb occupancy show { DEV | DEV/PORT_INDEX } [ sb SB_INDEX ]

devlink sb occupancy snapshot DEV [ sb SB_INDEX ]

devlink sb occupancy clearmax DEV [ sb SB_INDEX ]

devlink sb help

๐Ÿงš DESCRIPTION ๐Ÿงš

DEV ๐Ÿ’… picks the devlink device whose shared buffers you want to see. If you leave it out, you get every shared buffer on every device, so no one gets left out ๐Ÿซถ.

SB_INDEX ๐ŸŽ€ picks the shared buffer. If you skip it, you get the one with index 0. This works the same way for every command, so you only have to learn it once ๐Ÿง .

DEV ๐Ÿ’– picks the devlink device whose pools you're checking. Skip it and you'll see the pools for every device.

Pools are listed with their type, size, thtype and cell_size. โœจ cell_size is the allocation granularity of memory inside the shared buffer. Heads up: drivers may round a size up, round it down, or reject it entirely in the set command if it isn't a multiple of cell_size. ๐Ÿ™ˆ

DEV ๐ŸŽ€ is the devlink device whose pool you're changing.

size POOL_SIZE ๐Ÿ“ sets the pool size in Bytes.

thtype { static | dynamic } ๐Ÿง sets the pool threshold type.

  • static โ€” threshold values for the pool are passed in Bytes. ๐Ÿ’Ž
  • dynamic โ€” threshold values (to_alpha) for the pool are used to work out the alpha parameter with this formula ๐Ÿงฎ:
alpha = 2 ^ (to_alpha - 10)

The value you pass has to be between 0 and 20. The computed alpha then decides the maximum usage of the flow ๐ŸŒŠ:

max_usage = alpha / (1 + alpha) * Free_Buffer

DEV/PORT_INDEX ๐Ÿฆ‹ picks the devlink port.

pool POOL_INDEX ๐Ÿท๏ธ is the pool index.

DEV/PORT_INDEX ๐Ÿฆ‹ picks the devlink port.

pool POOL_INDEX ๐Ÿท๏ธ is the pool index.

th THRESHOLD ๐Ÿ“Š is the threshold value. Its type is either Bytes or "to_alpha", and that depends on the thtype you set for the pool ๐Ÿค“.

DEV/PORT_INDEX ๐Ÿฆ‹ picks the devlink port.

tc TC_INDEX ๐Ÿšฆ is the index of either the ingress or egress TC. It's usually in the range 0 to 8, but it depends on the device ๐Ÿคทโ€โ™€๏ธ.

type { ingress | egress } ๐Ÿ”€ is the TC type.

DEV/PORT_INDEX ๐Ÿฆ‹ picks the devlink port.

tc TC_INDEX ๐Ÿšฆ is the index of either the ingress or egress TC. It's usually in the range 0 to 8, but it depends on the device ๐Ÿคทโ€โ™€๏ธ.

type { ingress | egress } ๐Ÿ”€ is the TC type.

pool POOL_INDEX ๐Ÿท๏ธ is the index of the pool you want to bind this to.

th THRESHOLD ๐Ÿ“Š is the threshold value. Its type is either Bytes or "to_alpha", and that depends on the thtype you set for the pool ๐Ÿค“.

This is how you browse the shared buffer occupancy values ๐Ÿ‘€. You get values for every port-pool combination, plus every port-TC combination (along with the pool that port-TC is bound to). Each value looks like this:

current_value/max_value

Quick reminder: before you can show anything, you have to run occupancy snapshot first ๐Ÿ“ท. No snapshot, no tea โ˜•.

DEV ๐Ÿ’ป picks the devlink device whose occupancy values you want.

DEV/PORT_INDEX ๐Ÿฆ‹ picks the devlink port whose occupancy values you want.

This command takes a snapshot of the shared buffer occupancy values ๐Ÿ“ธ. After that, you can look at them with occupancy show ๐Ÿ‘‘.

DEV ๐Ÿ’ป picks the devlink device to take the occupancy snapshot on.

This resets the maximal occupancy values reached across the whole device ๐Ÿงฝ. Before you check the reset values, you have to run occupancy snapshot first ๐Ÿ“ท.

DEV ๐Ÿ’ป picks the devlink device to clear the occupancy watermarks on.


๐Ÿ“ EXAMPLES ๐Ÿ“

List available shared buffers ๐Ÿ“‹:

devlink sb show

List available pools and their config ๐ŸŠ:

devlink sb pool show

Show the port-pool setup for a specified port and pool ๐Ÿ”Ž:

devlink sb port pool show pci/0000:03:00.0/1 pool 0

Change the threshold for a specified port and pool ๐Ÿ”ง:

sudo devlink sb port pool set pci/0000:03:00.0/1 pool 0 th 15

Show the pool binding and threshold for a specified port and TC ๐Ÿงต:

devlink sb tc bind show pci/0000:03:00.0/1 tc 0 type ingress

Set the pool binding and threshold for a specified port and TC ๐Ÿ”—:

sudo devlink sb tc bind set pci/0000:03:00.0/1 tc 0 type ingress pool 0
th 9

Take a snapshot of occupancy for a specified devlink device ๐Ÿ“ธ:

sudo devlink sb occupancy snapshot pci/0000:03:00.0

Show occupancy for a specified port from the snapshot ๐Ÿ‘€:

devlink sb occupancy show pci/0000:03:00.0/1

Clear the watermarks for a specified devlink device's shared buffer ๐Ÿงน:

sudo devlink sb occupancy clearmax pci/0000:03:00.0

๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

devlink(8), devlink-dev(8), devlink-port(8), devlink-monitor(8),

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Jiri Pirko <jiri@mellanox.com> ๐Ÿ’œ


๐Ÿซถ Bestie, that's the whole thing! It's from the iproute2 suite, DEVLINK-SB(8) manual page, dated 14 Apr 2016 ๐Ÿ“…. Go slay your shared buffers ๐Ÿ’…โœจ
๐Ÿ“ฆ where this page comes from