[QoS] Support dynamic headroom calculation for Barefoot platforms (#11708)

Signed-off-by: Mariusz Stachura <mariusz.stachura@intel.com>

What I did
Adding the dynamic headroom calculation support for Barefoot platforms.

Why I did it
Enabling dynamic mode for barefoot case.

How I verified it
The community tests are adjusted and pass.
This commit is contained in:
Mariusz Stachura 2022-10-19 18:36:56 +02:00 committed by GitHub
parent 6f67a3ac6a
commit 9f88d03c2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 82 additions and 13 deletions

View File

@ -1,12 +1,12 @@
{% set default_cable = '5m' %} {% set default_cable = '5m' %}
{% set ingress_lossless_pool_size = '23850816' %} {% set ingress_lossless_pool_size = '43067728' %}
{% set ingress_lossy_pool_size = '36222208' %} {% set ingress_lossy_pool_size = '3520000' %}
{% set egress_lossless_pool_size = '29482816' %} {% set egress_lossless_pool_size = '46749824' %}
{% set egress_lossy_pool_size = '26400000' %} {% set egress_lossy_pool_size = '2463824' %}
{%- macro generate_port_lists(PORT_ALL) %} {%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #} {# Generate list of ports #}
{%- for port_idx in range(0,32) %} {%- for port_idx in range(0, 32) %}
{%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %}
{%- endfor %} {%- endfor %}
{%- endmacro %} {%- endmacro %}
@ -15,6 +15,9 @@
"BUFFER_POOL": { "BUFFER_POOL": {
"ingress_lossless_pool": { "ingress_lossless_pool": {
"size": "{{ ingress_lossless_pool_size }}", "size": "{{ ingress_lossless_pool_size }}",
{%- if dynamic_mode is defined %}
"xoff": "3153920",
{%- endif %}
"type": "ingress", "type": "ingress",
"mode": "dynamic" "mode": "dynamic"
}, },

View File

@ -1,12 +1,12 @@
{% set default_cable = '5m' %} {% set default_cable = '5m' %}
{% set ingress_lossless_pool_size = '23850816' %} {% set ingress_lossless_pool_size = '43067728' %}
{% set ingress_lossy_pool_size = '36222208' %} {% set ingress_lossy_pool_size = '3520000' %}
{% set egress_lossless_pool_size = '29482816' %} {% set egress_lossless_pool_size = '46749824' %}
{% set egress_lossy_pool_size = '26400000' %} {% set egress_lossy_pool_size = '2463824' %}
{%- macro generate_port_lists(PORT_ALL) %} {%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #} {# Generate list of ports #}
{%- for port_idx in range(0,32) %} {%- for port_idx in range(0, 32) %}
{%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %}
{%- endfor %} {%- endfor %}
{%- endmacro %} {%- endmacro %}
@ -15,6 +15,9 @@
"BUFFER_POOL": { "BUFFER_POOL": {
"ingress_lossless_pool": { "ingress_lossless_pool": {
"size": "{{ ingress_lossless_pool_size }}", "size": "{{ ingress_lossless_pool_size }}",
{%- if dynamic_mode is defined %}
"xoff": "3153920",
{%- endif %}
"type": "ingress", "type": "ingress",
"mode": "dynamic" "mode": "dynamic"
}, },

View File

@ -0,0 +1,4 @@
{%- set default_topo = 't0' %}
{%- set dynamic_mode = 'true' %}
{%- set shp = 'true' %}
{%- include 'buffers_config.j2' %}

View File

@ -23,7 +23,7 @@
], ],
"model_json_path" : "share/switch/aug_model.json", "model_json_path" : "share/switch/aug_model.json",
"switchapi_port_add": false, "switchapi_port_add": false,
"non_default_port_ppgs": 5 "non_default_port_ppgs": 6
} }
] ]
} }
@ -32,7 +32,7 @@
{ {
"device-id": 0, "device-id": 0,
"model_json_path": "share/switch/aug_model.json", "model_json_path": "share/switch/aug_model.json",
"non_default_port_ppgs": 5, "non_default_port_ppgs": 6,
"switchapi_port_add": false "switchapi_port_add": false
} }
] ]

