Buffers and queues

The MMU (memory management unit) holds packets between ingress and egress. On SONiC most buffer settings come from the BUFFER_POOL, BUFFER_PROFILE and BUFFER_PG tables (rendered from the HWSKU’s buffers*.j2 templates) and are programmed through the SAI while the switch runs. config.bcm sets the starting point the SAI works from, and the SDK can also take a complete buffer configuration from buf.* variables.

Start-up profile

mmu_lossless

0 (default) starts with a lossy buffer layout, 1 with a lossless one that reserves PFC headroom. SONiC Trident 3 files leave it at 0 and let SONiC configure lossless priority groups.

bcm_num_cos

Number of class-of-service queues per port at start-up (default 8).

asf_mem_profile

Cut-through (ASF) buffer profile: 0 store-and-forward, 1 cut-through between ports of similar speed, 2 cut-through between all speeds.

sai_mmu_custom_config, sai_optimized_mmu

SAI variables that select how the SAI sets up the MMU defaults it reports to SONiC; several SONiC Trident 3 files set sai_optimized_mmu=1.

Custom buffer configuration

With mmu_config_override=0 the SDK reads a full MMU configuration from buf.* variables instead of its built-in one. It checks and calculates the result; if that fails it keeps the built-in configuration. The names follow the pattern

buf.<object><N>.<attribute>=<value>     one instance
buf.<object>.<attribute>=<value>        all instances

and the per-port objects also accept the per-port suffixes, for example buf.prigroup7.headroom_xe0.

buf.device.headroom

Global headroom.

buf.pool<N>.size, .yellow_size, .red_size

Service pool sizes. A % value is a share of the usable buffer.

buf.prigroup<N>.<attribute>

Per-port priority group: guarantee, headroom, user_delay, switch_delay, device_headroom_enable, pool_scale, pool_limit, pool_resume, pool_floor, flow_control_enable.

buf.queue<N>.<attribute>, buf.mqueue<N>.<attribute>

Per-port unicast and multicast queues: guarantee, discard_enable, pool_scale, pool_limit, pool_resume, color_discard_enable, yellow_limit, red_limit and the resume thresholds.

buf.qgroup<N>.<attribute>, buf.ingportpool<N>.<attribute>

Queue groups and per-port ingress pool limits.

buf.map.pri.prigroup, buf.map.prigroup.pool, buf.map.queue.pool, buf.map.mqueue.pool

Comma-separated maps from internal priority to priority group, priority group to pool, and queue to pool.

Units: a plain decimal number is a count of 256-byte cells; b, k (1024 bytes) and m (1048576 bytes) suffixes give bytes. pool_scale is a dynamic-threshold factor, not a size. If both user_delay and switch_delay are set, the SDK calculates headroom from them and the port speed and ignores a configured headroom.

Warning

A buf.* configuration replaces the SDK’s defaults for the whole chip. SONiC’s buffer manager still programs its own profiles on top through the SAI. Only use it with a buffer design that has been validated for the switch.

buf.map.egress_pool<N>.ingress_pool

Maps egress service pool N to an ingress pool. The Broadcom reference Trident 3 configuration in the SONiC tree is the only Trident 3 file that uses a buf.* variable, and only this one.

All buffer and queue variables are in the reference.