Buffer settings

Table of Contents

Buffer Management

Buffer Calculation Model

BUFFER_POOL Table

BUFFER_PROFILE Table

BUFFER_PG Table

BUFFER_QUEUE Table

CABLE_LENGTH Table

Configure a Buffer in the Traditional Model

Buffer Management

Example model & SONiC version:

  • Aurora 830, Aurora 721, Aurora 621, Aurora 221
  • Netberg SONiC: sonic-broadcom-202311-n0

A buffer configuration includes:

  • Buffer pool size: The maximum memory a certain kind of traffic can occupy.
  • Buffer profile: Typically, most ports can share the same buffer configuration. You can create a buffer profile to attach that configuration to a port.
  • Buffer PG: The profile for each ingress priority.
  • Buffer queue: The profile for each egress queue.

The buffer configuration is stored in the BUFFER_POOL, BUFFER_PROFILE and BUFFER_PG tables. These tables are described in detail below.

Buffer Calculation Model

A traditional model, all buffer-related configurations must be configured manually in CONFIG_DB.

BUFFER_POOL Table

The BUFFER_POOL table defines the buffer pools for lossless/lossy and ingress/egress. It contains the following fields:

  • size: The size of the buffer pool.
  • type: Egress or ingress.
  • mode: Static or dynamic.
  • xoff: The size of the shared headroom pool, available for ingress_lossless_pool only.

There are four predefined buffer pools:

  • egress_lossless_pool
  • egress_lossy_pool
  • ingress_lossless_pool
  • ingress_lossy_pool

The size of egress_lossless_pool is always the maximum available memory, whereas the the size of all the other pools is the quantity of the accumulative per port/PG/queue reserved buffer size subtracted from the maximum available buffer size.

A default buffer configuration is provided for both top of rack and leaf router topologies:

  • For a top of rack sonic, SONiC assumes a buffer configuration in sonic-buildimage/device/netberg/<platform>/<sku>/buffers_defaults_t0.j2.
  • For a leaf router, SONiC assumes a buffer configuration in sonic-buildimage/device/netberg/<platform>/<sku>/buffers_defaults_t1.j2.
  • All ports run at the highest speed.

This table is referenced by the BUFFER_PROFILE table.

BUFFER_PROFILE Table

The BUFFER_PROFILE table defines the buffer profiles. It contains the following fields:

  • pool: The buffer pool object defined in the BUFFER_POOL table.
  • xon and xoff: The xon and xoff thresholds.
  • size: The headroom size.
  • dynamic_th: representing the proportion of currently available memory in the pool the PG or queue can occupy. It is calculated as: alpha = 2 ^ dynamic_th; proportion = alpha / (1 + alpha)

The table usually contains the following pre-defined profiles:

  • egress_lossless_profile
  • egress_lossy_profile
  • ingress_lossless_profile
  • ingress_lossy_profile

When the sonic is running in the traditional model, it has profiles for lossless traffic that get generated dynamically by querying pg_profile_lookup.ini with cable length and speed as the key. The xoff threshold of lossless traffic is determined by the port’s cable length, speed and port MTU. The xoff threshold calculation uses the configured port speed and cable length and the maximum MTU (9100) regardless of the configured value.

This table is referenced by the physical ports (BUFFER_PG) table.

BUFFER_PG Table

The BUFFER_PG table defines the mapping from port/priority to the buffer profile. It provides the ability to designate a buffer profile for traffic coming from a certain priority group of a port. Typically, priorities 3 and 4 are used for lossless traffic, and other priorities are used for lossy traffic.

When the sonic is running in the traditional model, it is updated automatically when the port’s speed is updated. If the cable length has been configured, priorities 3 and 4 are always generated for lossless traffic. A new profile is generated accordingly and referenced by the port in the BUFFER_PG table when the port’s speed is updated. When the port’s cable or MTU is updated, no update is made in the BUFFER_PG table.

The BUFFER_PG table can also be modified manually by creating a JSON file and then running sonic-cfggen -j qos_test_cfg.json –write-to-db.

BUFFER_QUEUE Table

The BUFFER_QUEUE table defines the mapping from a port or queue to egress to the buffer profile. It provides the ability to designate a buffer profile for traffic going through a certain queue of a port. Typically, queues 3 and 4 are used for lossless traffic and others for lossy traffic.

The BUFFER_QUEUE table can be modified manually by creating a JSON file and then running config qos reload.

CABLE_LENGTH Table

The CABLE_LENGTH table defines the length of the cables connected to the ports of the sonic.

Only 5m, 40m, 300m, and 80000m cable length values are supported. When updating the cable length of a port, the BUFFER_PG is not updated.

Configure a Buffer in the Traditional Model

Netberg SONiC comes with pre-defined balanced profiles. You can load them by issuing the “qos reload” command.

admin@sonic:~$ sudo config qos reload
Operation not completed successfully, please save and reload configuration.
Running command: /usr/local/bin/sonic-cfggen -d --write-to-db -t /usr/share/sonic/platform/aurora-621/buffers.json.j2,config-db -t /usr/share/sonic/platform/aurora-621/qos.json.j2,config-db -y /etc/sonic/sonic_version.yml
admin@sonic:~$ sudo config save -y
admin@sonic:~$ sudo config reload -y

Buffers and QoS configuration will be rendered from templates.

Expert users can manage If you are going to update the configuration of the entire sonic in batch mode, follow the steps below:

  • For buffer configuration, modify the /usr/share/sonic/platform/aurora-XXX/buffers_defaults_t{N}.j2 file.
  • For QoS configuration, modify the /usr/share/sonic/platform/aurora-XXX/qos_config.j2 or /usr/share/sonic/templates/qos_config.j2 file.

Then do config qos reload again.

Display the BUFFER_POOL and BUFFER_PROFILE

To display BUFFER_POOL and BUFFER_PROFILE tables, run:

admin@sonic:~$ mmuconfig -l
Pool: egress_lossless_pool
----  --------
mode  dynamic
size  16189824
type  egress
----  --------
Pool: egress_lossy_pool
----  --------
mode  dynamic
size  16189824
type  egress
----  --------
Pool: ingress_lossless_pool
----  --------
mode  dynamic
size  2940941
type  ingress
xoff  14704704
----  --------
Pool: ingress_lossy_pool
----  --------
mode  dynamic
size  15031475
type  ingress
----  --------
Profile: egress_lossless_profile
----------  --------------------
dynamic_th  1
pool        egress_lossless_pool
size        0
----------  --------------------
Profile: egress_lossy_profile
----------  -----------------
dynamic_th  1
pool        egress_lossy_pool
size        0
----------  -----------------
Profile: ingress_lossless_profile
----------  ---------------------
dynamic_th  1
pool        ingress_lossless_pool
size        0
xoff        244706
xon         1746919
xon_offset  18432
----------  ---------------------
Profile: ingress_lossy_profile
----------  ------------------
dynamic_th  1
pool        ingress_lossy_pool
size        0
----------  ------------------
NEWS

Latest news