View File

@ -0,0 +1,10 @@
[
{%- include 'peripheral_table.j2' %}
,
{
"PORT_PERIPHERAL_TABLE:global": {
"gearbox_model": "barefoot"
},
"OP": "SET"
}
]

View File

@ -226,6 +226,11 @@ def
"DEFAULT_LOSSLESS_BUFFER_PARAMETER": { "DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"AZURE": { "AZURE": {
"default_dynamic_th": "0" "default_dynamic_th": "0"
{%- if shp is defined -%}
,
"max_headroom_size" : "0",
"over_subscribe_ratio" : "1"
{%- endif -%}
} }
}, },
"LOSSLESS_TRAFFIC_PATTERN": { "LOSSLESS_TRAFFIC_PATTERN": {

View File

@ -530,7 +530,7 @@ sudo cp $BUILD_TEMPLATES/buffers_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMP
sudo cp $BUILD_TEMPLATES/qos_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ sudo cp $BUILD_TEMPLATES/qos_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
# Copy the templates for dynamically buffer calculation # Copy the templates for dynamically buffer calculation
{% if sonic_asic_platform == "mellanox" or sonic_asic_platform == "vs" %} {% if sonic_asic_platform == "mellanox" or sonic_asic_platform == "vs" or sonic_asic_platform == "barefoot" %}
if [ -f platform/{{ sonic_asic_platform }}/asic_table.j2 ] if [ -f platform/{{ sonic_asic_platform }}/asic_table.j2 ]
then then
sudo cp platform/{{ sonic_asic_platform }}/asic_table.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/asic_table.j2 sudo cp platform/{{ sonic_asic_platform }}/asic_table.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/asic_table.j2

View File

@ -0,0 +1,24 @@
{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['platform'] is defined %}
{%- set platform = DEVICE_METADATA['localhost']['platform'] %}
{%- endif -%}
[
{% set platform2asic = {
'x86_64-accton_as9516_32d-r0':'BAREFOOT-TOFINO-2',
'x86_64-accton_as9516bf_32d-r0':'BAREFOOT-TOFINO-2'
}
%}
{% set asic_type = platform2asic[platform] %}
{% if asic_type == 'BAREFOOT-TOFINO-2' %}
{
"ASIC_TABLE:BAREFOOT-TOFINO-2": {
"cell_size": "176",
"pipeline_latency": "68",
"mac_phy_delay": "0.8",
"peer_response_time": "9"
},
"OP": "SET"
}
{% endif %}
]

View File

@ -0,0 +1,18 @@
{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['platform'] is defined %}
{%- set platform = DEVICE_METADATA['localhost']['platform'] %}
{%- endif -%}
{% set platform2gearbox = {
'x86_64-accton_as9516_32d-r0':'barefoot',
'x86_64-accton_as9516bf_32d-r0':'barefoot'
}
%}
{% set gearbox_type = platform2gearbox[platform] %}
{% if gearbox_type == 'barefoot' %}
{
"PERIPHERAL TABLE:barefoot": {
"gearbox_delay" : "365"
},
"OP": "SET"
}
{% endif %}

View File

@ -33,3 +33,5 @@ endif
# Runtime dependency on sai is set only for syncd # Runtime dependency on sai is set only for syncd
#$(SYNCD)_RDEPENDS += $(BFN_SAI) $(WNC_OSW1800_PLATFORM) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) #$(SYNCD)_RDEPENDS += $(BFN_SAI) $(WNC_OSW1800_PLATFORM) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM)
$(SYNCD)_RDEPENDS += $(BFN_SAI) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) $(SYNCD)_RDEPENDS += $(BFN_SAI) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM)
export SONIC_BUFFER_MODEL=dynamic